فهرست منبع

UserspaceEmulator: Implement XOR_RM32_reg32

Note that this is a partial implementation since we don't have support
for memory r/m variants yet.
Andreas Kling 5 سال پیش
والد
کامیت
8ab601f9e1
1فایلهای تغییر یافته به همراه15 افزوده شده و 1 حذف شده
  1. 15 1
      DevTools/UserspaceEmulator/SoftCPU.cpp

+ 15 - 1
DevTools/UserspaceEmulator/SoftCPU.cpp

@@ -519,7 +519,21 @@ void SoftCPU::XOR_RM16_imm8(const X86::Instruction&) { TODO(); }
 void SoftCPU::XOR_RM16_reg16(const X86::Instruction&) { TODO(); }
 void SoftCPU::XOR_RM32_imm32(const X86::Instruction&) { TODO(); }
 void SoftCPU::XOR_RM32_imm8(const X86::Instruction&) { TODO(); }
-void SoftCPU::XOR_RM32_reg32(const X86::Instruction&) { TODO(); }
+
+void SoftCPU::XOR_RM32_reg32(const X86::Instruction& insn)
+{
+    ASSERT(insn.modrm().is_register());
+    auto& dest = *m_reg32_table[insn.modrm().register_index()];
+    auto src = *m_reg32_table[insn.register_index()];
+    dest ^= src;
+
+    set_cf(false);
+    set_of(false);
+    set_zf(dest == 0);
+    set_sf(dest & 0x80000000);
+    // FIXME: set_pf
+}
+
 void SoftCPU::XOR_RM8_imm8(const X86::Instruction&) { TODO(); }
 void SoftCPU::XOR_RM8_reg8(const X86::Instruction&) { TODO(); }
 void SoftCPU::XOR_reg16_RM16(const X86::Instruction&) { TODO(); }