qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Patch] siginfo fix for Darwin/Mac OS X


From: Fabrice Bellard
Subject: Re: [Qemu-devel] [Patch] siginfo fix for Darwin/Mac OS X
Date: Wed, 24 Jan 2007 21:39:42 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Hi,

I agree that your solution with 'void *' is better than the current one.

Fabrice.

Pierre d'Herbemont wrote:
Hi,

This patch is an attempt to suppress the anonymous "struct siginfo" trick, as it doesn't work on darwin since struct siginfo isn't defined, and stay anonymous.

Here I use siginfo_t, assuming that it is defined on most platform. But feel free to add a "typedef struct siginfo siginfo_t;" for your platform if needed, or some other trick.

(Variation of this hack is possible as "struct __siginfo" is valid on darwin. Feel free to use)

Pierre.


------------------------------------------------------------------------

Index: target-sparc/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-sparc/cpu.h,v
retrieving revision 1.26
diff -u -r1.26 cpu.h
--- target-sparc/cpu.h  23 Dec 2006 14:18:40 -0000      1.26
+++ target-sparc/cpu.h  24 Jan 2007 20:18:37 -0000
@@ -275,8 +275,7 @@
     } while (0)
 #endif
-struct siginfo;
-int cpu_sparc_signal_handler(int hostsignum, struct siginfo *info, void *puc);
+int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);
#include "cpu-all.h" Index: target-sh4/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-sh4/cpu.h,v
retrieving revision 1.4
diff -u -r1.4 cpu.h
--- target-sh4/cpu.h    23 Dec 2006 14:18:40 -0000      1.4
+++ target-sh4/cpu.h    24 Jan 2007 20:18:37 -0000
@@ -121,9 +121,8 @@
CPUSH4State *cpu_sh4_init(void);
 int cpu_sh4_exec(CPUSH4State * s);
-struct siginfo;
-int cpu_sh4_signal_handler(int hostsignum, struct siginfo *info,
-                          void *puc);
+int cpu_sh4_signal_handler(int host_signum, void *pinfo, + void *puc); #include "softfloat.h" Index: target-ppc/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-ppc/cpu.h,v
retrieving revision 1.24
diff -u -r1.24 cpu.h
--- target-ppc/cpu.h    23 Dec 2006 14:18:40 -0000      1.24
+++ target-ppc/cpu.h    24 Jan 2007 20:18:38 -0000
@@ -575,8 +575,7 @@
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-struct siginfo;
-int cpu_ppc_signal_handler(int host_signum, struct siginfo *info, +int cpu_ppc_signal_handler(int host_signum, void *pinfo, void *puc); void do_interrupt (CPUPPCState *env);
Index: target-m68k/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-m68k/cpu.h,v
retrieving revision 1.2
diff -u -r1.2 cpu.h
--- target-m68k/cpu.h   23 Dec 2006 14:18:40 -0000      1.2
+++ target-m68k/cpu.h   24 Jan 2007 20:18:38 -0000
@@ -97,8 +97,7 @@
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-struct siginfo;
-int cpu_m68k_signal_handler(int host_signum, struct siginfo *info, +int cpu_m68k_signal_handler(int host_signum, void *pinfo, void *puc);
 void cpu_m68k_flush_flags(CPUM68KState *, int);
Index: target-i386/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-i386/cpu.h,v
retrieving revision 1.39
diff -u -r1.39 cpu.h
--- target-i386/cpu.h   23 Dec 2006 14:18:40 -0000      1.39
+++ target-i386/cpu.h   24 Jan 2007 20:18:38 -0000
@@ -628,8 +628,7 @@
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-struct siginfo;
-int cpu_x86_signal_handler(int host_signum, struct siginfo *info, +int cpu_x86_signal_handler(int host_signum, void *pinfo, void *puc);
 void cpu_x86_set_a20(CPUX86State *env, int a20_state);
Index: target-arm/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-arm/cpu.h,v
retrieving revision 1.18
diff -u -r1.18 cpu.h
--- target-arm/cpu.h    23 Dec 2006 14:18:40 -0000      1.18
+++ target-arm/cpu.h    24 Jan 2007 20:18:38 -0000
@@ -133,8 +133,7 @@
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-struct siginfo;
-int cpu_arm_signal_handler(int host_signum, struct siginfo *info, +int cpu_arm_signal_handler(int host_signum, void *pinfo, void *puc); #define CPSR_M (0x1f)
Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.89
diff -u -r1.89 cpu-exec.c
--- cpu-exec.c  24 Jan 2007 01:47:51 -0000      1.89
+++ cpu-exec.c  24 Jan 2007 20:18:38 -0000
@@ -1280,9 +1280,10 @@
 }
 #endif
-int cpu_signal_handler(int host_signum, struct siginfo *info, +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int trapno;
@@ -1310,9 +1311,10 @@
#elif defined(__x86_64__) -int cpu_signal_handler(int host_signum, struct siginfo *info,
+int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
@@ -1374,9 +1376,10 @@
 # define TRAP_sig(context)                     EXCEPREG_sig(exception, 
context) /* number of powerpc exception taken */
 #endif /* __APPLE__ */
-int cpu_signal_handler(int host_signum, struct siginfo *info, +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int is_write;
@@ -1397,9 +1400,10 @@
#elif defined(__alpha__) -int cpu_signal_handler(int host_signum, struct siginfo *info, +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     uint32_t *pc = uc->uc_mcontext.sc_pc;
     uint32_t insn = *pc;
@@ -1426,9 +1430,10 @@
 }
 #elif defined(__sparc__)
-int cpu_signal_handler(int host_signum, struct siginfo *info, +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     uint32_t *regs = (uint32_t *)(info + 1);
     void *sigmask = (regs + 20);
     unsigned long pc;
@@ -1459,9 +1464,10 @@
#elif defined(__arm__) -int cpu_signal_handler(int host_signum, struct siginfo *info, +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int is_write;
@@ -1476,9 +1482,10 @@
#elif defined(__mc68000) -int cpu_signal_handler(int host_signum, struct siginfo *info, +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int is_write;
@@ -1498,8 +1505,9 @@
 # define __ISR_VALID   1
 #endif
-int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc)
+int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long ip;
     int is_write = 0;
@@ -1526,9 +1534,10 @@
#elif defined(__s390__) -int cpu_signal_handler(int host_signum, struct siginfo *info, +int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 {
+    siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int is_write;


------------------------------------------------------------------------

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]