From 3cd7e108676c2d1a2e50891a4cef1c0f281223e5 Mon Sep 17 00:00:00 2001 From: ths Date: Wed, 31 Jan 2007 12:16:50 +0000 Subject: [PATCH] siginfo fix for Darwin/Mac OS X, by Pierre d'Herbemont. --- cpu-exec.c | 27 ++++++++++++++++++--------- target-arm/cpu.h | 3 +-- target-i386/cpu.h | 3 +-- target-m68k/cpu.h | 3 +-- target-ppc/cpu.h | 3 +-- target-sh4/cpu.h | 5 ++--- target-sparc/cpu.h | 3 +-- 7 files changed, 25 insertions(+), 22 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 6662b397..a2704e5f 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -1280,9 +1280,10 @@ static void cpu_send_trap(unsigned long pc, int trap, } #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 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, #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 @@ typedef struct ucontext SIGCONTEXT; # 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 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, #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 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, } #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 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, #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 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, #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 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, # 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 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, void *puc) #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; diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 359d5cbd..3208c138 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -133,8 +133,7 @@ void switch_mode(CPUARMState *, int); /* 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) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 42960931..70a1cacc 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -628,8 +628,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32); /* 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); diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h index a30bf962..de37baf9 100644 --- a/target-m68k/cpu.h +++ b/target-m68k/cpu.h @@ -97,8 +97,7 @@ void cpu_m68k_close(CPUM68KState *s); /* 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); diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index f05fb280..b294e314 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -575,8 +575,7 @@ void cpu_ppc_close(CPUPPCState *s); /* 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); diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h index 7296d9ee..e844d690 100644 --- a/target-sh4/cpu.h +++ b/target-sh4/cpu.h @@ -121,9 +121,8 @@ typedef struct CPUSH4State { 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" diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 86c23200..5c4593ac 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -275,8 +275,7 @@ void cpu_set_cwp(CPUSPARCState *env1, int new_cwp); } 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" -- 2.39.5