summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-11 23:28:58 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-11 23:57:14 +0200
commitbfacb9583a88d3681f4179d5e8ddf6d5c52e559e (patch)
tree2b8dd731010a7fab3558ce834a9c849d7adbde51 /DevTools
parenteb86264d3b7845c61f61a98c675032f0dd29768b (diff)
downloadserenity-bfacb9583a88d3681f4179d5e8ddf6d5c52e559e.zip
UserspaceEmulator: Implement RET_imm16
This is just like RET, but it also pops N bytes off the stack.
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/UserspaceEmulator/SoftCPU.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp
index c8d41abd48..1668b83607 100644
--- a/DevTools/UserspaceEmulator/SoftCPU.cpp
+++ b/DevTools/UserspaceEmulator/SoftCPU.cpp
@@ -1009,7 +1009,14 @@ void SoftCPU::RET(const X86::Instruction& insn)
void SoftCPU::RETF(const X86::Instruction&) { TODO(); }
void SoftCPU::RETF_imm16(const X86::Instruction&) { TODO(); }
-void SoftCPU::RET_imm16(const X86::Instruction&) { TODO(); }
+
+void SoftCPU::RET_imm16(const X86::Instruction& insn)
+{
+ ASSERT(!insn.has_operand_size_override_prefix());
+ set_eip(pop32());
+ set_esp(esp() + insn.imm16());
+}
+
void SoftCPU::ROL_RM16_1(const X86::Instruction&) { TODO(); }
void SoftCPU::ROL_RM16_CL(const X86::Instruction&) { TODO(); }
void SoftCPU::ROL_RM16_imm8(const X86::Instruction&) { TODO(); }