public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH unit-tests 1/4] Move idt.c into lib code.
@ 2010-12-14 15:48 Gleb Natapov
  2010-12-14 15:48 ` [PATCH unit-tests 2/4] Make access.c use library functions Gleb Natapov
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Gleb Natapov @ 2010-12-14 15:48 UTC (permalink / raw)
  To: kvm; +Cc: avi

Make it compilable in 32 and 64 bit mode.
---
 config-x86-common.mak |    7 +-
 lib/x86/idt.c         |   32 ++++-------
 lib/x86/idt.h         |    1 +
 x86/idt.c             |  148 -------------------------------------------------
 4 files changed, 16 insertions(+), 172 deletions(-)
 delete mode 100644 x86/idt.c

diff --git a/config-x86-common.mak b/config-x86-common.mak
index c5508b3..2269c4a 100644
--- a/config-x86-common.mak
+++ b/config-x86-common.mak
@@ -11,6 +11,7 @@ cflatobjs += \
 cflatobjs += lib/x86/fwcfg.o
 cflatobjs += lib/x86/apic.o
 cflatobjs += lib/x86/atomic.o
+cflatobjs += lib/x86/idt.o
 
 $(libcflat): LDFLAGS += -nostdlib
 $(libcflat): CFLAGS += -ffreestanding -I lib
@@ -50,7 +51,7 @@ $(TEST_DIR)/vmexit.elf: $(cstart.o) $(TEST_DIR)/vmexit.o
 $(TEST_DIR)/smptest.elf: $(cstart.o) $(TEST_DIR)/smptest.o
 
 $(TEST_DIR)/emulator.elf: $(cstart.o) $(TEST_DIR)/emulator.o \
-			   $(TEST_DIR)/vm.o $(TEST_DIR)/idt.o
+			   $(TEST_DIR)/vm.o
 
 $(TEST_DIR)/port80.elf: $(cstart.o) $(TEST_DIR)/port80.o
 
@@ -65,9 +66,9 @@ $(TEST_DIR)/realmode.o: bits = 32
 
 $(TEST_DIR)/msr.elf: $(cstart.o) $(TEST_DIR)/msr.o
 
-$(TEST_DIR)/idt_test.elf: $(cstart.o) $(TEST_DIR)/idt.o $(TEST_DIR)/idt_test.o
+$(TEST_DIR)/idt_test.elf: $(cstart.o) $(TEST_DIR)/idt_test.o
 
-$(TEST_DIR)/xsave.elf: $(cstart.o) $(TEST_DIR)/idt.o $(TEST_DIR)/xsave.o
+$(TEST_DIR)/xsave.elf: $(cstart.o) $(TEST_DIR)/xsave.o
 
 $(TEST_DIR)/rmap_chain.elf: $(cstart.o) $(TEST_DIR)/rmap_chain.o \
 			     $(TEST_DIR)/vm.o
diff --git a/lib/x86/idt.c b/lib/x86/idt.c
index ed2f4b0..b3e47d4 100644
--- a/lib/x86/idt.c
+++ b/lib/x86/idt.c
@@ -1,5 +1,6 @@
 #include "idt.h"
 #include "libcflat.h"
+#include "processor.h"
 
 typedef struct {
     unsigned short offset0;
@@ -19,30 +20,19 @@ typedef struct {
 
 static idt_entry_t idt[256];
 
-typedef struct {
-    unsigned short limit;
-    unsigned long linear_addr;
-} __attribute__((packed)) descriptor_table_t;
-
-void lidt(idt_entry_t *idt, int nentries)
+void load_lidt(idt_entry_t *idt, int nentries)
 {
-    descriptor_table_t dt;
+    struct descriptor_table_ptr dt;
 
     dt.limit = nentries * sizeof(*idt) - 1;
-    dt.linear_addr = (unsigned long)idt;
+    dt.base = (unsigned long)idt;
+    lidt(&dt);
     asm volatile ("lidt %0" : : "m"(dt));
 }
 
-unsigned short read_cs()
-{
-    unsigned short r;
-
-    asm volatile ("mov %%cs, %0" : "=r"(r));
-    return r;
-}
-
-void set_idt_entry(idt_entry_t *e, void *addr, int dpl)
+void set_idt_entry(int vec, void *addr, int dpl)
 {
+    idt_entry_t *e = &idt[vec];
     memset(e, 0, sizeof *e);
     e->offset0 = (unsigned long)addr;
     e->selector = read_cs();
@@ -146,10 +136,10 @@ void setup_idt(void)
 {
     extern char ud_fault, gp_fault, de_fault;
 
-    lidt(idt, 256);
-    set_idt_entry(&idt[0], &de_fault, 0);
-    set_idt_entry(&idt[6], &ud_fault, 0);
-    set_idt_entry(&idt[13], &gp_fault, 0);
+    load_lidt(idt, 256);
+    set_idt_entry(0, &de_fault, 0);
+    set_idt_entry(6, &ud_fault, 0);
+    set_idt_entry(13, &gp_fault, 0);
 }
 
 unsigned exception_vector(void)
diff --git a/lib/x86/idt.h b/lib/x86/idt.h
index 6babcb4..81b8944 100644
--- a/lib/x86/idt.h
+++ b/lib/x86/idt.h
@@ -15,5 +15,6 @@ void setup_idt(void);
 
 unsigned exception_vector(void);
 unsigned exception_error_code(void);
+void set_idt_entry(int vec, void *addr, int dpl);
 
 #endif
diff --git a/x86/idt.c b/x86/idt.c
deleted file mode 100644
index 4480833..0000000
--- a/x86/idt.c
+++ /dev/null
@@ -1,148 +0,0 @@
-#include "idt.h"
-#include "libcflat.h"
-
-typedef struct {
-    unsigned short offset0;
-    unsigned short selector;
-    unsigned short ist : 3;
-    unsigned short : 5;
-    unsigned short type : 4;
-    unsigned short : 1;
-    unsigned short dpl : 2;
-    unsigned short p : 1;
-    unsigned short offset1;
-    unsigned offset2;
-    unsigned reserved;
-} idt_entry_t;
-
-static idt_entry_t idt[256];
-
-typedef struct {
-    unsigned short limit;
-    unsigned long linear_addr;
-} __attribute__((packed)) descriptor_table_t;
-
-void lidt(idt_entry_t *idt, int nentries)
-{
-    descriptor_table_t dt;
-
-    dt.limit = nentries * sizeof(*idt) - 1;
-    dt.linear_addr = (unsigned long)idt;
-    asm volatile ("lidt %0" : : "m"(dt));
-}
-
-unsigned short read_cs()
-{
-    unsigned short r;
-
-    asm volatile ("mov %%cs, %0" : "=r"(r));
-    return r;
-}
-
-void set_idt_entry(idt_entry_t *e, void *addr, int dpl)
-{
-    memset(e, 0, sizeof *e);
-    e->offset0 = (unsigned long)addr;
-    e->selector = read_cs();
-    e->ist = 0;
-    e->type = 14;
-    e->dpl = dpl;
-    e->p = 1;
-    e->offset1 = (unsigned long)addr >> 16;
-    e->offset2 = (unsigned long)addr >> 32;
-}
-
-struct ex_regs {
-    unsigned long rax, rcx, rdx, rbx;
-    unsigned long dummy, rbp, rsi, rdi;
-    unsigned long r8, r9, r10, r11;
-    unsigned long r12, r13, r14, r15;
-    unsigned long vector;
-    unsigned long error_code;
-    unsigned long rip;
-    unsigned long cs;
-    unsigned long rflags;
-};
-
-struct ex_record {
-    unsigned long rip;
-    unsigned long handler;
-};
-
-extern struct ex_record exception_table_start, exception_table_end;
-
-void do_handle_exception(struct ex_regs *regs)
-{
-    struct ex_record *ex;
-    unsigned ex_val;
-
-    ex_val = regs->vector | (regs->error_code << 16);
-
-    asm("mov %0, %%gs:4" : : "r"(ex_val));
-
-    for (ex = &exception_table_start; ex != &exception_table_end; ++ex) {
-        if (ex->rip == regs->rip) {
-            regs->rip = ex->handler;
-            return;
-        }
-    }
-    printf("unhandled excecption\n");
-    exit(7);
-}
-
-asm (".pushsection .text \n\t"
-     "ud_fault: \n\t"
-     "pushq $0 \n\t"
-     "pushq $6 \n\t"
-     "jmp handle_exception \n\t"
-
-     "gp_fault: \n\t"
-     "pushq $13 \n\t"
-     "jmp handle_exception \n\t"
-
-     "de_fault: \n\t"
-     "pushq $0 \n\t"
-     "pushq $0 \n\t"
-     "jmp handle_exception \n\t"
-
-     "handle_exception: \n\t"
-     "push %r15; push %r14; push %r13; push %r12 \n\t"
-     "push %r11; push %r10; push %r9; push %r8 \n\t"
-     "push %rdi; push %rsi; push %rbp; sub $8, %rsp \n\t"
-     "push %rbx; push %rdx; push %rcx; push %rax \n\t"
-     "mov %rsp, %rdi \n\t"
-     "call do_handle_exception \n\t"
-     "pop %rax; pop %rcx; pop %rdx; pop %rbx \n\t"
-     "add $8, %rsp; pop %rbp; pop %rsi; pop %rdi \n\t"
-     "pop %r8; pop %r9; pop %r10; pop %r11 \n\t"
-     "pop %r12; pop %r13; pop %r14; pop %r15 \n\t"
-     "add $16, %rsp \n\t"
-     "iretq \n\t"
-     ".popsection");
-
-
-void setup_idt(void)
-{
-    extern char ud_fault, gp_fault, de_fault;
-
-    lidt(idt, 256);
-    set_idt_entry(&idt[0], &de_fault, 0);
-    set_idt_entry(&idt[6], &ud_fault, 0);
-    set_idt_entry(&idt[13], &gp_fault, 0);
-}
-
-unsigned exception_vector(void)
-{
-    unsigned short vector;
-
-    asm("mov %%gs:4, %0" : "=rm"(vector));
-    return vector;
-}
-
-unsigned exception_error_code(void)
-{
-    unsigned short error_code;
-
-    asm("mov %%gs:6, %0" : "=rm"(error_code));
-    return error_code;
-}
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH unit-tests 2/4] Make access.c use library functions.
  2010-12-14 15:48 [PATCH unit-tests 1/4] Move idt.c into lib code Gleb Natapov
@ 2010-12-14 15:48 ` Gleb Natapov
  2010-12-14 15:48 ` [PATCH unit-tests 3/4] Remove duplicated idt code from apic test Gleb Natapov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2010-12-14 15:48 UTC (permalink / raw)
  To: kvm; +Cc: avi

access.c has functions that are provided by library code. Remove them
and use library functions instead.
---
 x86/access.c |   92 +++------------------------------------------------------
 1 files changed, 5 insertions(+), 87 deletions(-)

diff --git a/x86/access.c b/x86/access.c
index 067565b..df943d9 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -1,5 +1,7 @@
 
 #include "libcflat.h"
+#include "idt.h"
+#include "processor.h"
 
 #define smp_id() 0
 
@@ -98,34 +100,6 @@ static inline void *va(pt_element_t phys)
     return (void *)phys;
 }
 
-static unsigned long read_cr0()
-{
-    unsigned long cr0;
-
-    asm volatile ("mov %%cr0, %0" : "=r"(cr0));
-
-    return cr0;
-}
-
-static void write_cr0(unsigned long cr0)
-{
-    asm volatile ("mov %0, %%cr0" : : "r"(cr0));
-}
-
-typedef struct {
-    unsigned short offset0;
-    unsigned short selector;
-    unsigned short ist : 3;
-    unsigned short : 5;
-    unsigned short type : 4;
-    unsigned short : 1;
-    unsigned short dpl : 2;
-    unsigned short p : 1;
-    unsigned short offset1;
-    unsigned offset2;
-    unsigned reserved;
-} idt_entry_t;
-
 typedef struct {
     pt_element_t pt_pool;
     unsigned pt_pool_size;
@@ -143,7 +117,6 @@ typedef struct {
     pt_element_t ignore_pde;
     int expected_fault;
     unsigned expected_error;
-    idt_entry_t idt[256];
 } ac_test_t;
 
 typedef struct {
@@ -154,51 +127,6 @@ typedef struct {
 
 static void ac_test_show(ac_test_t *at);
 
-void lidt(idt_entry_t *idt, int nentries)
-{
-    descriptor_table_t dt;
-
-    dt.limit = nentries * sizeof(*idt) - 1;
-    dt.linear_addr = (unsigned long)idt;
-    asm volatile ("lidt %0" : : "m"(dt));
-}
-
-unsigned short read_cs()
-{
-    unsigned short r;
-
-    asm volatile ("mov %%cs, %0" : "=r"(r));
-    return r;
-}
-
-unsigned long long rdmsr(unsigned index)
-{
-    unsigned a, d;
-
-    asm volatile("rdmsr" : "=a"(a), "=d"(d) : "c"(index));
-    return ((unsigned long long)d << 32) | a;
-}
-
-void wrmsr(unsigned index, unsigned long long val)
-{
-    unsigned a = val, d = val >> 32;
-
-    asm volatile("wrmsr" : : "a"(a), "d"(d), "c"(index));
-}
-
-void set_idt_entry(idt_entry_t *e, void *addr, int dpl)
-{
-    memset(e, 0, sizeof *e);
-    e->offset0 = (unsigned long)addr;
-    e->selector = read_cs();
-    e->ist = 0;
-    e->type = 14;
-    e->dpl = dpl;
-    e->p = 1;
-    e->offset1 = (unsigned long)addr >> 16;
-    e->offset2 = (unsigned long)addr >> 32;
-}
-
 void set_cr0_wp(int wp)
 {
     unsigned long cr0 = read_cr0();
@@ -222,13 +150,11 @@ void set_efer_nx(int nx)
 
 static void ac_env_int(ac_pool_t *pool)
 {
-    static idt_entry_t idt[256];
+    setup_idt();
 
-    memset(idt, 0, sizeof(idt));
-    lidt(idt, 256);
     extern char page_fault, kernel_entry;
-    set_idt_entry(&idt[14], &page_fault, 0);
-    set_idt_entry(&idt[0x20], &kernel_entry, 3);
+    set_idt_entry(14, &page_fault, 0);
+    set_idt_entry(0x20, &kernel_entry, 3);
 
     pool->pt_pool = 33 * 1024 * 1024;
     pool->pt_pool_size = 120 * 1024 * 1024 - pool->pt_pool;
@@ -273,14 +199,6 @@ int ac_test_bump(ac_test_t *at)
     return ret;
 }
 
-unsigned long read_cr3()
-{
-    unsigned long cr3;
-
-    asm volatile ("mov %%cr3, %0" : "=r"(cr3));
-    return cr3;
-}
-
 void invlpg(void *addr)
 {
     asm volatile ("invlpg (%0)" : : "r"(addr));
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH unit-tests 3/4] Remove duplicated idt code from apic test.
  2010-12-14 15:48 [PATCH unit-tests 1/4] Move idt.c into lib code Gleb Natapov
  2010-12-14 15:48 ` [PATCH unit-tests 2/4] Make access.c use library functions Gleb Natapov
@ 2010-12-14 15:48 ` Gleb Natapov
  2010-12-14 15:48 ` [PATCH unit-tests 4/4] Remove unused function " Gleb Natapov
  2010-12-21 16:15 ` [PATCH unit-tests 1/4] Move idt.c into lib code Marcelo Tosatti
  3 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2010-12-14 15:48 UTC (permalink / raw)
  To: kvm; +Cc: avi

Use library idt code instead.
---
 x86/apic.c |   49 +++++++++++--------------------------------------
 1 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/x86/apic.c b/x86/apic.c
index 2207040..6d06f9f 100644
--- a/x86/apic.c
+++ b/x86/apic.c
@@ -2,22 +2,7 @@
 #include "apic.h"
 #include "vm.h"
 #include "smp.h"
-
-typedef struct {
-    unsigned short offset0;
-    unsigned short selector;
-    unsigned short ist : 3;
-    unsigned short : 5;
-    unsigned short type : 4;
-    unsigned short : 1;
-    unsigned short dpl : 2;
-    unsigned short p : 1;
-    unsigned short offset1;
-#ifdef __x86_64__
-    unsigned offset2;
-    unsigned reserved;
-#endif
-} idt_entry_t;
+#include "idt.h"
 
 typedef struct {
     ulong regs[sizeof(ulong)*2];
@@ -90,8 +75,6 @@ asm (
 #endif
     );
 
-static idt_entry_t *idt = 0;
-
 static int g_fail;
 static int g_tests;
 
@@ -128,22 +111,12 @@ void test_enable_x2apic(void)
     }
 }
 
-static void set_idt_entry(unsigned vec, void (*func)(isr_regs_t *regs))
+static void handle_irq(unsigned vec, void (*func)(isr_regs_t *regs))
 {
     u8 *thunk = vmalloc(50);
-    ulong ptr = (ulong)thunk;
-    idt_entry_t ent = {
-        .offset0 = ptr,
-        .selector = read_cs(),
-        .ist = 0,
-        .type = 14,
-        .dpl = 0,
-        .p = 1,
-        .offset1 = ptr >> 16,
-#ifdef __x86_64__
-        .offset2 = ptr >> 32,
-#endif
-    };
+
+    set_idt_entry(vec, thunk, 0);
+
 #ifdef __x86_64__
     /* sub $8, %rsp */
     *thunk++ = 0x48; *thunk++ = 0x83; *thunk++ = 0xec; *thunk++ = 0x08;
@@ -164,7 +137,6 @@ static void set_idt_entry(unsigned vec, void (*func)(isr_regs_t *regs))
     *thunk ++ = 0xe9;
     *(u32 *)thunk = (ulong)isr_entry_point - (ulong)(thunk + 4);
 #endif
-    idt[vec] = ent;
 }
 
 static void irq_disable(void)
@@ -194,7 +166,7 @@ static void test_self_ipi(void)
 {
     int vec = 0xf1;
 
-    set_idt_entry(vec, self_ipi_isr);
+    handle_irq(vec, self_ipi_isr);
     irq_enable();
     apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | APIC_DM_FIXED | vec,
                    0);
@@ -234,7 +206,7 @@ static void ioapic_isr_77(isr_regs_t *regs)
 
 static void test_ioapic_intr(void)
 {
-    set_idt_entry(0x77, ioapic_isr_77);
+    handle_irq(0x77, ioapic_isr_77);
     set_ioapic_redir(0x10, 0x77);
     toggle_irq_line(0x10);
     asm volatile ("nop");
@@ -262,8 +234,8 @@ static void ioapic_isr_66(isr_regs_t *regs)
 
 static void test_ioapic_simultaneous(void)
 {
-    set_idt_entry(0x78, ioapic_isr_78);
-    set_idt_entry(0x66, ioapic_isr_66);
+    handle_irq(0x78, ioapic_isr_78);
+    handle_irq(0x66, ioapic_isr_66);
     set_ioapic_redir(0x10, 0x78);
     set_ioapic_redir(0x11, 0x66);
     irq_disable();
@@ -323,7 +295,7 @@ static void test_sti_nmi(void)
 	return;
     }
 
-    set_idt_entry(2, nmi_handler);
+    handle_irq(2, nmi_handler);
     on_cpu(1, update_cr3, (void *)read_cr3());
 
     sti_loop_active = 1;
@@ -343,6 +315,7 @@ int main()
 {
     setup_vm();
     smp_init();
+    setup_idt();
 
     test_lapic_existence();
 
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH unit-tests 4/4] Remove unused function from apic test.
  2010-12-14 15:48 [PATCH unit-tests 1/4] Move idt.c into lib code Gleb Natapov
  2010-12-14 15:48 ` [PATCH unit-tests 2/4] Make access.c use library functions Gleb Natapov
  2010-12-14 15:48 ` [PATCH unit-tests 3/4] Remove duplicated idt code from apic test Gleb Natapov
@ 2010-12-14 15:48 ` Gleb Natapov
  2010-12-21 16:15 ` [PATCH unit-tests 1/4] Move idt.c into lib code Marcelo Tosatti
  3 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2010-12-14 15:48 UTC (permalink / raw)
  To: kvm; +Cc: avi

---
 x86/apic.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/x86/apic.c b/x86/apic.c
index 6d06f9f..bcb9fc1 100644
--- a/x86/apic.c
+++ b/x86/apic.c
@@ -78,11 +78,6 @@ asm (
 static int g_fail;
 static int g_tests;
 
-static void outb(unsigned char data, unsigned short port)
-{
-    asm volatile ("out %0, %1" : : "a"(data), "d"(port));
-}
-
 static void report(const char *msg, int pass)
 {
     ++g_tests;
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH unit-tests 1/4] Move idt.c into lib code.
  2010-12-14 15:48 [PATCH unit-tests 1/4] Move idt.c into lib code Gleb Natapov
                   ` (2 preceding siblings ...)
  2010-12-14 15:48 ` [PATCH unit-tests 4/4] Remove unused function " Gleb Natapov
@ 2010-12-21 16:15 ` Marcelo Tosatti
  2010-12-21 16:38   ` Gleb Natapov
  3 siblings, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2010-12-21 16:15 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: kvm, avi

On Tue, Dec 14, 2010 at 05:48:46PM +0200, Gleb Natapov wrote:
> diff --git a/lib/x86/idt.c b/lib/x86/idt.c
> index ed2f4b0..b3e47d4 100644
> --- a/lib/x86/idt.c
> +++ b/lib/x86/idt.c

There's no such file on current kvm-unit-test repo. What did you
generate against?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH unit-tests 1/4] Move idt.c into lib code.
  2010-12-21 16:15 ` [PATCH unit-tests 1/4] Move idt.c into lib code Marcelo Tosatti
@ 2010-12-21 16:38   ` Gleb Natapov
  0 siblings, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2010-12-21 16:38 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm, avi

On Tue, Dec 21, 2010 at 02:15:05PM -0200, Marcelo Tosatti wrote:
> On Tue, Dec 14, 2010 at 05:48:46PM +0200, Gleb Natapov wrote:
> > diff --git a/lib/x86/idt.c b/lib/x86/idt.c
> > index ed2f4b0..b3e47d4 100644
> > --- a/lib/x86/idt.c
> > +++ b/lib/x86/idt.c
> 
> There's no such file on current kvm-unit-test repo. What did you
> generate against?
The patch should have moved it from x86/ to lib/x86 but something went
wrong with my commit. Will check.

--
			Gleb.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-21 16:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-14 15:48 [PATCH unit-tests 1/4] Move idt.c into lib code Gleb Natapov
2010-12-14 15:48 ` [PATCH unit-tests 2/4] Make access.c use library functions Gleb Natapov
2010-12-14 15:48 ` [PATCH unit-tests 3/4] Remove duplicated idt code from apic test Gleb Natapov
2010-12-14 15:48 ` [PATCH unit-tests 4/4] Remove unused function " Gleb Natapov
2010-12-21 16:15 ` [PATCH unit-tests 1/4] Move idt.c into lib code Marcelo Tosatti
2010-12-21 16:38   ` Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox