Skip to content

Commit

Permalink
Adjusted getcontext / setcontext wrapped functons (should help #1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Nov 8, 2024
1 parent 336dc5b commit 69a0214
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libtools/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 69a0214

Please sign in to comment.