mirror of https://github.com/xemu-project/xemu.git
Attached patch make cpu-exec.c compile on NetBSD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5887 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
1360677cfe
commit
b3efe5c890
23
cpu-exec.c
23
cpu-exec.c
|
@ -1188,17 +1188,32 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
|
|
||||||
#elif defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
|
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
#define REG_ERR _REG_ERR
|
||||||
|
#define REG_TRAPNO _REG_TRAPNO
|
||||||
|
|
||||||
|
#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.__gregs[(reg)]
|
||||||
|
#define QEMU_UC_MACHINE_PC(uc) _UC_MACHINE_PC(uc)
|
||||||
|
#else
|
||||||
|
#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.gregs[(reg)]
|
||||||
|
#define QEMU_UC_MACHINE_PC(uc) QEMU_UC_MCONTEXT_GREGS(uc, REG_RIP)
|
||||||
|
#endif
|
||||||
|
|
||||||
int cpu_signal_handler(int host_signum, void *pinfo,
|
int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
void *puc)
|
void *puc)
|
||||||
{
|
{
|
||||||
siginfo_t *info = pinfo;
|
siginfo_t *info = pinfo;
|
||||||
struct ucontext *uc = puc;
|
|
||||||
unsigned long pc;
|
unsigned long pc;
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
ucontext_t *uc = puc;
|
||||||
|
#else
|
||||||
|
struct ucontext *uc = puc;
|
||||||
|
#endif
|
||||||
|
|
||||||
pc = uc->uc_mcontext.gregs[REG_RIP];
|
pc = QEMU_UC_MACHINE_PC(uc);
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
||||||
uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ?
|
QEMU_UC_MCONTEXT_GREGS(uc, REG_TRAPNO) == 0xe ?
|
||||||
(uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0,
|
(QEMU_UC_MCONTEXT_GREGS(uc, REG_ERR) >> 1) & 1 : 0,
|
||||||
&uc->uc_sigmask, puc);
|
&uc->uc_sigmask, puc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue