summaryrefslogtreecommitdiff
path: root/Userland/DevTools/UserspaceEmulator
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-08-14 13:47:41 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-14 18:42:14 +0200
commit09cef25e921a47bbf203dad951df80404ae8b2f5 (patch)
treea0d9cafe04d49b570c33b6fefb45b7e1e419853e /Userland/DevTools/UserspaceEmulator
parentbfe5509a28033c844e942ebc79337c9d876b4746 (diff)
downloadserenity-09cef25e921a47bbf203dad951df80404ae8b2f5.zip
UserspaceEmulator: Make call rm32 work with address on the stack
Previously, we pushed the old `eip` on the stack before reading the new address, which made us jump to the wrong place if the destination was relative to the `esp`.
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator')
-rw-r--r--Userland/DevTools/UserspaceEmulator/SoftCPU.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp
index 32df7ddbd5..43d09d453d 100644
--- a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp
+++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp
@@ -1176,8 +1176,8 @@ void SoftCPU::CALL_RM16(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::CALL_RM32(const X86::Instruction& insn)
{
- push32(shadow_wrap_as_initialized(eip()));
auto address = insn.modrm().read32(*this, insn);
+ push32(shadow_wrap_as_initialized(eip()));
warn_if_uninitialized(address, "call rm32");
set_eip(address.value());
// FIXME: this won't catch at the moment due to us not having a way to set