mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 10:00:42 +02:00
Fixes bug in PUSH op with RSP source.
We were modifying RSP to adjust the stack first. Then if the source used RSP then it was offset by the store size. `push [rsp]` was broken before this
This commit is contained in:
1 parent
2df55d303a
commit
3f06f3e87d
1 file changed
+9
-9
@@ -193,15 +193,6 @@ void OpDispatchBuilder::SBBOp(OpcodeArgs) {
|
||||
|
||||
void OpDispatchBuilder::PUSHOp(OpcodeArgs) {
|
||||
uint8_t Size = GetSrcSize(Op);
|
||||
auto Constant = _Constant(Size);
|
||||
|
||||
auto OldSP = _LoadContext(8, offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RSP]));
|
||||
|
||||
auto NewSP = _Sub(OldSP, Constant);
|
||||
|
||||
// Store the new stack pointer
|
||||
_StoreContext(8, offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RSP]), NewSP);
|
||||
|
||||
OrderedNode *Src;
|
||||
if (Op->OP == 0x68 || Op->OP == 0x6A) { // Immediate Push
|
||||
Src = LoadSource(Op, Op->Src1, Op->Flags, -1);
|
||||
@@ -211,6 +202,15 @@ void OpDispatchBuilder::PUSHOp(OpcodeArgs) {
|
||||
Src = LoadSource(Op, Op->Dest, Op->Flags, -1);
|
||||
}
|
||||
|
||||
auto Constant = _Constant(Size);
|
||||
|
||||
auto OldSP = _LoadContext(8, offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RSP]));
|
||||
|
||||
auto NewSP = _Sub(OldSP, Constant);
|
||||
|
||||
// Store the new stack pointer
|
||||
_StoreContext(8, offsetof(FEXCore::Core::CPUState, gregs[FEXCore::X86State::REG_RSP]), NewSP);
|
||||
|
||||
// Store our value to the new stack location
|
||||
_StoreMem(Size, NewSP, Src, Size);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user