1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

UserspaceEmulator: Break out of emulation when hitting a RET

Until we learn more instructions, we'll have to exit somewhere, so let
us exit when we hit a RET instruction for now.
This commit is contained in:
Andreas Kling 2020-07-07 21:34:08 +02:00
parent 8d8bb07476
commit d0dbf92c8d

View file

@ -43,15 +43,16 @@ int Emulator::exec(X86::SimpleInstructionStream& stream, u32 base)
size_t offset = 0;
while (!m_shutdown) {
auto insn = X86::Instruction::from_stream(stream, true, true);
out() << "instruction: " << insn.to_string(base + offset);
out() << "\033[33;1m" << insn.to_string(base + offset) << "\033[0m";
// FIXME: Remove this hack once it's no longer needed :^)
if (insn.mnemonic() == "RET")
break;
(m_cpu.*insn.handler())(insn);
m_cpu.dump();
offset += insn.length();
if (insn.mnemonic() == "RET")
break;
}
return m_exit_status;
}