mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
Preliminary BSD user emulator support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5544 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
46f42f2940
commit
84778508d7
24 changed files with 5943 additions and 1 deletions
16
cpu-exec.c
16
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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue