From 938a00ecf9de7358000d7a130c999964e21b2676 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 12 Jul 2020 01:31:33 +0200 Subject: [PATCH] UserspaceEmulator: Implement the CMOVcc instruction --- DevTools/UserspaceEmulator/SoftCPU.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp index b4ea8bfc75..5000e9654a 100644 --- a/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -719,8 +719,19 @@ void SoftCPU::CLD(const X86::Instruction&) { TODO(); } void SoftCPU::CLI(const X86::Instruction&) { TODO(); } void SoftCPU::CLTS(const X86::Instruction&) { TODO(); } void SoftCPU::CMC(const X86::Instruction&) { TODO(); } -void SoftCPU::CMOVcc_reg16_RM16(const X86::Instruction&) { TODO(); } -void SoftCPU::CMOVcc_reg32_RM32(const X86::Instruction&) { TODO(); } + +void SoftCPU::CMOVcc_reg16_RM16(const X86::Instruction& insn) +{ + if (evaluate_condition(insn.cc())) + gpr16(insn.reg16()) = insn.modrm().read16(*this, insn); +} + +void SoftCPU::CMOVcc_reg32_RM32(const X86::Instruction& insn) +{ + if (evaluate_condition(insn.cc())) + gpr32(insn.reg32()) = insn.modrm().read32(*this, insn); +} + void SoftCPU::CMPSB(const X86::Instruction&) { TODO(); } void SoftCPU::CMPSD(const X86::Instruction&) { TODO(); } void SoftCPU::CMPSW(const X86::Instruction&) { TODO(); }