diff options
author | Hendiadyoin1 <leon2002.la@gmail.com> | 2021-07-23 00:44:00 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-11-07 22:42:23 +0000 |
commit | 5d2a4bd18d5efac430d89c7e3d2a4645254c7645 (patch) | |
tree | b7018ef64c60acea57779e7915ba3f4bf7142b85 /Userland/DevTools | |
parent | 8108aaca394062fb2c9b52332ae514e62474d8bc (diff) | |
download | serenity-5d2a4bd18d5efac430d89c7e3d2a4645254c7645.zip |
UserspaceEmulator: Check the right flags in FCMOV
Also make FCMOVNB do an actual CMOV and not a copy of FILD_m32
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/SoftFPU.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp index 2daf44bd7d..00c91cd046 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp @@ -437,19 +437,20 @@ void SoftFPU::FCMOVB(const X86::Instruction& insn) } void SoftFPU::FCMOVNB(const X86::Instruction& insn) { - VERIFY(!insn.modrm().is_register()); - auto m32int = (i32)insn.modrm().read32(m_cpu, insn).value(); - // FIXME: Respect shadow values - fpu_push((long double)m32int); + VERIFY(insn.modrm().is_register()); + if (!m_cpu.cf()) + fpu_set(0, fpu_get(insn.modrm().rm())); } void SoftFPU::FCMOVBE(const X86::Instruction& insn) { - if (m_cpu.cf() | m_cpu.zf()) + VERIFY(insn.modrm().is_register()); + if (m_cpu.cf() || m_cpu.zf()) fpu_set(0, fpu_get(insn.modrm().rm())); } void SoftFPU::FCMOVNBE(const X86::Instruction& insn) { - if (!(m_cpu.cf() | m_cpu.zf())) + VERIFY(insn.modrm().is_register()); + if (!(m_cpu.cf() || m_cpu.zf())) fpu_set(0, fpu_get(insn.modrm().rm())); } @@ -462,7 +463,7 @@ void SoftFPU::FCMOVU(const X86::Instruction& insn) void SoftFPU::FCMOVNU(const X86::Instruction& insn) { VERIFY(insn.modrm().is_register()); - if (m_cpu.pf()) + if (!m_cpu.pf()) fpu_set(0, fpu_get((insn.modrm().reg_fpu()))); } |