mirror of
https://github.com/ptitSeb/box64.git
synced 2024-11-23 06:30:22 +00:00
Improved getcontext/setcontext ([BOX32] too)
Some checks are pending
Build and Release Box64 / build (ubuntu-latest, ANDROID, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ANDROID, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, TERMUX, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, TERMUX, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, X64, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, X64, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, X64, Trace) (push) Waiting to run
Some checks are pending
Build and Release Box64 / build (ubuntu-latest, ANDROID, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ANDROID, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, ARM64, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, LARCH64, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RISCV, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, StaticBuild) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, RK3588, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, TERMUX, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, TERMUX, Trace) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, X64, Box32) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, X64, Release) (push) Waiting to run
Build and Release Box64 / build (ubuntu-latest, X64, Trace) (push) Waiting to run
This commit is contained in:
parent
f292be40b2
commit
7a623ef19c
@ -863,8 +863,8 @@ EXPORT int my32_getcontext(x64emu_t* emu, void* ucp)
|
||||
u->uc_mcontext.gregs[I386_CS] = R_CS;
|
||||
u->uc_mcontext.gregs[I386_SS] = R_SS;
|
||||
// get FloatPoint status
|
||||
if(u->uc_mcontext.fpregs)
|
||||
save_fpreg(emu, from_ptrv(u->uc_mcontext.fpregs));
|
||||
u->uc_mcontext.fpregs = to_ptrv(ucp + 236); // magic offset of fpregs in an actual i386 u_context
|
||||
fpu_savenv(emu, from_ptrv(u->uc_mcontext.fpregs), 1); // 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
|
||||
@ -898,8 +898,7 @@ EXPORT int my32_setcontext(x64emu_t* emu, void* ucp)
|
||||
R_CS = u->uc_mcontext.gregs[I386_CS];
|
||||
R_SS = u->uc_mcontext.gregs[I386_SS];
|
||||
// set FloatPoint status
|
||||
if(u->uc_mcontext.fpregs)
|
||||
load_fpreg(emu, from_ptrv(u->uc_mcontext.fpregs));
|
||||
fpu_loadenv(emu, from_ptrv(u->uc_mcontext.fpregs), 1);
|
||||
// set signal mask
|
||||
sigprocmask(SIG_SETMASK, (sigset_t*)&u->uc_sigmask, NULL);
|
||||
// set uc_link
|
||||
|
@ -2243,8 +2243,10 @@ EXPORT int my_getcontext(x64emu_t* emu, void* ucp)
|
||||
// get segments
|
||||
u->uc_mcontext.gregs[X64_CSGSFS] = ((uint64_t)(R_CS)) | (((uint64_t)(R_GS))<<16) | (((uint64_t)(R_FS))<<32);
|
||||
// get FloatPoint status
|
||||
u->uc_mcontext.fpregs = &u->xstate;
|
||||
fpu_fxsave64(emu, &u->xstate);
|
||||
u->uc_mcontext.fpregs = ucp + 408;
|
||||
fpu_savenv(emu, (void*)u->uc_mcontext.fpregs, 1);
|
||||
*(uint32_t*)(ucp + 432) = emu->mxcsr.x32;
|
||||
|
||||
// get signal mask
|
||||
sigprocmask(SIG_SETMASK, NULL, (sigset_t*)&u->uc_sigmask);
|
||||
// ensure uc_link is properly initialized
|
||||
@ -2283,7 +2285,8 @@ EXPORT int my_setcontext(x64emu_t* emu, void* ucp)
|
||||
R_GS = (u->uc_mcontext.gregs[X64_CSGSFS]>>16)&0xffff;
|
||||
R_FS = (u->uc_mcontext.gregs[X64_CSGSFS]>>32)&0xffff;
|
||||
// set FloatPoint status
|
||||
fpu_fxrstor64(emu, &u->xstate);
|
||||
fpu_loadenv(emu, (void*)u->uc_mcontext.fpregs, 1);
|
||||
emu->mxcsr.x32 = *(uint32_t*)(ucp + 432);
|
||||
// set signal mask
|
||||
sigprocmask(SIG_SETMASK, (sigset_t*)&u->uc_sigmask, NULL);
|
||||
// set uc_link
|
||||
|
Loading…
Reference in New Issue
Block a user