408 Commits
Author SHA1 Message Date
Ryan Houdek 47be6ad720 Merge pull request #5997 from javelina-pkwy/fix/windows-arm64ec-syscall-stubs
Windows: Don't hardcode NT syscall numbers for ARM64EC
2026-10-05 11:23:39 -07:00
Justin Becker 67a7d4b352 NIT: Unneeded ifdef 2026-09-29 12:02:38 -07:00
Justin Becker aad2c969b7 Windows: Don't hardcode NT syscall numbers for ARM64EC 2026-09-29 11:24:36 -07:00
Jacek Caban 517a1836ee ARM64EC: Use correct context flags in ThreadTerm 2026-09-28 10:39:21 +02:00
Jacek Caban b1e54d803b WOW64: Get thread context in BTCpuThreadTerm to make sure the thread is actually suspended 2026-09-28 10:38:29 +02:00
Jacek Caban 4956ac23e5 WOW64: Use correct thread's CPU area in BTCpuThreadTerm
Fixes af04940466.
2026-09-27 23:02:30 +02:00
LC 59f85d6b7d Merge pull request #5992 from Sonicadvance1/261
Windows: On unimplemented print a log
2026-09-25 21:54:39 -04:00
Ryan Houdek dd63548cb1 Windows: On unimplemented print a log
Makes it easier to find which one was missing. Can't use regular log
routines in the header due to conflicting win32 defines.
2026-09-25 14:44:11 -07:00
Ryan Houdek f3b0b41254 Win32: Implement RemoveDirectory 2026-09-25 14:39:55 -07:00
Ryan Houdek ec502b99d8 FEXCore: Support passing process pid to the backend 2026-09-18 16:59:35 -07:00
Ryan Houdek c55fb3b5b8 UnixLib: Add a way to get Linux process PID 2026-09-18 16:58:11 -07:00
Jacek Caban af04940466 WOW64: Use CHPEv2 for suspend and exception support
CHPE_V2_CPU_AREA_INFO is the mechanism used on ARM64EC to coordinate
thread state, suspension and exception handling with the kernel.
It's typically set up by ntdll for ARM64EC processes, but Wine uses
the TEB pointer without restricting where it's coming from. Set
ChpeV2CpuAreaInfo in FEX WOW64 thread initialization.

Fixes 32-bit debug events and a number of CPU context handling tests.
Reduces the number of wineserver round-trips required for suspend and
avoids the need for remote thread creation for inter-process suspends.
2026-09-10 15:30:51 +02:00
Ryan Houdek 516ce6b15c Threads: Support setting thread names through creation
Gives the DiskCache a thread name so it's easier to find.
2026-09-08 19:11:52 -07:00
Jacek Caban e4c6154be2 WOW64: Use NtRaiseException to raise guest exception
Instead of returning to the currently dispatched exception, which doesn't send a debug event.
2026-09-06 15:22:43 +02:00
Jacek Caban 064a6e96c7 ARM64EC: Use NtRaiseException to raise guest exception
Instead of returning to KiUserExceptionDispatcher, which doesn't send a debug event.
2026-09-06 15:20:30 +02:00
Jacek Caban d704bd3cef Windows: Rise a non-continuable excetpion for STATUS_STACK_BUFFER_OVERRUN 2026-09-06 15:20:30 +02:00
Jacek Caban 9f511d5d78 WOW64: Remove unused variable 2026-09-06 15:20:30 +02:00
Ryan Houdek 179b4423a7 Wine: Change behaviour around SMC and NtReadFile
JIT invalidation around syscalls and kernel calls is mighty fickle.
This is why the previous code path was born. In order to properly handle
this case we need strong coordination between Wine and FEX around
invalidating code and memory protections. This doesn't quite exist today
so we're kind of stuck with a kludge solution. Instead of forcing the
Persona 5 code invalidation on to every process, only do it on P5R.

This fixes a hang in msiexec with PhysX trying to do a blocking read and
jitting code or creating threads, while also maintaining the P5R
approach. The full comment is in the file about the reasoning.
2026-09-04 20:08:18 -07:00
Justin Becker b03dc847f5 Fix syscall regression 2026-09-03 11:09:19 -07:00
LC a6e74cdbe6 Merge pull request #5889 from Sonicadvance1/224
FEXCore: Removes syscall optimization
2026-08-31 22:47:00 -04:00
Ryan Houdek 66cad978c3 FEXCore: Removes syscall optimization
The JIT was doing a bunch of additional work where it was saving and
restoring registers and then juggling the arguments back in to a stack
frame. All of this is nonsensical without the optimization where we
could call syscalls inline without a stack frame.

Instead remove this optimization entirely and behave like a "generic"
syscall path always. The Linux syscall handler now pulls the arguments
out of the CPU context directly and stores the result back in to RAX
directly as well.

This has knock-on effects where technically syscalls are
going to be slightly faster because no stack frame setup for the
arguments, but additionally we are going to be able to have syscalls be
proper serialization points where we can interrupt the syscall and
long-jump out without problems.

Bumps the DiskCache version again because it causes codegen to change.
2026-08-31 19:23:18 -07:00
Ryan Houdek c11a0cef68 FEXUnixlib: Removes unused variable/warning. 2026-08-31 19:09:24 -07:00
Pierre-Loup A. Griffais c0b24b2f2e DiskCache: on Linux, block signals in Writer thread
Clean up thread flags while we're at it.
2026-08-30 22:27:05 -07:00
Ryan Houdek 83ead40b78 UnixLib: Removes old non-unixlib handling
Everything that we care about supports the unixlib path now. Also turns
out we were doing `svc #0` on Windows when unixlib didn't exist which is
kind of funny.

Remove the legacy hacky path as it is no longer necessary.
2026-08-30 13:08:52 -07:00
Jacek Caban aed71ed5e9 WOW64: Update frame state ESP and EIP before unlocking context for syscall
Fixes reported CPU context when queried while processing the syscall.
2026-08-28 18:52:12 +02:00
Pierre-Loup A. Griffais 2a82f58195 DiskCache: use memory-mapped IO for reads when possible
On Wine, use a unixlib call to get a quality mapping that can track a growing
file.
2026-08-27 21:15:22 -07:00
Kaiyi Li 2ea749c7ea Windows: Split CMAKE_CXX_FLAGS before passing to execute_process
CMAKE_CXX_FLAGS is a space-separated string rather than a semicolon-separated
list. Passing ${CMAKE_CXX_FLAGS} directly to execute_process(COMMAND ...)
passes the entire multi-flag string as a single argv argument to the compiler,
causing option parsing to fail when multiple flags are present (such as
flags configured via the CXXFLAGS environment variable).

Use separate_arguments() to convert CMAKE_CXX_FLAGS into a list so each flag
is passed as an individual argument.
2026-08-26 15:52:58 +00:00
Ryan Houdek b83dd97762 FEXCore/Context: Removes InitialRIP/RSP from CreateThread
We actually never use this anymore, we instead always pass zero for
both, and then rely on the thread inheritance model or setting the
values manually. Now that we expose visibility of the
InternalThreadState to the frontend they just access it directly.

Just a smidge of cleanup, NFC.
2026-08-24 18:32:35 -07:00
Pierre-Loup A. Griffais c3fb6ccaaa DiskCache: make Writer thread low-priority 2026-08-23 14:01:32 -07:00
Pierre-Loup A. Griffais c038bb5794 Windows: add Thread implementation
So we can make a worker thread that the guest (hopefully) won't see.
2026-08-21 11:16:07 -07:00
Pierre-Loup A. Griffais efc5eaf9c7 Utils/File: add PRead(), PWrite() and Size()
Because PRead/PWrite don't have the same side effects on the file cursor
between Linux and Windows (:/), make them all-or-nothing.
2026-08-21 11:16:07 -07:00
Jacek Caban 85efb47a3b Windows: Handle interrupt 3 in HandleGuestException 2026-08-21 13:16:43 +02:00
Pierre-Loup A. Griffais 561c32b45d Disk Cache initial implementation
Serializes code blocks to disk - only blocks coming from known regions, for now

Disabled by default, key and versioning still needs work, but works for testing
2026-08-19 18:20:49 -07:00
Jacek Caban ea67665bbf Windows: Handle 0x2c interrupt in HandleGuestException 2026-08-19 00:41:07 +02:00
Jacek Caban 412c49a8ce Windows/CRT: Add printf and puts stubs
Fixes PE builds with VIXL disassembler enabled.
2026-08-16 15:14:36 +02:00
Jacek Caban 720039ca6d CRT: Avoid implicit char to unsigned char casts in strtoumax
Fixes -Wpointer-sign warnings.
2026-08-10 15:05:26 +02:00
Jacek Caban 4e9399e029 CRT: Silence -Wunused-but-set-variable warnings in libm.h 2026-08-10 15:05:26 +02:00
Jacek Caban 466ee3cbcf CRT: Use DLLEXPORT_FUNC for more functions
Fixes locally defined symbol imported linker warnings.
2026-08-10 15:05:26 +02:00
Ryan Houdek 681636cd68 Win32: Actually set app config path and name
Apparently we never set this and it happened to not be a problem. I
needed it to gather some data so fix it.
2026-07-30 20:51:29 -07:00
Martin Storsjö efe38f2ee2 Add more function stubs for libc++ 23 on Windows
These are needed by libc++ when targeting Windows since
https://github.com/llvm/llvm-project/commit/8a531c3608c722ad529be448d6ecef06ba107228,
which is included in libc++ 23.

In a very brief test, it seems like we don't need to actually
implement them.
2026-07-28 23:37:53 +03:00
Martin Storsjö 08031a2767 Add missing includes
This fixes compilation with libc++ 23, which has removed a number
of unnecessary transitive includes in its headers.

Include <cstdlib> in StringConv.h for std::strtoll and std::strtoull.

Include <cstdlib> for the declarations of malloc/free/realloc/calloc
in Alloc.cpp. (Without this, the functions we define end up with
C++ name mangling.)

Include <stdarg.h> in IO.cpp for va_start/va_end.
2026-07-28 23:17:43 +03:00
FrontMage 35518a5fa0 FEXCore: Ignore inactive JIT guard ranges 2026-07-24 07:57:48 +08:00
Brendan Shanks 074743d6e8 Windows: Explicitly use *A/*W Win32 functions 2026-07-22 15:16:44 -07:00
Brendan Shanks 8b446de059 Windows: Use GetModuleHandleW() to avoid unnecessary string conversions 2026-07-22 15:16:44 -07:00
LC f5ae888597 WinAPI/IO: Fix handling of end of file offset in SetFilePointerEx
This just means the end of the file is being used as the base offset.

Also note that according to the documentation for SetFilePositionEx,
that setting the position beyond the current file size is not considered
an error as far as the API is concerned.
2026-07-12 01:26:23 -04:00
Brendan Shanks 84e127a637 Windows/UnixLib: Fix enabling TSO through legacy Proton codepath 2026-07-09 15:00:50 -07:00
Ryan Houdek 4a091df8cc Merge pull request #5672 from neobrain/feature_woa_code_cache_bitness
CodeCache/WoA: Support mixed WoW64/ARM64EC processing
2026-07-09 14:55:21 -07:00
Tony Wasserka 66455b708a CodeCache: Switch between 32-/64-bit compilers during cache generation 2026-07-09 17:17:19 +02:00
Tony Wasserka 54236df6e0 CodeCache: Record main executable bitness in code map
Code maps already contain the main executable they were recorded from, so
it's convenient to capture the executable's bitness along the way.
2026-07-09 17:12:45 +02:00
LC 71d4e2c320 Merge pull request #5660 from Sonicadvance1/183
Wow64: Spin loop on atomic with WFE
2026-07-07 22:53:50 -04:00