From 69a021454a52d0729ed96b66220427f54cb21ec1 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 8 Nov 2024 16:19:58 +0100 Subject: [PATCH] Adjusted getcontext / setcontext wrapped functons (should help #1012) --- src/libtools/signals.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libtools/signals.c b/src/libtools/signals.c index 05e8cecfb..4df2644fc 100755 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -1380,8 +1380,8 @@ EXPORT int my_getcontext(x86emu_t* emu, void* ucp) u->uc_mcontext.gregs[REG_CS] = R_CS; u->uc_mcontext.gregs[REG_SS] = R_SS; // get FloatPoint status - if(u->uc_mcontext.fpregs) - save_fpreg(emu, u->uc_mcontext.fpregs); + u->uc_mcontext.fpregs = ucp + 236; // magic offset of fpregs in an actual i386 u_context + fpu_savenv(emu, (void*)u->uc_mcontext.fpregs, 0); // it seems getcontext only save fpu env, not fpu regs // get signal mask sigprocmask(SIG_SETMASK, NULL, (sigset_t*)&u->uc_sigmask); // ensure uc_link is properly initialized @@ -1416,7 +1416,7 @@ EXPORT int my_setcontext(x86emu_t* emu, void* ucp) R_SS = u->uc_mcontext.gregs[REG_SS]; // set FloatPoint status if(u->uc_mcontext.fpregs) - load_fpreg(emu, u->uc_mcontext.fpregs); + fpu_loadenv(emu, (void*)u->uc_mcontext.fpregs, 0); // set signal mask sigprocmask(SIG_SETMASK, (sigset_t*)&u->uc_sigmask, NULL); // set uc_link