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

[Xen-devel] [PATCH 0/1] NEW: 32bit gdbserver-xen/libxc to debug 64bit guest



Fixed my previous patch to put user.h in proper place, so files including them dont' have to be copied from gdbserver. This is part 0 of 1.

Thanks
Mukesh
diff -uNpr orig/BUILD/xen-3.1.1-ovs/config/x86_64.mk 
new/BUILD/xen-3.1.1-ovs/config/x86_64.mk
--- orig/BUILD/xen-3.1.1-ovs/config/x86_64.mk   2007-09-12 17:43:15.000000000 
-0700
+++ new/BUILD/xen-3.1.1-ovs/config/x86_64.mk    2007-11-02 16:21:26.451699000 
-0700
@@ -8,7 +8,9 @@ CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
 CONFIG_IOEMU := y
 
+ifeq "$(findstring _GDB_CROSS_COMP, $(CFLAGS))" ""
 CFLAGS += -m64
+endif
 LIBDIR = $(LIB64DIR)
 
 # Use only if calling $(LD) directly.
diff -uNpr orig/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.c 
new/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.c
--- orig/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.c    2007-09-12 
17:43:19.000000000 -0700
+++ new/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.c     2007-11-02 
16:21:26.487696000 -0700
@@ -156,7 +156,6 @@ online_vcpus_changed(uint64_t cpumap)
 static long      nr_pages = 0;
 static uint64_t *page_array = NULL;
 
-
 /*
  * Translates physical addresses to machine addresses for HVM
  * guests. For paravirtual domains the function will just return the
@@ -174,14 +173,15 @@ to_ma(int cpu, uint64_t maddr)
     return maddr;
 }
 
+#if defined (__i386__) && !defined(_CROSS_COMP_PAE) && 
!defined(_GDB_CROSS_COMP)
 static void *
 map_domain_va_32(
     int xc_handle,
     int cpu,
-    void *guest_va,
+    unsigned long va,
     int perm)
 {
-    unsigned long l2e, l1e, l1p, p, va = (unsigned long)guest_va;
+    unsigned long l2e, l1e, l1p, p = va;
     uint32_t *l2, *l1;
     static void *v[MAX_VIRT_CPUS];
 
@@ -213,17 +213,18 @@ map_domain_va_32(
 
     return (void *)((unsigned long)v[cpu] | (va & (PAGE_SIZE - 1)));
 }
+#endif
 
 
+#if defined(_CROSS_COMP_PAE)
 static void *
 map_domain_va_pae(
     int xc_handle,
     int cpu,
-    void *guest_va,
+    unsigned long va,
     int perm)
 {
     uint64_t l3e, l2e, l1e, l2p, l1p, p;
-    unsigned long va = (unsigned long)guest_va;
     uint64_t *l3, *l2, *l1;
     static void *v[MAX_VIRT_CPUS];
 
@@ -264,21 +265,26 @@ map_domain_va_pae(
 
     return (void *)((unsigned long)v[cpu] | (va & (PAGE_SIZE - 1)));
 }
+#endif
 
-#ifdef __x86_64__
+#if defined (__x86_64__) || defined(_GDB_CROSS_COMP)
 static void *
 map_domain_va_64(
     int xc_handle,
     int cpu,
-    void *guest_va,
+    uint64_t guest_va,
     int perm)
 {
-    unsigned long l4e, l3e, l2e, l1e, l3p, l2p, l1p, p, va = (unsigned 
long)guest_va;
+    unsigned long l4e, l3e, l2e, l1e, l3p, l2p, l1p, p;
     uint64_t *l4, *l3, *l2, *l1;
     static void *v[MAX_VIRT_CPUS];
+    long retval;
 
+#if 0
+    /* BUG: ctrlreg[4] returns 0 on 32bit dom0. Don't know on 64bit dom0 */
     if ((ctxt[cpu].ctrlreg[4] & 0x20) == 0 ) /* legacy ia32 mode */
         return map_domain_va_32(xc_handle, cpu, guest_va, perm);
+#endif
 
     l4 = xc_map_foreign_range(
         xc_handle, current_domid, PAGE_SIZE, PROT_READ,
@@ -286,37 +292,40 @@ map_domain_va_64(
     if ( l4 == NULL )
         return NULL;
 
-    l4e = l4[l4_table_offset(va)];
+    l4e = l4[l4_table_offset_x86_64(guest_va)];
     munmap(l4, PAGE_SIZE);
     if ( !(l4e & _PAGE_PRESENT) )
         return NULL;
     l3p = to_ma(cpu, l4e);
-    l3 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l3p >> PAGE_SHIFT);
+    l3 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
+                              l3p >> PAGE_SHIFT);
     if ( l3 == NULL )
         return NULL;
 
-    l3e = l3[l3_table_offset(va)];
+    l3e = l3[l3_table_offset_x86_64(guest_va)];
     munmap(l3, PAGE_SIZE);
     if ( !(l3e & _PAGE_PRESENT) )
         return NULL;
     l2p = to_ma(cpu, l3e);
-    l2 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
l2p >> PAGE_SHIFT);
+    l2 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, PROT_READ, 
+                              l2p >> PAGE_SHIFT);
     if ( l2 == NULL )
         return NULL;
 
-    l2e = l2[l2_table_offset(va)];
+    l2e = l2[l2_table_offset_x86_64(guest_va)];
     munmap(l2, PAGE_SIZE);
     if ( !(l2e & _PAGE_PRESENT) )
         return NULL;
     l1p = to_ma(cpu, l2e);
     if (l2e & 0x80)  { /* 2M pages */
-        p = to_ma(cpu, (l1p + l1_table_offset(va)) << PAGE_SHIFT);
+        p = to_ma(cpu, (l1p + l1_table_offset_x86_64(guest_va)) << PAGE_SHIFT);
     } else { /* 4K pages */
-        l1 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, 
PROT_READ, l1p >> PAGE_SHIFT);
+        l1 = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, 
+                                 PROT_READ, l1p >> PAGE_SHIFT);
         if ( l1 == NULL )
             return NULL;
 
-        l1e = l1[l1_table_offset(va)];
+        l1e = l1[l1_table_offset_x86_64(guest_va)];
         munmap(l1, PAGE_SIZE);
         if ( !(l1e & _PAGE_PRESENT) )
             return NULL;
@@ -324,36 +333,26 @@ map_domain_va_64(
     }
     if ( v[cpu] != NULL )
         munmap(v[cpu], PAGE_SIZE);
-    v[cpu] = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, perm, p 
>> PAGE_SHIFT);
+
+    v[cpu] = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE, 
+                                  perm, p >> PAGE_SHIFT);
     if ( v[cpu] == NULL )
         return NULL;
 
-    return (void *)((unsigned long)v[cpu] | (va & (PAGE_SIZE - 1)));
+    retval = ((unsigned long)v[cpu] | (guest_va & (PAGE_SIZE - 1)));
+
+    return (void *)(retval);
 }
-#endif
+#endif    /* defined (__x86_64__) || defined(_GDB_CROSS_COMP) */
 
 static void *
 map_domain_va(
     int xc_handle,
     int cpu,
-    void *guest_va,
+    uint64_t guest_va,
     int perm)
 {
-    unsigned long va = (unsigned long) guest_va;
     long npgs = xc_get_tot_pages(xc_handle, current_domid);
-    static enum { MODE_UNKNOWN, MODE_64, MODE_32, MODE_PAE } mode;
-
-    if ( mode == MODE_UNKNOWN )
-    {
-        xen_capabilities_info_t caps;
-        (void)xc_version(xc_handle, XENVER_capabilities, caps);
-        if ( strstr(caps, "-x86_64") )
-            mode = MODE_64;
-        else if ( strstr(caps, "-x86_32p") )
-            mode = MODE_PAE;
-        else if ( strstr(caps, "-x86_32") )
-            mode = MODE_32;
-    }
 
     if ( nr_pages != npgs )
     {
@@ -379,28 +378,29 @@ map_domain_va(
     if (!paging_enabled(&ctxt[cpu])) {
         static void * v;
         uint64_t page;
+       unsigned long va = (unsigned long)guest_va;
 
         if ( v != NULL )
             munmap(v, PAGE_SIZE);
 
         page = to_ma(cpu, va);
 
-        v = xc_map_foreign_range( xc_handle, current_domid, PAGE_SIZE,
-                perm, page >> PAGE_SHIFT);
+        v = xc_map_foreign_range(xc_handle, current_domid, PAGE_SIZE,
+                                 perm, page >> PAGE_SHIFT);
 
         if ( v == NULL )
             return NULL;
 
         return (void *)(((unsigned long)v) | (va & BSD_PAGE_MASK));
     }
-#ifdef __x86_64__
-    if ( mode == MODE_64 )
-        return map_domain_va_64(xc_handle, cpu, guest_va, perm);
+
+#if defined(_CROSS_COMP_PAE)
+    return map_domain_va_pae(xc_handle, cpu, (unsigned long)guest_va, perm);
+#elif defined (__x86_64__) || defined(_GDB_CROSS_COMP)
+    return map_domain_va_64(xc_handle, cpu, guest_va, perm);
+#else
+    return map_domain_va_32(xc_handle, cpu, (unsigned long)guest_va, perm);
 #endif
-    if ( mode == MODE_PAE )
-        return map_domain_va_pae(xc_handle, cpu, guest_va, perm);
-    /* else ( mode == MODE_32 ) */
-    return map_domain_va_32(xc_handle, cpu, guest_va, perm);
 }
 
 int control_c_pressed_flag = 0;
@@ -456,22 +456,22 @@ __xc_waitdomain(
 }
 
 
-long
+guest_va_type
 xc_ptrace(
     int xc_handle,
     enum __ptrace_request request,
     uint32_t domid_tid,
-    long eaddr,
-    long edata)
+    guest_va_type eaddr,
+    guest_va_type edata)
 {
     DECLARE_DOMCTL;
     struct gdb_regs pt;
-    long            retval = 0;
-    unsigned long  *guest_va;
+    guest_va_type   retval = 0;
+    void  *guest_va; /* mmap'd page where results are returned. BUG: no unmap 
*/
     uint64_t        cpumap;
     int             cpu, index;
-    void           *addr = (char *)eaddr;
-    void           *data = (char *)edata;
+    void           *datap = (char *)((unsigned long)edata);
+    unsigned long   laddr = (unsigned long)eaddr;
 
     cpu = (request != PTRACE_ATTACH) ? domid_tid : 0;
 
@@ -480,14 +480,13 @@ xc_ptrace(
     case PTRACE_PEEKTEXT:
     case PTRACE_PEEKDATA:
         if (current_isfile)
-            guest_va = (unsigned long *)map_domain_va_core(
-                current_domid, cpu, addr, ctxt);
+            guest_va = (unsigned long *)map_domain_va_core(current_domid, cpu, 
+                                                          (void *)laddr, ctxt);
         else
-            guest_va = (unsigned long *)map_domain_va(
-                xc_handle, cpu, addr, PROT_READ);
+            guest_va = map_domain_va(xc_handle, cpu, eaddr, PROT_READ);
         if ( guest_va == NULL )
             goto out_error;
-        retval = *guest_va;
+        retval = *(guest_va_type *)guest_va;
         break;
 
     case PTRACE_POKETEXT:
@@ -495,38 +494,38 @@ xc_ptrace(
         /* XXX assume that all CPUs have the same address space */
         if (current_isfile)
             guest_va = (unsigned long *)map_domain_va_core(
-                current_domid, cpu, addr, ctxt);
+                current_domid, cpu, (void *)laddr, ctxt);
         else
-            guest_va = (unsigned long *)map_domain_va(
-                xc_handle, cpu, addr, PROT_READ|PROT_WRITE);
+            guest_va = map_domain_va(xc_handle, cpu, eaddr, 
+                                    PROT_READ|PROT_WRITE);
         if ( guest_va == NULL )
             goto out_error;
-        *guest_va = (unsigned long)data;
+        *(guest_va_type *)guest_va = edata;
         break;
 
     case PTRACE_GETREGS:
         if (!current_isfile && fetch_regs(xc_handle, cpu, NULL))
             goto out_error;
         SET_PT_REGS(pt, ctxt[cpu].user_regs);
-        memcpy(data, &pt, sizeof(struct gdb_regs));
+        memcpy(datap, &pt, sizeof(struct gdb_regs));
         break;
 
     case PTRACE_GETFPREGS:
         if (!current_isfile && fetch_regs(xc_handle, cpu, NULL)) 
                 goto out_error;
-        memcpy(data, &ctxt[cpu].fpu_ctxt, sizeof (elf_fpregset_t));
+        memcpy(datap, &ctxt[cpu].fpu_ctxt, sizeof (elf_fpregset_t));
         break;
 
     case PTRACE_GETFPXREGS:
         if (!current_isfile && fetch_regs(xc_handle, cpu, NULL))
                 goto out_error;
-        memcpy(data, &ctxt[cpu].fpu_ctxt, sizeof(ctxt[cpu].fpu_ctxt));
+        memcpy(datap, &ctxt[cpu].fpu_ctxt, sizeof(ctxt[cpu].fpu_ctxt));
         break;
 
     case PTRACE_SETREGS:
         if (current_isfile)
                 goto out_unsupported; /* XXX not yet supported */
-        SET_XC_REGS(((struct gdb_regs *)data), ctxt[cpu].user_regs);
+        SET_XC_REGS(((struct gdb_regs *)datap), ctxt[cpu].user_regs);
         if ((retval = xc_vcpu_setcontext(xc_handle, current_domid, cpu,
                                 &ctxt[cpu])))
             goto out_error_domctl;
diff -uNpr orig/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.h 
new/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.h
--- orig/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.h    2007-09-12 
17:43:19.000000000 -0700
+++ new/BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.h     2007-11-02 
16:21:26.497696000 -0700
@@ -6,36 +6,43 @@
 #define BSD_PAGE_MASK (PAGE_SIZE-1)
 #define PSL_T  0x00000100 /* trace enable bit */
 
-#ifdef __x86_64__
+/* if cross compiling a 32 bit binary to attach to 64 guest */
+#if defined(_GDB_CROSS_COMP)
+#define cross_regs64_t unsigned long long
+#elif defined(__x86_64__)
+#define cross_regs64_t unsigned long 
+#endif
+
+#if defined(__x86_64__) || defined(_GDB_CROSS_COMP)
 struct gdb_regs
 {
-  unsigned long r15;
-  unsigned long r14;
-  unsigned long r13;
-  unsigned long r12;
-  unsigned long rbp;
-  unsigned long rbx;
-  unsigned long r11;
-  unsigned long r10;
-  unsigned long r9;
-  unsigned long r8;
-  unsigned long rax;
-  unsigned long rcx;
-  unsigned long rdx;
-  unsigned long rsi;
-  unsigned long rdi;
-  unsigned long orig_rax;
-  unsigned long rip;
-  unsigned long xcs;
-  unsigned long rflags;
-  unsigned long rsp;
-  unsigned long xss;
-  unsigned long fs_base;
-  unsigned long gs_base;
-  unsigned long xds;
-  unsigned long xes;
-  unsigned long xfs;
-  unsigned long xgs;
+  cross_regs64_t r15;
+  cross_regs64_t r14;
+  cross_regs64_t r13;
+  cross_regs64_t r12;
+  cross_regs64_t rbp;
+  cross_regs64_t rbx;
+  cross_regs64_t r11;
+  cross_regs64_t r10;
+  cross_regs64_t r9;
+  cross_regs64_t r8;
+  cross_regs64_t rax;
+  cross_regs64_t rcx;
+  cross_regs64_t rdx;
+  cross_regs64_t rsi;
+  cross_regs64_t rdi;
+  cross_regs64_t orig_rax;
+  cross_regs64_t rip;
+  cross_regs64_t xcs;
+  cross_regs64_t rflags;
+  cross_regs64_t rsp;
+  cross_regs64_t xss;
+  cross_regs64_t fs_base;
+  cross_regs64_t gs_base;
+  cross_regs64_t xds;
+  cross_regs64_t xes;
+  cross_regs64_t xfs;
+  cross_regs64_t xgs;
 };
 
 #define SET_PT_REGS(pt, xc)                     \
diff -uNpr orig/BUILD/xen-3.1.1-ovs/tools/libxc/xenctrl.h 
new/BUILD/xen-3.1.1-ovs/tools/libxc/xenctrl.h
--- orig/BUILD/xen-3.1.1-ovs/tools/libxc/xenctrl.h      2007-09-12 
23:47:53.000000000 -0700
+++ new/BUILD/xen-3.1.1-ovs/tools/libxc/xenctrl.h       2007-11-02 
16:21:26.492696000 -0700
@@ -123,18 +123,24 @@ typedef struct xc_core_header {
 #include <sys/ptrace.h>
 #include <thread_db.h>
 
+#ifdef _GDB_CROSS_COMP
+#define guest_va_type unsigned long long 
+#else
+#define guest_va_type unsigned long 
+#endif
+
 typedef void (*thr_ev_handler_t)(long);
 
 void xc_register_event_handler(
     thr_ev_handler_t h,
     td_event_e e);
 
-long xc_ptrace(
+guest_va_type xc_ptrace(
     int xc_handle,
     enum __ptrace_request request,
     uint32_t  domid,
-    long addr,
-    long data);
+    guest_va_type addr,
+    guest_va_type edata);
 
 int xc_waitdomain(
     int xc_handle,
diff -uNpr orig/BUILD/xen-3.1.1-ovs/tools/libxc/xg_private.h 
new/BUILD/xen-3.1.1-ovs/tools/libxc/xg_private.h
--- orig/BUILD/xen-3.1.1-ovs/tools/libxc/xg_private.h   2007-11-02 
16:19:38.581448000 -0700
+++ new/BUILD/xen-3.1.1-ovs/tools/libxc/xg_private.h    2007-11-02 
16:21:26.501696000 -0700
@@ -119,7 +119,7 @@ typedef l4_pgentry_64_t l4_pgentry_t;
 #define l3_table_offset_x86_64(_a) \
   (((_a) >> L3_PAGETABLE_SHIFT_X86_64) & (L3_PAGETABLE_ENTRIES_X86_64 - 1))
 #define l4_table_offset_x86_64(_a) \
-  (((_a) >> L4_PAGETABLE_SHIFT_X86_64) & (L4_PAGETABLE_ENTRIES_X86_64 - 1))
+  ((((uint64_t)_a) >> L4_PAGETABLE_SHIFT_X86_64) & 
((uint64_t)L4_PAGETABLE_ENTRIES_X86_64 - 1))
 
 #if defined(__i386__)
 #define l1_table_offset(_a) l1_table_offset_i386(_a)
diff -uNpr orig/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen.h 
new/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen.h
--- orig/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen.h  2007-09-12 
23:47:54.000000000 -0700
+++ new/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen.h   2007-11-02 
16:21:26.509696000 -0700
@@ -44,11 +44,38 @@
 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
 #endif
 
-#if defined(__i386__)
-#include "xen-x86_32.h"
-#elif defined(__x86_64__)
-#include "xen-x86_64.h"
+/* following needed for gdbserver _GDB_CROSS_COMP also */
+#if defined(__i386__) || defined(_GDB_CROSS_COMP)
+/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#undef __DEFINE_XEN_GUEST_HANDLE
+#define __DEFINE_XEN_GUEST_HANDLE(name, type)                   \
+    typedef struct { type *p; }                                 \
+        __guest_handle_ ## name;                                \
+    typedef struct { union { type *p; uint64_aligned_t q; }; }  \
+        __guest_handle_64_ ## name
+#undef set_xen_guest_handle
+#define set_xen_guest_handle(hnd, val)                      \
+    do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0;   \
+         (hnd).p = val;                                     \
+    } while ( 0 )
+#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
 #endif
+#endif
+
+#if defined(__x86_64__) || defined(_GDB_CROSS_COMP)
+#  include "xen-x86_64.h"
+#elif defined(__i386__)
+#  include "xen-x86_32.h"
+#endif
+
+#if defined(_GDB_CROSS_COMP)
+#  define crosscomp_type   unsigned long long
+#else
+#  define crosscomp_type   unsigned long
+#endif
+
 
 #ifndef __ASSEMBLY__
 /* Guest handles for primitive C types. */
@@ -103,7 +130,10 @@ struct trap_info {
     uint8_t       vector;  /* exception vector                              */
     uint8_t       flags;   /* 0-3: privilege level; 4: clear event enable?  */
     uint16_t      cs;      /* code selector                                 */
-    unsigned long address; /* code offset                                   */
+#if defined (_GDB_CROSS_COMP)
+    int           pad;
+#endif
+    crosscomp_type address; /* code offset                                  */
 };
 typedef struct trap_info trap_info_t;
 DEFINE_XEN_GUEST_HANDLE(trap_info_t);
@@ -129,37 +159,37 @@ struct vcpu_guest_context {
 #define VGCF_syscall_disables_events   (1<<_VGCF_syscall_disables_events)
 #define _VGCF_online                   5
 #define VGCF_online                    (1<<_VGCF_online)
-    unsigned long flags;                    /* VGCF_* flags                 */
+    crosscomp_type flags;               /* VGCF_* flags                 */
     struct cpu_user_regs user_regs;         /* User-level CPU registers     */
     struct trap_info trap_ctxt[256];        /* Virtual IDT                  */
-    unsigned long ldt_base, ldt_ents;       /* LDT (linear address, # ents) */
-    unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
-    unsigned long kernel_ss, kernel_sp;     /* Virtual TSS (only SS1/SP1)   */
+    crosscomp_type ldt_base, ldt_ents;  /* LDT (linear address, # ents) */
+    crosscomp_type gdt_frames[16], gdt_ents;/*GDT (machine frames, # ents)*/
+    crosscomp_type kernel_ss, kernel_sp; /* Virtual TSS (only SS1/SP1)   */
     /* NB. User pagetable on x86/64 is placed in ctrlreg[1]. */
-    unsigned long ctrlreg[8];               /* CR0-CR7 (control registers)  */
-    unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
-#ifdef __i386__
+    crosscomp_type ctrlreg[8];           /* CR0-CR7 (control registers)  */
+    crosscomp_type debugreg[8];          /* DB0-DB7 (debug registers)    */
+#if defined(__i386__) && !defined(_GDB_CROSS_COMP)
     unsigned long event_callback_cs;        /* CS:EIP of event callback     */
     unsigned long event_callback_eip;
     unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
     unsigned long failsafe_callback_eip;
 #else
-    unsigned long event_callback_eip;
-    unsigned long failsafe_callback_eip;
+    crosscomp_type event_callback_eip;
+    crosscomp_type failsafe_callback_eip;
 #ifdef __XEN__
     union {
-        unsigned long syscall_callback_eip;
+        crosscomp_type syscall_callback_eip;
         struct {
             unsigned int event_callback_cs;    /* compat CS of event cb     */
             unsigned int failsafe_callback_cs; /* compat CS of failsafe cb  */
         };
     };
 #else
-    unsigned long syscall_callback_eip;
+    crosscomp_type syscall_callback_eip;
 #endif
 #endif
-    unsigned long vm_assist;                /* VMASST_TYPE_* bitmap */
-#ifdef __x86_64__
+    crosscomp_type vm_assist;                /* VMASST_TYPE_* bitmap */
+#if defined (__x86_64__) || defined(_GDB_CROSS_COMP)
     /* Segment base addresses. */
     uint64_t      fs_base;
     uint64_t      gs_base_kernel;
@@ -170,10 +200,10 @@ typedef struct vcpu_guest_context vcpu_g
 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 
 struct arch_shared_info {
-    unsigned long max_pfn;                  /* max pfn that appears in table */
+    crosscomp_type max_pfn;                  /* max pfn that appears in table 
*/
     /* Frame containing list of mfns containing list of mfns containing p2m. */
     xen_pfn_t     pfn_to_mfn_frame_list_list;
-    unsigned long nmi_reason;
+    crosscomp_type nmi_reason;
     uint64_t pad[32];
 };
 typedef struct arch_shared_info arch_shared_info_t;
diff -uNpr orig/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen-x86_32.h 
new/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen-x86_32.h
--- orig/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen-x86_32.h   
2007-09-12 23:47:53.000000000 -0700
+++ new/BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen-x86_32.h    
2007-11-02 16:21:26.513696000 -0700
@@ -105,23 +105,6 @@
 #define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
 #endif
 
-/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
-#if defined(__XEN__) || defined(__XEN_TOOLS__)
-#undef __DEFINE_XEN_GUEST_HANDLE
-#define __DEFINE_XEN_GUEST_HANDLE(name, type)                   \
-    typedef struct { type *p; }                                 \
-        __guest_handle_ ## name;                                \
-    typedef struct { union { type *p; uint64_aligned_t q; }; }  \
-        __guest_handle_64_ ## name
-#undef set_xen_guest_handle
-#define set_xen_guest_handle(hnd, val)                      \
-    do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0;   \
-         (hnd).p = val;                                     \
-    } while ( 0 )
-#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
-#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
-#endif
-
 #ifndef __ASSEMBLY__
 
 struct cpu_user_regs {
diff -uNpr orig/BUILD/xen-3.1.1-ovs/xen/include/public/domctl.h 
new/BUILD/xen-3.1.1-ovs/xen/include/public/domctl.h
--- orig/BUILD/xen-3.1.1-ovs/xen/include/public/domctl.h        2007-09-12 
23:47:49.000000000 -0700
+++ new/BUILD/xen-3.1.1-ovs/xen/include/public/domctl.h 2007-11-02 
16:21:26.523696000 -0700
@@ -437,6 +437,9 @@ struct xen_domctl {
     uint32_t cmd;
     uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
     domid_t  domain;
+#ifdef _GDB_CROSS_COMP
+    int      pad;
+#endif
     union {
         struct xen_domctl_createdomain      createdomain;
         struct xen_domctl_getdomaininfo     getdomaininfo;
diff -uNpr orig/BUILD/xen-3.1.1-ovs/xen/include/public/foreign/mkheader.py 
new/BUILD/xen-3.1.1-ovs/xen/include/public/foreign/mkheader.py
--- orig/BUILD/xen-3.1.1-ovs/xen/include/public/foreign/mkheader.py     
2007-09-12 17:43:26.000000000 -0700
+++ new/BUILD/xen-3.1.1-ovs/xen/include/public/foreign/mkheader.py      
2007-11-02 16:21:26.518696000 -0700
@@ -21,6 +21,7 @@ inttypes["x86_32"] = {
     "unsigned long" : "uint32_t",
     "long"          : "uint32_t",
     "xen_pfn_t"     : "uint32_t",
+    "crosscomp_type": "uint32_t",
 };
 header["x86_32"] = """
 #define __i386___X86_32 1
@@ -35,6 +36,7 @@ inttypes["x86_64"] = {
     "unsigned long" : "__align8__ uint64_t",
     "long"          : "__align8__ uint64_t",
     "xen_pfn_t"     : "__align8__ uint64_t",
+    "crosscomp_type": "__align8__ uint64_t",
 };
 header["x86_64"] = """
 #ifdef __GNUC__
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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