From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Patch] siginfo fix for Darwin/Mac OS X
Date: Wed, 24 Jan 2007 21:39:42 +0100 [thread overview]
Message-ID: <45B7C40E.5020104@bellard.org> (raw)
In-Reply-To: <51E43F76-81AA-49B8-853C-73EB2F31D406@free.fr>
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
prev parent reply other threads:[~2007-01-24 20:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-24 20:27 [Qemu-devel] [Patch] siginfo fix for Darwin/Mac OS X Pierre d'Herbemont
2007-01-24 20:39 ` Fabrice Bellard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45B7C40E.5020104@bellard.org \
--to=fabrice@bellard.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).