summaryrefslogtreecommitdiff
path: root/Userland/DevTools/UserspaceEmulator/Emulator.cpp
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2022-12-10 20:00:09 +0200
committerAndreas Kling <kling@serenityos.org>2022-12-11 22:06:30 +0100
commit108a8e4c886be9a0a9e1aa53dce8db838b01f4a4 (patch)
treef83db1fbbf213cd56a9d87b573d9302cc7783659 /Userland/DevTools/UserspaceEmulator/Emulator.cpp
parent9a136e354d63c32c2471f473b1fed0cf3db9abde (diff)
downloadserenity-108a8e4c886be9a0a9e1aa53dce8db838b01f4a4.zip
LibX86: Only pass ProcessorMode to Instruction constructor
We previously passed both OperandSize and AddressSize to the constructor. Both values were only ever 32-bit at construction. We used AddressSize::Size64 to signify Long mode which was needlessly complicated.
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator/Emulator.cpp')
-rw-r--r--Userland/DevTools/UserspaceEmulator/Emulator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp
index 4c60a12c5a..e694ad305f 100644
--- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp
+++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp
@@ -234,7 +234,7 @@ int Emulator::exec()
while (!m_shutdown) {
if (m_steps_til_pause) [[likely]] {
m_cpu->save_base_eip();
- auto insn = X86::Instruction::from_stream(*m_cpu, X86::OperandSize::Size32, X86::AddressSize::Size32);
+ auto insn = X86::Instruction::from_stream(*m_cpu, X86::ProcessorMode::Protected);
// Exec cycle
if constexpr (trace) {
outln("{:p} \033[33;1m{}\033[0m", m_cpu->base_eip(), insn.to_deprecated_string(m_cpu->base_eip(), symbol_provider));
@@ -301,7 +301,7 @@ void Emulator::handle_repl()
// FIXME: Function names (base, call, jump)
auto saved_eip = m_cpu->eip();
m_cpu->save_base_eip();
- auto insn = X86::Instruction::from_stream(*m_cpu, X86::OperandSize::Size32, X86::AddressSize::Size32);
+ auto insn = X86::Instruction::from_stream(*m_cpu, X86::ProcessorMode::Protected);
// FIXME: This does not respect inlining
// another way of getting the current function is at need
if (auto symbol = symbol_at(m_cpu->base_eip()); symbol.has_value()) {
@@ -311,7 +311,7 @@ void Emulator::handle_repl()
outln("==> {}", create_instruction_line(m_cpu->base_eip(), insn));
for (int i = 0; i < 7; ++i) {
m_cpu->save_base_eip();
- insn = X86::Instruction::from_stream(*m_cpu, X86::OperandSize::Size32, X86::AddressSize::Size32);
+ insn = X86::Instruction::from_stream(*m_cpu, X86::ProcessorMode::Protected);
outln(" {}", create_instruction_line(m_cpu->base_eip(), insn));
}
// We don't want to increase EIP here, we just want the instructions