diff options
author | Andreas Kling <kling@serenityos.org> | 2020-11-14 15:34:19 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-14 15:34:53 +0100 |
commit | 677af891b4f0add79b940a823898d52364c4ba32 (patch) | |
tree | 7d715b65d3203e3a947a20ead37260fcbaecc1a9 /DevTools/UserspaceEmulator | |
parent | ca85ecc032d8ee20ec5cdeafcb5a643e35f034d8 (diff) | |
download | serenity-677af891b4f0add79b940a823898d52364c4ba32.zip |
UserspaceEmulator: Implement FISUB_RM32
Diffstat (limited to 'DevTools/UserspaceEmulator')
-rw-r--r-- | DevTools/UserspaceEmulator/SoftCPU.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
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<float>(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(); } |