Forráskód Böngészése

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.
Andreas Kling 5 éve
szülő
commit
d0dbf92c8d
1 módosított fájl, 5 hozzáadás és 4 törlés
  1. 5 4
      DevTools/UserspaceEmulator/Emulator.cpp

+ 5 - 4
DevTools/UserspaceEmulator/Emulator.cpp

@@ -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;
 }