diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-02-05 21:41:46 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-02-05 21:41:46 +0000 |
commit | d8ecc0b9131a229ff6e8fbe5d3a0b284b1620452 (patch) | |
tree | cf5033b6289cd07011627805771a6f9fc15ec22e /cpu-exec.c | |
parent | 19c80e50ee70ebaea78266a98334e4cd5f017678 (diff) | |
download | qemu-d8ecc0b9131a229ff6e8fbe5d3a0b284b1620452.zip qemu-d8ecc0b9131a229ff6e8fbe5d3a0b284b1620452.tar.gz qemu-d8ecc0b9131a229ff6e8fbe5d3a0b284b1620452.tar.bz2 |
Make cpu_signal_handler work on Mac OS X/Darwin x86
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2400 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r-- | cpu-exec.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -1176,6 +1176,18 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, #if defined(__i386__) +#if defined(__APPLE__) +# include <sys/ucontext.h> + +# define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.eip)) +# define TRAP_sig(context) ((context)->uc_mcontext->es.trapno) +# define ERROR_sig(context) ((context)->uc_mcontext->es.err) +#else +# define EIP_sig(context) ((context)->uc_mcontext.gregs[REG_EIP]) +# define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) +# define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) +#endif + #if defined(USE_CODE_COPY) static void cpu_send_trap(unsigned long pc, int trap, struct ucontext *uc) @@ -1210,8 +1222,8 @@ int cpu_signal_handler(int host_signum, void *pinfo, #define REG_ERR ERR #define REG_TRAPNO TRAPNO #endif - pc = uc->uc_mcontext.gregs[REG_EIP]; - trapno = uc->uc_mcontext.gregs[REG_TRAPNO]; + pc = EIP_sig(uc); + trapno = TRAP_sig(uc); #if defined(TARGET_I386) && defined(USE_CODE_COPY) if (trapno == 0x00 || trapno == 0x05) { /* send division by zero or bound exception */ @@ -1221,7 +1233,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, #endif return handle_cpu_signal(pc, (unsigned long)info->si_addr, trapno == 0xe ? - (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0, + (ERROR_sig(uc) >> 1) & 1 : 0, &uc->uc_sigmask, puc); } |