summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-18 00:14:29 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-18 00:25:02 +0200
commitc3441719eac25f3310974436a849d6bc92c7cfdd (patch)
tree8f5db163f9be3fe3c48db1f76966f6f859a6e65a
parentd321dc0a7401e7fa0069df014927ed543cb21fd7 (diff)
downloadserenity-c3441719eac25f3310974436a849d6bc92c7cfdd.zip
UserspaceEmulator: Implement the JCXZ instruction
-rw-r--r--DevTools/UserspaceEmulator/SoftCPU.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp
index a6d23af9f2..d65dcad0e6 100644
--- a/DevTools/UserspaceEmulator/SoftCPU.cpp
+++ b/DevTools/UserspaceEmulator/SoftCPU.cpp
@@ -1289,7 +1289,13 @@ void SoftCPU::IN_AX_imm8(const X86::Instruction&) { TODO(); }
void SoftCPU::IN_EAX_DX(const X86::Instruction&) { TODO(); }
void SoftCPU::IN_EAX_imm8(const X86::Instruction&) { TODO(); }
void SoftCPU::IRET(const X86::Instruction&) { TODO(); }
-void SoftCPU::JCXZ_imm8(const X86::Instruction&) { TODO(); }
+
+void SoftCPU::JCXZ_imm8(const X86::Instruction& insn)
+{
+ if ((insn.a32() && ecx() == 0) || (!insn.a32() && cx() == 0))
+ set_eip(eip() + (i8)insn.imm8());
+}
+
void SoftCPU::JMP_FAR_mem16(const X86::Instruction&) { TODO(); }
void SoftCPU::JMP_FAR_mem32(const X86::Instruction&) { TODO(); }
void SoftCPU::JMP_RM16(const X86::Instruction&) { TODO(); }