diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-09-05 19:12:11 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-09-05 19:12:19 +0200 |
| commit | 19dc18f7c51bcef6f8ec00f3521b8f3e8541e96c (patch) | |
| tree | 62652e5f66ff6a1dcc9274b7a021011675914bb0 /src/emu | |
| parent | 4e63b82f5eda8995a2b5cd09d64304ac9e30dbd6 (diff) | |
| download | box64-19dc18f7c51bcef6f8ec00f3521b8f3e8541e96c.tar.gz box64-19dc18f7c51bcef6f8ec00f3521b8f3e8541e96c.zip | |
Fixed a regression introduced with box32 that broke Bladur's Gate 3 (and probably a few other)
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64run0f.c | 12 | ||||
| -rw-r--r-- | src/emu/x87emu_private.c | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c index 1e54db04..d81a9d12 100644 --- a/src/emu/x64run0f.c +++ b/src/emu/x64run0f.c @@ -1242,18 +1242,18 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) #ifdef TEST_INTERPRETER emu->sw.f.F87_TOP = emu->top&7; #else - if(rex.w) - fpu_fxsave64(emu, ED); - else + if(rex.is32bits) fpu_fxsave32(emu, ED); + else + fpu_fxsave64(emu, ED); #endif break; case 1: /* FXRSTOR Ed */ _GETED(0); - if(rex.w) - fpu_fxrstor64(emu, ED); - else + if(rex.is32bits) fpu_fxrstor32(emu, ED); + else + fpu_fxrstor64(emu, ED); break; case 2: /* LDMXCSR Md */ GETED(0); diff --git a/src/emu/x87emu_private.c b/src/emu/x87emu_private.c index c64f49cb..b5894d97 100644 --- a/src/emu/x87emu_private.c +++ b/src/emu/x87emu_private.c @@ -295,6 +295,7 @@ void fpu_savenv(x64emu_t* emu, char* p, int b16) // other stuff are not pushed.... } +// this is the 64bits version (slightly different than the 32bits!) typedef struct xsave32_s { uint16_t ControlWord; /* 000 */ uint16_t StatusWord; /* 002 */ @@ -311,9 +312,8 @@ typedef struct xsave32_s { uint32_t MxCsr_Mask; /* 01c */ sse_regs_t FloatRegisters[8];/* 020 */ // fpu/mmx are store in 128bits here sse_regs_t XmmRegisters[8]; /* 0a0 */ - uint8_t Reserved4[56*4]; /* 1a0 */ + uint8_t Reserved4[56*4]; /* 120 */ } xsave32_t; -// this is the 64bits version (slightly different than the 32bits!) typedef struct xsave64_s { uint16_t ControlWord; /* 000 */ uint16_t StatusWord; /* 002 */ @@ -359,6 +359,7 @@ void fpu_fxsave32(x64emu_t* emu, void* ed) void fpu_fxsave64(x64emu_t* emu, void* ed) { + // the subtelties of the REX.W are not handled in fxsave64/fxrstor64 xsave64_t *p = (xsave64_t*)ed; // should save flags & all int top = emu->top&7; @@ -409,6 +410,7 @@ void fpu_fxrstor32(x64emu_t* emu, void* ed) void fpu_fxrstor64(x64emu_t* emu, void* ed) { + // the subtelties of the REX.W are not handled in fxsave64/fxrstor64 xsave64_t *p = (xsave64_t*)ed; emu->cw.x16 = p->ControlWord; emu->sw.x16 = p->StatusWord; |