Skip to contentSkip to conversation

pae shadow preparation

PATCH New Gerd Knorr 1 participant 1 message Jul 28, 2005 x86

lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

PATCH 1/1 pae shadow preparation

Hi,

Really just basic preparation: switch over PAE builds to the new shadow code, drop old dummy functions, add (fewer) new ones.

Gerd

include/asm-x86/shadow_public.h +7 -5
Index: xen/include/asm-x86/shadow_public.h
===================================================================
@@ -21,7 +21,7 @@
 
 #ifndef _XEN_SHADOW_PUBLIC_H
 #define _XEN_SHADOW_PUBLIC_H
-#if CONFIG_PAGING_LEVELS >= 4
+#if CONFIG_PAGING_LEVELS >= 3
 #define MFN_PINNED(_x) (frame_table[_x].u.inuse.type_info & PGT_pinned)
 
 extern int alloc_p2m_table(struct domain *d);
@@ -31,10 +31,6 @@ extern void shadow_sync_and_drop_referen
 extern void shadow_drop_references(
       struct domain *d, struct pfn_info *page);
 
-extern void shadow_l4_normal_pt_update(struct domain *d,
-                                       unsigned long pa, l4_pgentry_t l4e,
-                                       struct domain_mmap_cache *cache);
-
 extern int shadow_set_guest_paging_levels(struct domain *d, int levels);
 
 extern void release_out_of_sync_entry(
@@ -56,4 +52,10 @@ struct shadow_ops {
 };
 #endif
 
+#if CONFIG_PAGING_LEVELS >= 4
+extern void shadow_l4_normal_pt_update(struct domain *d,
+                                       unsigned long pa, l4_pgentry_t l4e,
+                                       struct domain_mmap_cache *cache);
+#endif
+
 #endif
include/asm-x86/shadow_64.h +2 -0
Index: xen/include/asm-x86/shadow_64.h
===================================================================
@@ -85,8 +85,10 @@ static inline int  table_offset_64(unsig
             return  (((va) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1));
         case 3:
             return  (((va) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1));
+#if CONFIG_PAGING_LEVELS >= 4
         case 4:
             return  (((va) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1));
+#endif
         default:
             //printk("<table_offset_64> level %d is too big\n", level);
             return -1;
include/asm-x86/shadow.h +1 -77

95 lines not on this page · raw message

arch/x86/vmx_platform.c +1 -1
Index: xen/arch/x86/vmx_platform.c
===================================================================
@@ -32,7 +32,7 @@
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <asm/current.h>
-#if CONFIG_PAGING_LEVELS >= 4
+#if CONFIG_PAGING_LEVELS >= 3
 #include <asm/shadow_64.h>
 #endif
 #ifdef CONFIG_VMX
arch/x86/Makefile +12 -5
Index: xen/arch/x86/Makefile
===================================================================
@@ -13,11 +13,18 @@ OBJS := $(subst cpu/centaur.o,,$(OBJS))
 OBJS := $(subst cpu/cyrix.o,,$(OBJS))
 OBJS := $(subst cpu/rise.o,,$(OBJS))
 OBJS := $(subst cpu/transmeta.o,,$(OBJS))
-OBJS := $(subst shadow32.o,,$(OBJS))
-else
-OBJS := $(subst shadow.o,,$(OBJS))
-OBJS := $(subst shadow_public.o,,$(OBJS))
-OBJS := $(subst shadow_xxx.o,,$(OBJS))
+endif
+
+OBJS := $(patsubst shadow%.o,,$(OBJS))	# drop all
+ifeq ($(TARGET_SUBARCH),x86_64) 
+ OBJS += shadow.o shadow_public.o	# x86_64: new code
+endif
+ifeq ($(TARGET_SUBARCH),x86_32) 
+ ifneq ($(pae),n)
+  OBJS += shadow.o shadow_public.o	# x86_32p: new code
+ else
+  OBJS += shadow32.o			# x86_32: old code
+ endif
 endif
 
 OBJS := $(subst $(TARGET_SUBARCH)/asm-offsets.o,,$(OBJS))
arch/x86/shadow.c +14 -3
Index: xen/arch/x86/shadow.c
===================================================================
@@ -41,7 +41,13 @@ extern void free_shadow_pages(struct dom
 static void mark_shadows_as_reflecting_snapshot(struct domain *d, unsigned long gpfn);
 #endif
 
-#if CONFIG_PAGING_LEVELS >= 4
+#if CONFIG_PAGING_LEVELS == 3
+#include <asm/shadow_64.h>
+static unsigned long shadow_l3_table(
+    struct domain *d, unsigned long gpfn, unsigned long gmfn);
+#endif
+
+#if CONFIG_PAGING_LEVELS == 4
 #include <asm/shadow_64.h>
 static unsigned long shadow_l4_table(
     struct domain *d, unsigned long gpfn, unsigned long gmfn);
@@ -1833,7 +1839,7 @@ static void shadow_update_pagetables(str
     unsigned long gpfn = __mfn_to_gpfn(d, gmfn);
     unsigned long smfn, old_smfn;
 
-#if defined (__i386__)
+#if CONFIG_PAGING_LEVELS == 2
     unsigned long hl2mfn;
 #endif
   
@@ -1890,7 +1896,7 @@ static void shadow_update_pagetables(str
         v->arch.shadow_vtable = map_domain_page(smfn);
     }
 
-#if defined (__i386__)
+#if CONFIG_PAGING_LEVELS == 2
     /*
      * arch.hl2_vtable
      */
@@ -1936,6 +1942,10 @@ static void shadow_update_pagetables(str
         local_flush_tlb();
     }
 #endif
+
+#if CONFIG_PAGING_LEVELS == 3
+    /* FIXME: PAE code to be written */
+#endif
 }
 
 struct shadow_ops MODE_A_HANDLER = {
@@ -2427,6 +2437,7 @@ static unsigned long shadow_l3_table(
   struct domain *d, unsigned long gpfn, unsigned long gmfn)
 {
     BUG();                      /* not implemenated yet */
+    return 42;
 }
 #endif
 
arch/x86/vmx.c +1 -1
Index: xen/arch/x86/vmx.c
===================================================================
@@ -38,7 +38,7 @@
 #include <asm/vmx_vmcs.h>
 #include <asm/vmx_intercept.h>
 #include <asm/shadow.h>
-#if CONFIG_PAGING_LEVELS >= 4
+#if CONFIG_PAGING_LEVELS >= 3
 #include <asm/shadow_64.h>
 #endif