Skip to content

Commit

Permalink
siginfo fix for Darwin/Mac OS X, by Pierre d'Herbemont.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2369 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
ths committed Jan 31, 2007
1 parent fd67764 commit 5a7b542
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
27 changes: 18 additions & 9 deletions cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions target-arm/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions target-i386/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions target-m68k/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions target-ppc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions target-sh4/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 1 addition & 2 deletions target-sparc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 5a7b542

Please sign in to comment.