diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-26 20:33:16 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-26 20:33:16 +0000 |
commit | 84778508d7403cd32fb4527550738f19aa7b1aa5 (patch) | |
tree | 2a24173f54e272d48f844d6caeefa9b3acf76c9b /cpu-exec.c | |
parent | 46f42f2940bc6912b85d616ad6c8fcfe024153f6 (diff) | |
download | qemu-84778508d7403cd32fb4527550738f19aa7b1aa5.tar.gz qemu-84778508d7403cd32fb4527550738f19aa7b1aa5.tar.bz2 qemu-84778508d7403cd32fb4527550738f19aa7b1aa5.zip |
Preliminary BSD user emulator support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5544 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r-- | cpu-exec.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cpu-exec.c b/cpu-exec.c index 6d4dcdd168..d31a67aa4d 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -34,8 +34,10 @@ #undef EDI #undef EIP #include <signal.h> +#ifdef __linux__ #include <sys/ucontext.h> #endif +#endif #if defined(__sparc__) && !defined(HOST_SOLARIS) // Work around ugly bugs in glibc that mangle global register contents @@ -66,7 +68,11 @@ void cpu_loop_exit(void) void cpu_resume_from_signal(CPUState *env1, void *puc) { #if !defined(CONFIG_SOFTMMU) +#ifdef __linux__ struct ucontext *uc = puc; +#elif defined(__OpenBSD__) + struct sigcontext *uc = puc; +#endif #endif env = env1; @@ -76,7 +82,11 @@ void cpu_resume_from_signal(CPUState *env1, void *puc) #if !defined(CONFIG_SOFTMMU) if (puc) { /* XXX: use siglongjmp ? */ +#ifdef __linux__ sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL); +#elif defined(__OpenBSD__) + sigprocmask(SIG_SETMASK, &uc->sc_mask, NULL); +#endif } #endif longjmp(env->jmp_env, 1); @@ -1328,9 +1338,15 @@ int cpu_signal_handler(int host_signum, void *pinfo, /* XXX: is there a standard glibc define ? */ unsigned long pc = regs[1]; #else +#ifdef __linux__ struct sigcontext *sc = puc; unsigned long pc = sc->sigc_regs.tpc; void *sigmask = (void *)sc->sigc_mask; +#elif defined(__OpenBSD__) + struct sigcontext *uc = puc; + unsigned long pc = uc->sc_pc; + void *sigmask = (void *)(long)uc->sc_mask; +#endif #endif /* XXX: need kernel patch to get write flag faster */ |