Skip to content

NEW: 32bit gdbserver-xen/libxc to debug 64bit guest

Mukesh Rathor xen-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 1 patch 0 repliesNew

Patches in v1 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [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

BUILD/xen-3.1.1-ovs/config/x86_64.mk +2 -0
diff -uNpr orig/BUILD/xen-3.1.1-ovs/config/x86_64.mk new/BUILD/xen-3.1.1-ovs/config/x86_64.mk
@@ -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.
BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.c +62 -63

296 lines not on this page · raw message

BUILD/xen-3.1.1-ovs/tools/libxc/xc_ptrace.h +35 -28

71 lines not on this page · raw message

BUILD/xen-3.1.1-ovs/tools/libxc/xenctrl.h +9 -3
diff -uNpr orig/BUILD/xen-3.1.1-ovs/tools/libxc/xenctrl.h new/BUILD/xen-3.1.1-ovs/tools/libxc/xenctrl.h
@@ -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,
BUILD/xen-3.1.1-ovs/tools/libxc/xg_private.h +1 -1
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
@@ -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)
BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen.h +50 -20

115 lines not on this page · raw message

BUILD/xen-3.1.1-ovs/xen/include/public/arch-x86/xen-x86_32.h +0 -17
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
@@ -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 {
BUILD/xen-3.1.1-ovs/xen/include/public/domctl.h +3 -0
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
@@ -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;
BUILD/xen-3.1.1-ovs/xen/include/public/foreign/mkheader.py +2 -0
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
@@ -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
[email protected]
http://lists.xensource.com/xen-devel