mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
UserspaceEmulator: Check the right flags in FCMOV
Also make FCMOVNB do an actual CMOV and not a copy of FILD_m32
This commit is contained in:
parent
8108aaca39
commit
5d2a4bd18d
1 changed files with 8 additions and 7 deletions
|
@ -437,19 +437,20 @@ void SoftFPU::FCMOVB(const X86::Instruction& insn)
|
||||||
}
|
}
|
||||||
void SoftFPU::FCMOVNB(const X86::Instruction& insn)
|
void SoftFPU::FCMOVNB(const X86::Instruction& insn)
|
||||||
{
|
{
|
||||||
VERIFY(!insn.modrm().is_register());
|
VERIFY(insn.modrm().is_register());
|
||||||
auto m32int = (i32)insn.modrm().read32(m_cpu, insn).value();
|
if (!m_cpu.cf())
|
||||||
// FIXME: Respect shadow values
|
fpu_set(0, fpu_get(insn.modrm().rm()));
|
||||||
fpu_push((long double)m32int);
|
|
||||||
}
|
}
|
||||||
void SoftFPU::FCMOVBE(const X86::Instruction& insn)
|
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()));
|
fpu_set(0, fpu_get(insn.modrm().rm()));
|
||||||
}
|
}
|
||||||
void SoftFPU::FCMOVNBE(const X86::Instruction& insn)
|
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()));
|
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)
|
void SoftFPU::FCMOVNU(const X86::Instruction& insn)
|
||||||
{
|
{
|
||||||
VERIFY(insn.modrm().is_register());
|
VERIFY(insn.modrm().is_register());
|
||||||
if (m_cpu.pf())
|
if (!m_cpu.pf())
|
||||||
fpu_set(0, fpu_get((insn.modrm().reg_fpu())));
|
fpu_set(0, fpu_get((insn.modrm().reg_fpu())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue