Windows and macOS both use thread slot 0x20, so fiber games crash under Wine
a day ago
- Windows and macOS both use thread slot 0x20, causing fiber-based games to crash under Wine on Macs.
- Two games, Marvel's Guardians of the Galaxy and Metaphor: ReFantazio, fail differently due to this slot conflict.
- The slot 0x20 is used by Windows for the current fiber pointer and by macOS for thread QoS priority.
- Wine copies some fields into macOS slots but cannot copy the fiber pointer because slot 0x20 is occupied.
- Failure one: a QoS class read as a fiber pointer causes a crash in Metaphor and Guardians.
- Failure two: a fiber pointer read as QoS class causes libdispatch faults in Metaphor.
- The fix swaps the slot content between Windows and macOS code at boundary crossings in ntdll.
- Initial patch version crashed due to register misuse, fixed by using rax and updating fast exit paths.
- After fix, both games run without faults at playable frame rates.
- Upstream Wine solved this differently in 10.5 by swapping the entire GS base, which Highball's engine lacks.
- Highball's engine uses the slot swap as a cheap fix until upstream change is integrated.