Hi,

This should fix:

/Users/ilya/tmp/feb4/qemu_cvs_user/qemu/cpu-exec.c: In function 'cpu_x86_signal_handler':
/Users/ilya/tmp/feb4/qemu_cvs_user/qemu/cpu-exec.c:1307:
error: request for member 'gregs' in something not a structure or union
/Users/ilya/tmp/feb4/qemu_cvs_user/qemu/cpu-exec.c:1307:
error: 'EIP' undeclared (first use in this function)
...

on Mac OS X/x86.
Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.91
diff -u -r1.91 cpu-exec.c
--- cpu-exec.c  2 Feb 2007 03:57:09 -0000       1.91
+++ cpu-exec.c  5 Feb 2007 09:32:32 -0000
@@ -1261,6 +1261,20 @@
 
 #if defined(__i386__)
 
+#ifdef linux
+
+# define EIP_sig(context)     ((context)->uc_mcontext.gregs[REG_EIP])
+# define TRAP_sig(context)    ((context)->uc_mcontext.gregs[REG_TRAPNO])
+# define ERROR_sig(context)   ((context)->uc_mcontext.gregs[REG_ERR])
+
+#elif defined(__APPLE__)
+# include <sys/ucontext.h>
+
+# define EIP_sig(context)     (*((unsigned 
long*)&(context)->uc_mcontext->ss.eip))
+# define TRAP_sig(context)    ((context)->uc_mcontext->es.trapno)
+# define ERROR_sig(context)   ((context)->uc_mcontext->es.err)
+#endif
+
 #if defined(USE_CODE_COPY)
 static void cpu_send_trap(unsigned long pc, int trap, 
                           struct ucontext *uc)
@@ -1295,8 +1309,8 @@
 #define REG_ERR    ERR
 #define REG_TRAPNO TRAPNO
 #endif
-    pc = uc->uc_mcontext.gregs[REG_EIP];
-    trapno = uc->uc_mcontext.gregs[REG_TRAPNO];
+    pc = EIP_sig(uc);
+    trapno = TRAP_sig(uc);
 #if defined(TARGET_I386) && defined(USE_CODE_COPY)
     if (trapno == 0x00 || trapno == 0x05) {
         /* send division by zero or bound exception */
@@ -1306,7 +1320,7 @@
 #endif
         return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
                                  trapno == 0xe ? 
-                                 (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0,
+                                 (ERROR_sig(uc) >> 1) & 1 : 0,
                                  &uc->uc_sigmask, puc);
 }
 

Ilya, Hope this will work for you.

Pierre.
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to