Browse Source

UserspaceEmulator: Implement the XLAT instruction :^)

Andreas Kling 5 years ago
parent
commit
af7a1eca0b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      DevTools/UserspaceEmulator/SoftCPU.cpp

+ 5 - 1
DevTools/UserspaceEmulator/SoftCPU.cpp

@@ -2126,7 +2126,11 @@ void SoftCPU::XCHG_reg8_RM8(const X86::Instruction& insn)
     gpr8(insn.reg8()) = temp;
 }
 
-void SoftCPU::XLAT(const X86::Instruction&) { TODO(); }
+void SoftCPU::XLAT(const X86::Instruction& insn)
+{
+    u32 offset = (insn.a32() ? ebx() : bx()) + al();
+    set_al(read_memory8({ segment(insn.segment_prefix().value_or(X86::SegmentRegister::DS)), offset }));
+}
 
 #define DEFINE_GENERIC_INSN_HANDLERS_PARTIAL(mnemonic, op, update_dest)                                                   \
     void SoftCPU::mnemonic##_AL_imm8(const X86::Instruction& insn) { generic_AL_imm8<update_dest>(op<u8>, insn); }        \