Skip to content

FEX-2206

Compare
Choose a tag to compare
@Sonicadvance1 Sonicadvance1 released this 04 Jun 22:46
· 6868 commits to main since this release

Read the blog post at FEX-Emu's Site!

Quite a large amount of changes this month since we cancelled last month's release.

Steam's webhelper working again

Steam started enabling the chromium sandbox. Seccomp isn't supported in FEX-Emu so it was crashing early on.
Forcibly disable it trying to use the sandbox using an application profile.
This lets the game library be visible again, although it can take a while to appear.

Fix LRCPC and add support for LRCPC2

There was a bug in our CMPXCHG implementation that wasn't using ARM's acquire-release semantics accidentally.
Fixing this bug allowed us to reenable our TSO emulation using LRCPC.
Additionally we have added support for LRCPC2 which gives us some immediate encoded instructions to further reduce overhead.

On hardware that supports LRCPC these can result in a reasonable performance uplift.

SHA-1 and SHA-256 instructions implemented

These SHA instruction have been implemented and the CPUID bit is now exposed.
This is a GPR based implementation, an implementation using AArch64's equivalent SHA instructions will be implemented at a later time.

Self-modifying code support improvements

Many things have changed with supporting self-modifying code in a more extensive fashion.
FEX-Emu will now tracking guest allocations of executable memory and when the code has been modified, we will clear the JIT caches.
This happens for both true self-modifying code and also libraries being loaded.
Fault handling is employed to know when code is modified in memory to ensure we can tracak changes.
This is a new setting in FEXConfig called mtrack. The older syscall only tracking path is deprecated but still available for testing.

Option to emulate x87 with 64-bit float operations

Big shout out to CallumDev for implementing this long awaited feature.

A major performance problem of emulating x86 is any older game will be compiled to use the x87 extension. This is especially true for 32-bit games.
The problem with this extension is that by default it uses 80-bit floats, which AArch64 doesn't support.
We end up emulating this entire extension using a soft-float implementaiton, which while being quite accurate, is obscenely slow.

This performance hack is now available to remove a significant amount of the overhead by operating x87 instructions using 64-bit float scalar
operations instead.
This is known to be inaccurate, but most Windows games will actually be configuring the x87 unit to be lower precision than 80-bit.
Additionally most games don't actually need the extra precision that 80-bit provides, so it is usually safe to emulate it more inaccurately.

This may still have some bugs, we know at least one game that has issues that aren't explained by pure precision problems. The feature can be enabled
in FEXConfig under the Hacks tab, look for "X87 Reduced Precision"

Clone3 syscall fixed

With Glibc 2.34 released, this project has started using the clone3 syscall for creating threads.
FEX's implementation was mostly untested which resulted in all applications breaking.
Stack pointer behaviour was broken and now with this fixed, glibc 2.34 now works out of the box.

FEXRootFSFetcher don't try to continue download

FEX-Emu's CDN doesn't support continuing file downloads. Disable to not cause issues.

FEXCore: Reclaimable thread pool allocator

FEXCore now uses an intrusive pooling allocator to allow sleeping threads to give back memory to the pool.
This allows multiple threads to share a memory resource, reducing memory usage by a significant amount if an application has a bunch of sleeping
threads.

FEXBash: Set PS1 environment variable to show running under emulation

Once running FEXBash it can be hard to tell if you're running your bash terminal under emulation.
Setting PS1 to FEXBash> makes it easier to tell that the terminal is running under emulation.

FEXBash> uname -a

Linux ryanh-TR2 5.17.5 #FEX-2206 SMP Jun 4 2022 15:11:07 x86_64 x86_64 x86_64 GNU/Linux

OpcodeDispatcher: Fixes PEXTRB

Newer Unreal engine releases were generating a PEXTRB instruction that our frontend decoder was decoding incorrectly.
Typically this would result in a crash.
This fixes both Dirt 4 and Psychonauts 2.

Misc

  • CMake
    • Add support for mold
    • Add flag for defined signed overflow handling
  • Arm64: Optimize constant generation with ADRP+ADR
  • EmulatedFiles: Fixes temporary file generation flags
  • Struct Verifier: Fixes some bugs with DRM headers not getting picked up
  • Linux v5.17 and v5.18 support
  • JIT: Code relocation support
  • OpcodeDispatcher:
    • Adds support for non-temporal loadstores
    • Implements support for PAUSE instruction
  • Syscalls:
    • 32-bit mmap syscalls fixes
      • Has been broken since the start, most applications use mmap2 instead
      • Fixes Kega Fusion
  • CompileService: Removed since it is no longer required
    • We no longer try to compile in a reentrant safe fashion
  • JITSymbols: Cleaner printing of RIP relative to a file
  • Standard TODO markers for code searching
  • Some 32-bit FS/GS writing fixes
    • Not really used so didn't affect anything

Raw Changes

FEX Release FEX-2206

  • AOTIR

  • copy RAData and IRList, make sure data is accessible (da2e44d)

  • AppConfig

  • Inject --no-sandbox in to steamwebhelper (c14c0c2)

  • ArchHelpers

  • Adds relocation struct defines (b5ae9e4)

  • Arm64

  • Fix LDAPUR/STLUR DMB backpatch (27f2e0b)

  • Adds support for RCPC2 extension (f8ba373)

  • Fixes AtomicSwap (70988cc)

  • Arm64Emitter

  • Optimize constants with ADRP and ADR (912dbfe)

  • CMake

  • C/C++ flags for defined singed overflow warping (2e05349)

  • Add option to use the mold linker (5884114)

  • CompileService

  • Removes no longer necessary service thread (b1033ed)

  • Config

  • Adds code cache config option (278ca52)

  • Core

  • Adds Code Object Cache service (13f3c6e)

  • context-wide guest code invalidations (d810988)

  • EmulatedFiles

  • Fixes temporary file flags (4fbc266)

  • F64

  • Implement FCW using host rounding mode (db3854e)

  • Fix FILD and FIST for Size < 8 (89d6752)

  • FEXBash

  • Set PS1 to make it more obvious when running under FEX (ec38d58)

  • FEXCore

  • Adds refcount_shared_mutex class (1e597bf)

  • Reclaimable thread pool allocator (8a7f395)

  • FEXLoader

  • Fix create_directories check for aotir .path file writting (90f338d)

  • FEXLogServer

  • Stop improper use of std::erase_if (d523b7a)

  • FEXRootFSFetcher

  • Don't continue download (fa87c73)

  • JitSymbols

  • Print file+offset if possible (a715627)

  • Linux

  • Fixes 32-bit mmap (3fd136b)

  • MemAllocator32Bit

  • Add missing lock to shmdt, fix error returns (b2b4c2b)

  • OpcodeDispatcher

  • Implement SHA256 instructions (3bbff8a)

  • Handle SHA-1 instructions (8dd9a5b)

  • Implements support for PAUSE (da48020)

  • Fixes pextrb with high registers (fe11bd2)

  • Remove debugging dump statement (c8dc663)

  • Adds support for non-temporal loadstores (ba78dff)

  • ScopedSignalMask

  • Add shared mutex support, move constructors (8e36f53)

  • Syscalls

  • Fixes clone3 stack pointer (0ed9654)

  • Linux

  • Add guest[Mmap/Munmap] (b9d878b)

  • Refactor guest mman tracking (ce0f5db)

  • TestHarnessRunner

  • Use guest mapper for test harness files (b78af2f)

  • X86Tables

  • Leave shouldn't end block (4f42632)

  • Misc

  • Struct verifier fixes and reenable (c6153d6)

  • v5.18 support (969d8f8)

  • Fix dangling curl hyphen (1dee54a)

  • SMC detection via segfaults (5460a24)

  • Standarized TODO markers: FEX_TODO, FEX_TODO_ISSUE (73d43c1)

  • Clean up and document ScopedSignalMask (5379f0a)

  • Object cache named region no-op implementation (ee2d417)

  • JIT relocation handling support (c5dacab)

  • 32-bit FSGS instruction fixes. (9bc631a)

  • V5.17 support (2f7dcb8)

  • Emulate reduced-precision X87 with 64-bit host FPU ops (42a6320)

  • mtrack

  • Fixes 32-bit shmat, shmdt tracking, guaranteed invalidation atomicity (d82d294)

  • unittests

  • Reenable atomic tests on ARMv8.0 (0fc6d6b)

  • Investigate failing CI changes (7227ee9)

  • Workaround runner issues (ce5297b)