Merge pull request #3960 from Sonicadvance1/remove_bad_rep_assumption

OpcodeDispatcher: Remove old bad assumption in INC/DEC
This commit is contained in:
Mai 2024-08-15 15:42:47 -04:00 committed by GitHub
commit c634c53434
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 12 deletions

View File

@ -3055,12 +3055,6 @@ void OpDispatchBuilder::RDTSCOp(OpcodeArgs) {
}
void OpDispatchBuilder::INCOp(OpcodeArgs) {
if (Op->Flags & FEXCore::X86Tables::DecodeFlags::FLAG_REP_PREFIX) {
LogMan::Msg::EFmt("Can't handle REP on this");
DecodeFailure = true;
return;
}
Ref Dest;
Ref Result;
const auto Size = GetSrcBitSize(Op);
@ -3102,12 +3096,6 @@ void OpDispatchBuilder::INCOp(OpcodeArgs) {
}
void OpDispatchBuilder::DECOp(OpcodeArgs) {
if (Op->Flags & FEXCore::X86Tables::DecodeFlags::FLAG_REP_PREFIX) {
LogMan::Msg::EFmt("Can't handle REP on this");
DecodeFailure = true;
return;
}
Ref Dest;
Ref Result;
const auto Size = GetSrcBitSize(Op);

View File

@ -0,0 +1,33 @@
%ifdef CONFIG
{
"RegData": {
"RBX": "0",
"RCX": "8",
"RDX": "0",
"RSP": "0"
}
}
%endif
; FEX-Emu had a bug where it thought repeat worked on increment and decrement instructions.
; While the prefix can be encoded on the instructions, it is ignored by the hardware implementation.
; This checks to ensure that inc/dec ignore the repeat prefix, and that rcx isn't ever changed from it.
mov rsp, 0
mov rcx, 8
lea rax, [rel .test]
rep inc rsp
rep inc byte [rax]
rep dec rsp
rep dec byte [rax]
mov rbx, [rel .test]
mov rdx, [rel .test + 8]
hlt
.test:
db 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0