Repository navigation
Sync with upstream FEX - #2
Open
github-actions[bot] wants to merge 254 commits into
Open
github-actions[bot] wants to merge 254 commits into
github-actions[bot] wants to merge 254 commits into
Conversation
Tests: Enable a handful of tests, and fix small bug in python test runner script
Peephole optimization for VPCMPEQD + VGATHERDPS
Fixes #6016
Scripts/InstallFEX: Add new ubuntu versions
NtDllRedirectionLUTSize is a uint32_t, but CheckCall loaded it with a 64-bit ldr. The upper half of the bound then comes from whatever follows the variable in memory, and the :lo12: offset of a 64-bit ldr needs an 8-byte aligned symbol, so the link fails with "misaligned ldr/str offset" when the variable ends up on a 4-byte boundary. Load it with a 32-bit ldr, which zero-extends into x17 for the compare.
NtDllRedirectionLUT has NtDllRedirectionLUTSize entries, so valid offsets are 0 to NtDllRedirectionLUTSize - 1. The bounds check used b.hi, which let an offset equal to the size through and read one entry past the end of the allocation.
This is fairly trivial to support. Fixes #6028
Fixes #6025
ARM64EC: Fix the NtDllRedirectionLUT bounds check in CheckCall
Linux: Return EFAULT for stat() of a null path
Linux: Track main stack usage more accurately in VmData
Linux/SignalDelegator: Support SA_RESETHAND
Found this through introspection, only a real problem with -O0. We were moving a fextl::vector in to a shared pointer so it can be long living, this causes a change in ownership which was causing the `BlobData` pointer to be stale. This was then passed to the work queue to be consumed. In -O1 and above a std::move of a fextl::vector is a proper move, but -O0 it turns in to a copy. Easy fix is to just create the shared_ptr early and reference that, so the pointer is long lived and no references become stale.
DiskCache: Fixes a race condition on the data blob
Thunks: Fixes LLVM 23
Tests: Reduce wall clock time spent in "ninja tests"
unittests/ASM: Test SAR sign extension for 8 and 16 bit
unittests: Also fix LLVM 23
FEXInterpreter: select is banned
Wine now supports Windows-compatible context flags for storing YMM state in the ARM64 context. That includes CONTEXT_ARM64_FLOATING_POINT_LOW/HIGH, which can be used to address the FP registers representing SSE and AVX registers separately. CONTEXT_ARM64_FLOATING_POINT is equivalent to setting both of those flags, which is enough for how FEX currently uses the context. CONTEXT_ARM64_FEX_YMMSTATE has the same value as CONTEXT_ARM64_FLOATING_POINT_LOW, which is not what it's meant to express, but it's harmless and redundant. Just remove the flag to avoid confusion.
ARM64EC: Remove no longer needed CONTEXT_ARM64_FEX_YMMSTATE flag
This supplements the partial_decode_failure test with explicit instructions that generate synchronous faults in FEX. Today both of these tests pass in arm64ec and wow64, but wow64 currently doesn't do fault-free synchronous faults. When tinkering with converting wow64 over, it was picking up implementation failures. Can't yet test these in CI directly but good to have.
FEXMingwTests: Adds a synchronous fault test
Turns out this is used in the wild by SecuROM. Helps get #6124 further, but doesn't quite fix the game. Just has SecuROM error 8016 now. Might be related to the DEP disablement stuff?
FEXCore: Ensure BSF/BSR works with repne prefix
When a process calls `NtTerminateProcess`, FEX gets in a state where threads are ripped out from under itself. Due to how WINE implements this syscall, what happens is that SIGQUIT is sent to all the threads. These threads then die while holding various mutexes inside of FEX's code. For the threads that were unlucky enough to be in a WINE syscall handler and blocking the SIGQUIT signal, this means they continue trying to do some work. These remaining threads then call back in to FEX, hit some of these mutexes that are now dead and hang forever. There's no way to recover from this situation since those threads are completely gone already. Luckily for us, FEX is allowed to do a bit of work before and after `NtTerminateProcess`. So before the syscall actually fires, round up all of our threads and suspend them using the Suspend Doorbell mechanism. Once the threads are suspended we can then continue and let WINE SIGQUIT them, since at that point we know they're no longer holding any locks that could cause us to hang. Technically this still isn't a 100% sure-fire approach since other processes can call `NtTerminateProcess` on our process and WINE will happily SIGQUIT the process without notifying us. There's also the case that `NtTerminateThread` can do the same thing for a single thread. To solve all these cases we actually need WINE itself to completely rewrite how they do process shutdown in these instances and ensure to use the doorbell itself in all cases. The testcase for this was spinning on wine-mono's `delegate8.exe` unittest which would quickly hang on process shutdown. I just started up ten instances of this and let them spin for an hour to show they no longer hang with these changes. Fixes at least one spurious hang we've been having on process shutdown which is nice.
WINE: Fixes race on TerminateProcess
ProfileStats on Win32 is actually fairly costly even when not enabled because `QueryPerformanceCounter` actually requires going through Wine's syscall disaptcher. We were always calling these even when they weren't enabled as long as they were compiled in. Using the cycle counter is almost already perfect for us since we're only caring about short relative time events. We just need to convert the virtual cycle counter from cycles to nanoseconds. On real ARMv9.1 platforms with a 1Ghz cycle counters this'll turn in to a multiply by 1 and divide by 1, which is fairly fast on modern CPUs. Just need to calculate the scale factors early and reuse them. Fixes #6133
Profiler: Use cycle counter register directly
If the flags were passed in to C/CXX flags, then skip these. Was causing redundant flags to be set that were conflicting with each other.
CMake: Skip CPU/Arch tuning if already set
If memory space is getting reserved but not committed then we don't need to track it ourselves. Removes some overhead down the line.
wow64/arm64ec: Stop tracking reserve only allocations
By detecting common SHA1 code patterns we can improve bulk throughput in SHA1 by about 2x, based on testing on Oryon-3.
Crypto: SHA1 Peephole
This field now tells us what the granularity of LSE2 unaligned faults occur for load, store, and RMW operations. Only show the value if it differs from testing. Oryon-3 today will show a difference today for this.
FEXGetConfig: Use new LSE2Size field to see unaligned granulrity
Maybe this changes are not needed and the execute bit is enough, but i playing around and probably the PF from nonpresent page also a bit useful. Drop it if this test is useless :)
Add Nix flake + NixOS module
Supposedly these are supposed to only return NTSTATUS but I guess in some cases it can return garbage in the upper-bits. In particular the UnixCalls are a bit weird. Fixes #6145
Wow64: Fixes incorrect zext on syscalls
Small improvements of partial decode test
WOW64: Enable AVX support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
upstream-main has 254 commits that are not in main.
Newest upstream commit: 490bb02 Merge pull request #6147 from cjacek/avx32
Merge this PR with a merge commit (not squash or rebase) so that main keeps the upstream history.