From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H9ovr-0004MD-6e for qemu-devel@nongnu.org; Wed, 24 Jan 2007 15:41:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H9ovp-0004Jd-Q6 for qemu-devel@nongnu.org; Wed, 24 Jan 2007 15:41:22 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H9ovp-0004JC-I0 for qemu-devel@nongnu.org; Wed, 24 Jan 2007 15:41:21 -0500 Received: from sp604001mt.neufgp.fr ([84.96.92.60] helo=Smtp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H9ovo-0000Qv-WB for qemu-devel@nongnu.org; Wed, 24 Jan 2007 15:41:21 -0500 Received: from [84.102.211.179] by sp604001mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0JCE00HPZ41QBXE0@sp604001mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Wed, 24 Jan 2007 21:39:27 +0100 (CET) Date: Wed, 24 Jan 2007 21:39:42 +0100 From: Fabrice Bellard Subject: Re: [Qemu-devel] [Patch] siginfo fix for Darwin/Mac OS X In-reply-to: <51E43F76-81AA-49B8-853C-73EB2F31D406@free.fr> Message-id: <45B7C40E.5020104@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <51E43F76-81AA-49B8-853C-73EB2F31D406@free.fr> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel