summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-18 00:13:31 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-18 00:25:02 +0200
commitd321dc0a7401e7fa0069df014927ed543cb21fd7 (patch)
tree213a4898dad17ee3214fb1bc1adeb9c4f8af2830
parent8ec8ec8b1c1fab6d48277b80fd187059b4a45be4 (diff)
downloadserenity-d321dc0a7401e7fa0069df014927ed543cb21fd7.zip
UserspaceEmulator: Fix too-wide accumulator used in 8/16 bit CMPXCHG
-rw-r--r--DevTools/UserspaceEmulator/SoftCPU.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp
index 4e2d6bc817..a6d23af9f2 100644
--- a/DevTools/UserspaceEmulator/SoftCPU.cpp
+++ b/DevTools/UserspaceEmulator/SoftCPU.cpp
@@ -1074,7 +1074,7 @@ void SoftCPU::CMPSW(const X86::Instruction& insn)
void SoftCPU::CMPXCHG_RM16_reg16(const X86::Instruction& insn)
{
auto current = insn.modrm().read16(*this, insn);
- if (current == eax()) {
+ if (current == ax()) {
set_zf(true);
insn.modrm().write16(*this, insn, gpr16(insn.reg16()));
} else {
@@ -1098,7 +1098,7 @@ void SoftCPU::CMPXCHG_RM32_reg32(const X86::Instruction& insn)
void SoftCPU::CMPXCHG_RM8_reg8(const X86::Instruction& insn)
{
auto current = insn.modrm().read8(*this, insn);
- if (current == eax()) {
+ if (current == al()) {
set_zf(true);
insn.modrm().write8(*this, insn, gpr8(insn.reg8()));
} else {