FEX-Emu / FEX

A fast usermode x86 and x86-64 emulator for Arm64 Linux
https://fex-emu.com
MIT License
2.09k stars 117 forks source link

MMX/x87 interaction is subtly broken #3850

Open alyssarosenzweig opened 2 months ago

alyssarosenzweig commented 2 months ago

MMX is supposed to set the upper bits of the 80-bit x87 register to -1, and also supposed to set certain x87 flags. FEX isn't doing either. I don't know of any applications that rely on this behaviour, but Intel documents it explicitly.

alyssarosenzweig commented 2 months ago

see https://github.com/FEX-Emu/FEX/pull/3808/commits/dca0906c35da3b335bec41ce2aca2292e68709af for what prompted this. FEX is currently implicitly inserting without touching the upper bits, which is wrong. With that commit, FEX explicitly inserts and explicitly preserves the upper bits, which is slow and just as wrong.

pmatos commented 7 hours ago

Due to a couple of other blockers, I might look into this earlier than I thought I would.