FEX Awaits The Linux Kernel To Align With Windows & macOS On ARM Register Usage

FEX 2611 is out for running Linux (and Wine) x86/x86_64 games/applications on AArch64 Linux. FEX 2611 brings JIT improvements while also waiting for the Linux kernel to align with the AArch64 specification and Windows on ARM and macOS Apple Silicon behavior around a particular register's usage. FEX developers are getting ready for hopefully seeing the Linux kernel align its usage of the TPIDRRO_EL0 ARM system register with Windows and macOS.. The Arm documentation notes that the TPIDRRO_EL0 register is used for storing CPU thread identifying information where the software is executing for OS management purposes. Both Windows on ARM and macOS use this register to contain the current CPU core index so user-space software can quickly and easily note what CPU core the user-space application/game is executing on. But under Linux, TPIDRRO_EL0 always returns zero. Thus the FEX emulator needs to use a getcpu system call instead for reliably providing the CPU core index. Linux has returned zero since some ARM CPU vendors have messed up the register and reserving the register for other possible future use. "So what are we to do? ARM64 WINE applications need this register to be ABI compliant and FEX would like to use it for faster emulation of RDPID/RDTSCP/CPUID. What does Linux do for this register? Turns out in the 15 years since ARM64 was introduced, the Linux kernel has hardcoded this register to always be zero and be reserved for future work. Simple enough then would be to send a patch upstream to set the register to the core index just like Windows." But that's easier said then done with Igalia having sent out a patch back in August for reporting the running CPU of a native task in TPIDRRO_EL0. ARM Linux developer WIll Deacon remarked that using TPIDRRO_EL0 for that purpose would prevent its use from anything else in the future, even though this would match the behavior with Windows and macOS. In any case FEX developers are preparing to have FEX ready so that if/when the patch is mainlined in the Linux kernel, FEX will be ready for using TPIDRRO_EL0. This in turn will address some modern game issues with FEX while also helping with performance: "In particular this register is required for when FEX is running under WINE because we can’t use Linux syscalls properly there so we couldn’t safely or easily emulate RDPID/RDTSC, so we just disabled those instructions. Problem is that games are starting to mandate these instructions so we were stuck in a bit of a hard spot. This ends up being a combination of correctness and performance improvements! Win-win!" As for other FEX 2611 changes, a lot of continued work around its JIT. All the details can be found on the FEX-Emu.com blog.

Original Source

Read the full article at Phoronix →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.