Commit Graph
4052 Commits
Author SHA1 Message Date
Ryan Houdek 12326d7e71 Merge pull request #5998 from rogersnm/no-procfs-no-va-steal
FEXCore/Allocator: Don't hang when /proc/self/maps can't be opened
2026-10-05 11:23:08 -07:00
Justin Becker 079a69dde2 Style nits 2026-09-30 15:22:22 -07:00
Justin Becker c724742243 Bump diskcache version 2026-09-30 15:07:32 -07:00
Justin Becker 6788bcf264 x87: complete FXAM implementation 2026-09-30 15:07:32 -07:00
Nick Rogers 6b43daccf0 FEXCore/Allocator: Don't hang when /proc/self/maps can't be opened
StealMemoryRegion guards the open() with LogMan::Throw::AFmt, which
compiles out in release builds. With no procfs mounted the fd is -1 and
CollectMemoryGaps then loops on read(-1) forever at 100% CPU.

This is hit whenever FEX is the x86_64 binfmt handler and something runs
an x86 binary in a root without /proc. BuildKit does exactly that: its
emulator probe execs a static x86_64 binary in an empty chroot, so every
BuildKit start on an Arm host with FEX registered hangs.

Reserve nothing instead: StealMemoryRegion returns no regions and
Setup48BitAllocatorIfExists skips the 48-bit allocator. The guest then
runs without the upper VA hidden, which only matters in environments
that previously never got past startup.
2026-09-30 14:43:05 +01:00
Ryan Houdek 7962f40065 FileUtils: Implement RecursiveRemoveDirectory and WalkDirectory with NT syscalls
A bit messy but it basically duplicates the Linux side. We don't have a
way to include NT internal defines in to FEXCore currently so the two
required symbols are just forward declared.
2026-09-25 14:40:21 -07:00
Ryan Houdek 47557a6184 FEXCore/DiskCache: Prune old entries automatically
Adds a config option to disable pruning if desired.

Had to change FEXCore::HostFeatures slightly to remove the HostType from
the Hash for caching, as we don't want the bucket to inadvertently
delete wow64,arm64ec,linux buckets when executing in the same namespace.

Minor changes to the DiskCache::Init code to handle returning two
values, moving the HostType to be a part of the "ProcessBucketHash"
instead of the "MachineBucketHash".

Then uses the directory walking function added in the previous commit to
find mismatched/old "MachineBucketHash" directories and remove them.
2026-09-24 15:21:48 -07:00
Ryan Houdek 47bc73575e FEXCore/FileUtils: Adds a way to walk a directory with callback
We need to walk a directory calling back to the DiskCache, but without
recursion.

Also fixes a function signature issue on win32.
2026-09-24 14:53:53 -07:00
Ryan Houdek 72b2ff88ae Merge pull request #5987 from Plagman/plagman/re-key_mr
DiskCache: adjust key strategy
2026-09-24 11:55:40 -07:00
Pierre-Loup A. Griffais b37aae728f DiskCache: adjust key strategy
The base directory is now the machine bucket, which is everything that affects
codegen that you can ask FEX about offline: FEX compiler version, host features.

The DB files now carry a process bucket, which is everything else that can
affect codegen, on the user/process side: 32-bitness and config.

Both together are still the bucket hash that gets laced into every lookup key,
so we still won't load mismatching code because a file is in the wrong spot.
2026-09-24 00:08:11 -07:00
Ryan Houdek ae3a4ae197 FEXCore: Adds a utility function for deleting a directory
We can't use std::filesystem::remove_all on FEX Linux, so reimplement
it. No unittest for this because....That's spicy on the CI NAND.
2026-09-23 18:34:46 -07:00
Justin Becker af8770005b Clang format 2026-09-22 12:53:05 -07:00
Justin Becker 0ddd46ba44 Bump DiskCacheVersion 2026-09-22 12:53:05 -07:00
Justin Becker e2f0cf41d8 More cleanup 2026-09-22 12:53:05 -07:00
Justin Becker 638329278c Inlined PCMPXSTRX
Improves performance for SSE4.2 String operations by ~10x by emitting inline ASM instead of jumping to a C++ helper.

Performance numbers from a simple microbenchmark vs the existing C++ implementation:
|               | Equal Any | Ranges | Equal Each | Equal Ordered |
|---------------|-----------|--------|------------|---------------|
| **pcmpestri** | 13.40×    | 9.71×  | 19.38×     | 14.07×        |
| **pcmpestrm** | 13.12×    | 9.54×  | 18.73×     | 13.80×        |
| **pcmpistri** | 11.75×    | 9.19×  | 17.63×     | 12.80×        |
| **pcmpistrm** | 11.39×    | 8.83×  | 16.31×     | 12.26×        |
2026-09-22 12:50:02 -07:00
LC 08f451d3bc Merge pull request #5980 from Plagman/plagman/maxrwsize_mr
DiskCache: configurable max file size
2026-09-22 11:10:40 -04:00
Pierre-Loup A. Griffais 83d8317dae DiskCache: configurable max file size 2026-09-22 00:05:10 -07:00
Ryan Houdek 4b418a81aa FEXCore: Have ThreadRemoveCodeEntry IR op jump to dispatcher
In order to reuse code buffers, when invalidating we will no longer be
able to invalidate code while inside the code we are invalidating.

Changes the IR operation to be a block ender itself and control jumping
to the new RIP. This way it can invalidate from the dispatcher and just
restart JIT execution.
2026-09-21 20:53:27 -07:00
Ryan Houdek 229151f878 FEXCore: Have the Syscall IR op jump to the dispatcher
Have it treated as a block terminator IR and instead of doing
syscall+exitfunction, just do syscall and jump in to the dispatcher.

This is necessary for code invalidation and reuse for code that is stuck
in long running syscalls. We'll need to do something similar for thunks
later, although the recursive nature of thunk+callback can make that a
little squirrely.
2026-09-21 14:46:34 -07:00
Ryan Houdek 5006e02498 Dispatcher: Fixes range check of InterruptFaultPage
This one wasn't updated and it's right at the limit of what it can
handle.
2026-09-21 14:45:56 -07:00
Ryan Houdek 9c871c51c9 Config: Add check to see if a config option is default
Either the option missing entirely or it's set to the default.
2026-09-20 14:58:48 -07:00
Ryan Houdek a0ba36eb1b SharedCodeBuffer: Skip VMA naming when JITSymbols are enabled
For some reason `perf top` prefers VMA names over perf symbols. So
disable them when any JIT symbol option is enabled. Breaks WTF tracking
for those buffers but because it's debug, we kind of have to.
2026-09-18 17:01:26 -07:00
Ryan Houdek 69a3da4f31 JITSymbols: Grab PID from the frontend
This is necessary to get JIT Symbols working under arm64ec/wow64
2026-09-18 17:00:17 -07:00
Ryan Houdek ec502b99d8 FEXCore: Support passing process pid to the backend 2026-09-18 16:59:35 -07:00
Ryan Houdek 1405755a31 Merge pull request #5968 from javelina-pkwy/feat/rdrand-fallback
Add software fallback for RDRAND/RDSEED
2026-09-18 13:33:09 -07:00
Pierre-Loup A. Griffais 7a82b07bfd DiskCache: optional memory buffer for faster lookups
May reserve a tiny area for small blocks in general, but will also be useful
for LuaJIT in anon-diskless mode.
2026-09-17 21:21:28 -07:00
Justin Becker 54b178d151 InstrCountCI: Bump disk cache version and regen 2026-09-17 11:25:52 -07:00
Justin Becker 26f0e5017f Fix Linux test failure, and formatting 2026-09-17 11:25:38 -07:00
Justin Becker 9243efc241 Default RDRAND fallback to false 2026-09-17 10:47:09 -07:00
Justin Becker c91c6efc87 Software fallback for RDRAND/RDSEED 2026-09-16 16:08:40 -07:00
Lioncache df9141ee7b Externals: Update vixl
Updates vixl so that the patches we upstreamed are tracked instead of us
needing to manually carry some of the more unnecessary ones forward.

We can also re-enable the tests that were disabled in #5915
2026-09-13 14:26:11 -04:00
Ryan Houdek 37eaff93cb FEXCore: Migrate internal DiskCache header to internal
Leave the smaller public header that is required to get the current
DiskCache version variable still.

NFC
2026-09-15 19:43:27 -07:00
Ryan Houdek d06e98ed84 InstcountCI: Update 2026-09-15 16:40:55 -07:00
Simon Scherer 93def42061 OpcodeDispatcher: Fix RestoreX87State to rotate MM regs by Top of Stack 2026-09-15 16:38:36 -07:00
LC 2790f89949 Merge pull request #5957 from Sonicadvance1/245
Frontend: Remove DST_RAX subflag
2026-09-15 19:02:05 -04:00
Ryan Houdek 0309bc3d90 Frontend: Removes DST_RAX subflag
Shifts the last subflag down
2026-09-15 15:00:03 -07:00
Ryan Houdek 1523142540 OpcodeDispatcher: Removes DST_RAX from CMP/TEST 2026-09-15 15:00:03 -07:00
Ryan Houdek 5743282944 OpcodeDispatcher: Removes DST_RAX from SBB 2026-09-15 15:00:02 -07:00
Ryan Houdek 9d936a8989 OpcodeDispatcher: Removes DST_RAX from ADC 2026-09-15 15:00:02 -07:00
Ryan Houdek 1e95181b34 OpcodeDispatcher: Removes DST_RAX from ALUOp operations. 2026-09-15 15:00:01 -07:00
Ryan Houdek d85f5b4398 OpcodeDispatcher: Remove DST_RAX from LODS
This was already handled.
2026-09-15 15:00:01 -07:00
Ryan Houdek ed6d7092a2 OpcodeDispatcher: Removes DST_RAX from moffset instructions
I had already removed the use here.
2026-09-15 15:00:01 -07:00
Ryan Houdek a164315b7d OpcodeDispatcher: Removes DST_RAX from BCD ops
These already didn't use the flag actually.
2026-09-15 15:00:00 -07:00
Ryan Houdek e8084e3f11 OpcodeDispatcher: Remove DST_RAX from FNSTSW 2026-09-15 15:00:00 -07:00
Ryan Houdek 17ebb38ebd FEXCore/Utils: Make crc32 match between architectures
I forgot that we actually need this to match arm64 behaviour on x86.
Implement the pseudocodefor the instruction.
2026-09-15 14:21:08 -07:00
LC fd7b749e47 Merge pull request #5959 from Sonicadvance1/246
FEXCore: Moves crc32 helper to a shared location
2026-09-15 16:35:43 -04:00
Ryan Houdek 6efbc2ba0b FEXCore: Moves crc32 helper to a shared location 2026-09-15 13:01:53 -07:00
LC f2e8f580a4 Merge pull request #5956 from Sonicadvance1/244
Frontend: Remove SRC_RCX subflag
2026-09-15 15:26:18 -04:00
Ryan Houdek 5a24152672 Merge pull request #5953 from Plagman/plagman/crc_patching_mr
JIT: Let DiskCache patch ValidateCode guest CRC (and other small fixes 👼)
2026-09-15 12:17:02 -07:00
Ryan Houdek cad4cb9b64 Frontend: Remove SRC_RCX subflag 2026-09-15 11:56:10 -07:00