[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Added #ifdef CONFIG_XEN_SHADOW_MODE to protect all of Christian's new code.



ChangeSet 1.1236.32.15, 2005/03/21 13:23:44+00:00, mafetter@xxxxxxxxxxxxxxxx

        Added #ifdef CONFIG_XEN_SHADOW_MODE to protect all of Christian's new 
code.
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 linux-2.6.10-xen-sparse/arch/xen/Kconfig                          |    9 
 linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig           |    1 
 linux-2.6.10-xen-sparse/arch/xen/i386/kernel/cpu/common.c         |    4 
 linux-2.6.10-xen-sparse/arch/xen/i386/kernel/ldt.c                |   20 -
 linux-2.6.10-xen-sparse/arch/xen/i386/kernel/pci-dma.c            |    5 
 linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c            |    8 
 linux-2.6.10-xen-sparse/arch/xen/i386/kernel/setup.c              |   34 ++
 linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c                  |   13 +
 linux-2.6.10-xen-sparse/arch/xen/i386/mm/hypervisor.c             |  128 
++++++++++
 linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c                   |   27 +-
 linux-2.6.10-xen-sparse/arch/xen/i386/mm/ioremap.c                |   27 +-
 linux-2.6.10-xen-sparse/arch/xen/i386/mm/pageattr.c               |   11 
 linux-2.6.10-xen-sparse/arch/xen/i386/mm/pgtable.c                |   56 ++++
 linux-2.6.10-xen-sparse/arch/xen/kernel/reboot.c                  |   21 +
 linux-2.6.10-xen-sparse/drivers/xen/balloon/balloon.c             |   13 +
 linux-2.6.10-xen-sparse/drivers/xen/blkback/blkback.c             |    4 
 linux-2.6.10-xen-sparse/drivers/xen/blkfront/blkfront.c           |   16 +
 linux-2.6.10-xen-sparse/drivers/xen/blkfront/vbd.c                |    4 
 linux-2.6.10-xen-sparse/drivers/xen/netback/netback.c             |   12 
 linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c           |   25 +
 linux-2.6.10-xen-sparse/drivers/xen/privcmd/privcmd.c             |    4 
 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/desc.h           |    4 
 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/fixmap.h         |   11 
 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/io.h             |   28 ++
 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/page.h           |   49 +++
 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgalloc.h        |    7 
 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h |   22 +
 linux-2.6.10-xen-sparse/include/asm-xen/asm-i386/pgtable.h        |   20 +
 xen/include/public/arch-x86_32.h                                  |    6 
 29 files changed, 566 insertions(+), 23 deletions(-)


diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/Kconfig 
b/linux-2.6.10-xen-sparse/arch/xen/Kconfig
--- a/linux-2.6.10-xen-sparse/arch/xen/Kconfig  2005-04-05 12:14:20 -04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/Kconfig  2005-04-05 12:14:20 -04:00
@@ -115,8 +115,15 @@
          space.  Odds are that you want to say N here.
 
 config XEN_WRITABLE_PAGETABLES
-       bool
+       bool "writable page tables"
        default y
+
+config XEN_SHADOW_MODE
+       bool "Fake shadow mode"
+       default n
+    help
+      fakes out a shadow mode kernel
+
 
 config XEN_SCRUB_PAGES
        bool "Scrub memory before freeing it to Xen"
diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig 
b/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig
--- a/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig   2005-04-05 
12:14:20 -04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig   2005-04-05 
12:14:20 -04:00
@@ -20,6 +20,7 @@
 # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
 # CONFIG_XEN_BLKDEV_TAP is not set
 CONFIG_XEN_WRITABLE_PAGETABLES=y
+CONFIG_XEN_SHADOW_MODE=y
 CONFIG_XEN_SCRUB_PAGES=y
 CONFIG_X86=y
 # CONFIG_X86_64 is not set
diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/cpu/common.c 
b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/cpu/common.c
--- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/cpu/common.c 2005-04-05 
12:14:20 -04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/cpu/common.c 2005-04-05 
12:14:20 -04:00
@@ -512,7 +512,11 @@
        for (va = gdt_descr->address, f = 0;
             va < gdt_descr->address + gdt_descr->size;
             va += PAGE_SIZE, f++) {
+#ifndef CONFIG_XEN_SHADOW_MODE
+               frames[f] = virt_to_machine(va) >> PAGE_SHIFT;
+#else /* CONFIG_XEN_SHADOW_MODE */
                frames[f] = __vms_virt_to_machine(va) >> PAGE_SHIFT;
+#endif /* CONFIG_XEN_SHADOW_MODE */
                make_page_readonly((void *)va);
        }
        flush_page_update_queue();
diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/ldt.c 
b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/ldt.c
--- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/ldt.c        2005-04-05 
12:14:21 -04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/ldt.c        2005-04-05 
12:14:21 -04:00
@@ -61,10 +61,10 @@
                cpumask_t mask;
                preempt_disable();
 #endif
-#if 0
+#ifndef CONFIG_XEN_SHADOW_MODE
                make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
                                    PAGE_SIZE);
-#endif
+#endif /* CONFIG_XEN_SHADOW_MODE */
                load_LDT(pc);
                flush_page_update_queue();
 #ifdef CONFIG_SMP
@@ -75,10 +75,10 @@
 #endif
        }
        if (oldsize) {
-#if 0
+#ifndef CONFIG_XEN_SHADOW_MODE
                make_pages_writable(oldldt, (oldsize * LDT_ENTRY_SIZE) /
                        PAGE_SIZE);
-#endif
+#endif /* ! CONFIG_XEN_SHADOW_MODE */
                flush_page_update_queue();
                if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
                        vfree(oldldt);
@@ -94,10 +94,10 @@
        if (err < 0)
                return err;
        memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
-#if 0
+#ifndef CONFIG_XEN_SHADOW_MODE
        make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) /
                            PAGE_SIZE);
-#endif
+#endif /* ! CONFIG_XEN_SHADOW_MODE */
        flush_page_update_queue();
        return 0;
 }
@@ -130,11 +130,11 @@
        if (mm->context.size) {
                if (mm == current->active_mm)
                        clear_LDT();
-#if 0
+#ifndef CONFIG_XEN_SHADOW_MODE
                make_pages_writable(mm->context.ldt, 
                                    (mm->context.size * LDT_ENTRY_SIZE) /
                                    PAGE_SIZE);
-#endif
+#endif /* ! CONFIG_XEN_SHADOW_MODE */
                flush_page_update_queue();
                if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
                        vfree(mm->context.ldt);
@@ -230,7 +230,11 @@
        }
 
        lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) 
mm->context.ldt);
+#ifndef CONFIG_XEN_SHADOW_MODE
+       mach_lp = arbitrary_virt_to_machine(lp);
+#else /* CONFIG_XEN_SHADOW_MODE */
        mach_lp = arbitrary_virt_to_phys(lp);
+#endif /* CONFIG_XEN_SHADOW_MODE */
 
        /* Allow LDTs to be cleared by the user. */
        if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/pci-dma.c 
b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/pci-dma.c
--- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/pci-dma.c    2005-04-05 
12:14:21 -04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/pci-dma.c    2005-04-05 
12:14:21 -04:00
@@ -30,8 +30,7 @@
 static void
 xen_contig_memory(unsigned long vstart, unsigned int order)
 {
-#define HACK
-#ifndef HACK
+#ifndef CONFIG_XEN_SHADOW_MODE
        /*
         * Ensure multi-page extents are contiguous in machine memory.
         * This code could be cleaned up some, and the number of
@@ -78,7 +77,7 @@
        xen_tlb_flush();
 
         balloon_unlock(flags);
-#endif
+#endif /* CONFIG_XEN_SHADOW_MODE */
 }
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c 
b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c
--- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c    2005-04-05 
12:14:20 -04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/process.c    2005-04-05 
12:14:20 -04:00
@@ -514,17 +514,23 @@
         * Load the per-thread Thread-Local Storage descriptor.
         * This is load_TLS(next, cpu) with multicalls.
         */
+#ifndef CONFIG_XEN_SHADOW_MODE
+#define C_VIRT_TO_MACH virt_to_machine
+#else /* CONFIG_XEN_SHADOW_MODE */
+#define C_VIRT_TO_MACH virt_to_phys
+#endif
 #define C(i) do {                                                          \
        if (unlikely(next->tls_array[i].a != prev->tls_array[i].a ||        \
                     next->tls_array[i].b != prev->tls_array[i].b))         \
                queue_multicall3(__HYPERVISOR_update_descriptor,            \
-                                virt_to_phys(&get_cpu_gdt_table(cpu)       \
+                                C_VIRT_TO_MACH(&get_cpu_gdt_table(cpu)     \
                                                 [GDT_ENTRY_TLS_MIN + i]),  \
                                 ((u32 *)&next->tls_array[i])[0],           \
                                 ((u32 *)&next->tls_array[i])[1]);          \
 } while (0)
        C(0); C(1); C(2);
 #undef C
+#undef C_VIRT_TO_MACH
 
        if (xen_start_info.flags & SIF_PRIVILEGED) {
                op.cmd           = DOM0_IOPL;
diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/setup.c 
b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/setup.c
--- a/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/setup.c      2005-04-05 
12:14:21 -04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/i386/kernel/setup.c      2005-04-05 
12:14:21 -04:00
@@ -345,8 +345,13 @@
 shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
 EXPORT_SYMBOL(HYPERVISOR_shared_info);
 
+#ifndef CONFIG_XEN_SHADOW_MODE
+unsigned int *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
+EXPORT_SYMBOL(phys_to_machine_mapping);
+#else /* CONFIG_XEN_SHADOW_MODE */
 unsigned int *__vms_phys_to_machine_mapping, *__vms_pfn_to_mfn_frame_list;
 EXPORT_SYMBOL(__vms_phys_to_machine_mapping);
+#endif /* CONFIG_XEN_SHADOW_MODE */
 
 DEFINE_PER_CPU(multicall_entry_t, multicall_list[8]);
 DEFINE_PER_CPU(int, nr_multicall_ents);
@@ -1142,7 +1147,11 @@
        }
 #endif
 
+#ifndef CONFIG_XEN_SHADOW_MODE
+       phys_to_machine_mapping = (unsigned int *)xen_start_info.mfn_list;
+#else /* CONFIG_XEN_SHADOW_MODE */
        __vms_phys_to_machine_mapping = (unsigned int *)xen_start_info.mfn_list;
+#endif /* CONFIG_XEN_SHADOW_MODE */
 
        return max_low_pfn;
 }
@@ -1437,11 +1446,23 @@
 
        /* Make sure we have a large enough P->M table. */
        if (max_pfn > xen_start_info.nr_pages) {
+#ifndef CONFIG_XEN_SHADOW_MODE
+               phys_to_machine_mapping = alloc_bootmem_low_pages(
+#else /* CONFIG_XEN_SHADOW_MODE */
                __vms_phys_to_machine_mapping = alloc_bootmem_low_pages(
+#endif /* CONFIG_XEN_SHADOW_MODE */
                        max_pfn * sizeof(unsigned long));
+#ifndef CONFIG_XEN_SHADOW_MODE
+               memset(phys_to_machine_mapping, ~0,
+#else /* CONFIG_XEN_SHADOW_MODE */
                memset(__vms_phys_to_machine_mapping, ~0,
+#endif /* CONFIG_XEN_SHADOW_MODE */
                        max_pfn * sizeof(unsigned long));
+#ifndef CONFIG_XEN_SHADOW_MODE
+               memcpy(phys_to_machine_mapping,
+#else /* CONFIG_XEN_SHADOW_MODE */
                memcpy(__vms_phys_to_machine_mapping,
+#endif /* CONFIG_XEN_SHADOW_MODE */
                        (unsigned long *)xen_start_info.mfn_list,
                        xen_start_info.nr_pages * sizeof(unsigned long));
                free_bootmem(
@@ -1450,14 +1471,27 @@
                        sizeof(unsigned long))));
        }
 
+#ifndef CONFIG_XEN_SHADOW_MODE
+       pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE);
+#else /* CONFIG_XEN_SHADOW_MODE */
        __vms_pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE);
+#endif /* CONFIG_XEN_SHADOW_MODE */
        for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
        {       
+#ifndef CONFIG_XEN_SHADOW_MODE
+            pfn_to_mfn_frame_list[j] = 
+                 virt_to_machine(&phys_to_machine_mapping[i]) >> PAGE_SHIFT;
+#else /* CONFIG_XEN_SHADOW_MODE */
             __vms_pfn_to_mfn_frame_list[j] = 
                  __vms_virt_to_machine(&__vms_phys_to_machine_mapping[i]) >> 
PAGE_SHIFT;
+#endif /* CONFIG_XEN_SHADOW_MODE */
        }
        HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list =
+#ifndef CONFIG_XEN_SHADOW_MODE
+            virt_to_machine(pfn_to_mfn_frame_list) >> PAGE_SHIFT;
+#else /* CONFIG_XEN_SHADOW_MODE */
             __vms_virt_to_machine(__vms_pfn_to_mfn_frame_list) >> PAGE_SHIFT;
+#endif /* CONFIG_XEN_SHADOW_MODE */
 
 
        /*
diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c 
b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c
--- a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c  2005-04-05 12:14:20 
-04:00
+++ b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/fault.c  2005-04-05 12:14:20 
-04:00
@@ -458,8 +458,13 @@
        printk("%08lx\n", regs->eip);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.