Skip to contentSkip to conversation

libxc and domain.c changes backported from xen-unstable to reenable debugging

PATCH New Simon Kagstrom 1 participant 1 message Jun 22, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxc and domain.c changes backported from xen-unstable to reenable debugging

The following two patches reenable debugging of paravirtualized and HVM domains for the xen-3.0-testing.hg tree. The patches are backported from xen-unstable.hg,

http://xenbits.xensource.com/xen-unstable.hg?cs=93379554837c
http://xenbits.xensource.com/xen-unstable.hg?cs=ed696467fe64

The first patch exports the cr0 value to the guest in Xen and the second abstracts away the differences between HVM and paravirtualized guests with regard to physical/machine addresses in xc_ptrace.c.

xen/arch/x86/domain.c +5 -0
diff -r c2a8f93d0dc8 xen/arch/x86/domain.c
@@ -379,6 +379,11 @@ int arch_set_info_guest(
         v->arch.flags |= TF_kernel_mode;
 
     memcpy(&v->arch.guest_context, c, sizeof(*c));
+
+    /* Only CR0.TS is modifiable by guest or admin. */
+    v->arch.guest_context.ctrlreg[0] &= X86_CR0_TS;
+    v->arch.guest_context.ctrlreg[0] |= read_cr0() & ~X86_CR0_TS;
+
     init_int80_direct_trap(v);
 
     if ( !(c->flags & VGCF_HVM_GUEST) )
tools/libxc/xc_ptrace.c +114 -106

288 lines not on this page · raw message

tools/libxc/xg_private.h +11 -1
diff -r c2a8f93d0dc8 tools/libxc/xg_private.h
@@ -48,6 +48,8 @@ unsigned long csum_page (void * page);
 #define L2_PAGETABLE_SHIFT_PAE   21
 #define L3_PAGETABLE_SHIFT_PAE   30
 
+#define L2_PAGETABLE_SHIFT_I386  22
+
 #if defined(__i386__)
 #define L1_PAGETABLE_SHIFT       12
 #define L2_PAGETABLE_SHIFT       22
@@ -62,7 +64,10 @@ unsigned long csum_page (void * page);
 #define L2_PAGETABLE_ENTRIES_PAE  512
 #define L3_PAGETABLE_ENTRIES_PAE    4
 
-#if defined(__i386__) 
+#define L1_PAGETABLE_ENTRIES_I386 1024
+#define L2_PAGETABLE_ENTRIES_I386 1024
+
+#if defined(__i386__)
 #define L1_PAGETABLE_ENTRIES   1024
 #define L2_PAGETABLE_ENTRIES   1024
 #elif defined(__x86_64__)
@@ -95,6 +100,11 @@ typedef unsigned long l4_pgentry_t;
 #define l3_table_offset_pae(_a) \
   (((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
 
+#define l1_table_offset_i386(_a) \
+  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES_I386 - 1))
+#define l2_table_offset_i386(_a) \
+  (((_a) >> L2_PAGETABLE_SHIFT_I386) & (L2_PAGETABLE_ENTRIES_I386 - 1))
+
 #if defined(__i386__)
 #define l1_table_offset(_a) \
           (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel