From 677af891b4f0add79b940a823898d52364c4ba32 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 14 Nov 2020 15:34:19 +0100 Subject: UserspaceEmulator: Implement FISUB_RM32 --- DevTools/UserspaceEmulator/SoftCPU.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'DevTools/UserspaceEmulator') diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp index ef469b0d7f..f8300527d9 100644 --- a/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -1657,7 +1657,20 @@ void SoftCPU::FCMOVBE(const X86::Instruction& insn) void SoftCPU::FICOMP_RM32(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FCMOVU(const X86::Instruction&) { TODO_INSN(); } -void SoftCPU::FISUB_RM32(const X86::Instruction&) { TODO_INSN(); } + +void SoftCPU::FISUB_RM32(const X86::Instruction& insn) +{ + if (insn.modrm().is_register()) { + fpu_set(0, fpu_get(insn.modrm().register_index()) - fpu_get(0)); + } else { + auto new_f32 = insn.modrm().read32(*this, insn); + // FIXME: Respect shadow values + auto f32 = bit_cast(new_f32.value()); + auto f64 = (double)f32; + fpu_set(0, fpu_get(0) - f64); + } +} + void SoftCPU::FISUBR_RM32(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FUCOMPP(const X86::Instruction&) { TODO_INSN(); } void SoftCPU::FIDIV_RM32(const X86::Instruction&) { TODO_INSN(); } -- cgit v1.2.3