23 Commits
Author SHA1 Message Date
Dean 466ce3ac45 Merge pull request #7474 from Dripl1x/codex/ui-lab-immediate-exit-cache
fix(agc): preserve pipeline caches on immediate guest exit
2026-10-21 11:23:40 +13:00
Evgeniy Kazarin 529dbb0480 fix(agc): preserve pipeline caches on immediate guest exit 2026-10-18 14:25:38 -04:00
mugurc f347461351 feat(libSceSystemService): LoadExec on macOS hosts
sceSystemServiceLoadExec found its own executable through /proc/self/exe
and replaced the process with fexecve after close_range, none of which
macOS has, so on macOS every call except "exit" threw. On macOS:

- the running executable's path comes from _NSGetExecutablePath, resolved
  with std::filesystem::canonical, as libSceNpEntitlementAccess and
  libSceFont already do;
- the target must be an x86-64 Mach-O executable (MH_MAGIC_64,
  CPU_TYPE_X86_64, MH_EXECUTE) that the user may run;
- macOS has no fexecve, so the process is replaced by path with
  posix_spawn and POSIX_SPAWN_SETEXEC; POSIX_SPAWN_CLOEXEC_DEFAULT closes
  every descriptor but the standard streams, as close_range does on Linux;
- before the replacement the exit starts and the shutdown callbacks run
  (LibcStartExit, then LibcRunShutdown), as on Linux, so guest threads
  that call a stopped library wait instead of unwinding;
- descriptor 2 gets the host standard error back before the replacement,
  as on Linux, and guest_system_load_exec_standard_error runs on macOS.

A launch without arguments keeps the Linux execv path, which macOS has.
guest_system_exit finds its own executable the same way on macOS.
2026-10-18 16:05:07 +03:00
milescovielloandClaude Opus 5.5 5b072bc2c4 fix(libSceSystemService): park guest threads during LoadExec's shutdown as exit does
Metal Gear Solid 4 (PPSA18194) aborts on main when its launcher starts
the game: sceSystemServiceLoadExec runs the guest shutdown, a render
thread that then calls into the stopped AGC driver gets ProcessShutdown
back from LibcAwaitExit, and the exception unwinds into title code,
which terminates the process before the new executable starts.

LibcAwaitExit parks a thread only once an exit has been requested, and
LoadExec ran the shutdown without requesting one. It now starts the
shutdown the way exit does, so such threads wait until the process is
replaced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 10:50:36 +00:00
Adrià FranchandClaude 160ba25518 test(libc): keep firstArgument parsing for the exit-order and relaunch modes
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-16 21:53:08 +02:00
MarcZX100 505dc9e9f7 test(libc): verify nested exit shutdown ordering 2026-10-16 21:53:02 +02:00
MarcZX100 db3b406dd2 fix(libc): run guest finalizers before driver shutdown 2026-10-16 21:53:02 +02:00
Ondra97 eb8146b734 fix(libc): skip guest exit handlers when closing the host window 2026-10-14 23:14:16 +02:00
David-cmrg 2dd7f2b0e3 fix(libSceSystemService): end LoadExec exit without running guest exit handlers 2026-10-14 21:41:22 +02:00
Adrià 358e218a4c Merge pull request #5083 from Dripl1x/codex/secondary-loadexec
fix(libSceSystemService): pass LoadExec arguments as the whole guest argv
2026-10-14 21:37:44 +02:00
Adrià f6835a6084 Merge pull request #4925 from MarcZX100/codex/systemservice-loadexec-path-4793
test(libSceSystemService): retain rejected LoadExec paths in errors
2026-10-14 19:52:05 +02:00
Evgeniy KazarinandClaude Opus 5.5 a1b80121c1 fix(libSceSystemService): pass LoadExec arguments as the whole guest argv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:41:25 +03:00
Hussein Kadhim 37ea3b651a fix(libc): finish the exit handlers when one of them calls exit
A guest handler that called exit threw out of the libc exit path because the exiting thread waited on itself. Like FreeBSD, the nested call now runs the handlers that are still registered and ends the process with the status it passed.
2026-10-13 16:28:00 +00:00
David-cmrg 9f9c351f54 fix(libSceSystemService): run guest exit handlers first on LoadExec exit 2026-10-13 12:03:05 +02:00
MarcZX100 59fd2f7968 fix(libSceSystemService): include rejected LoadExec path 2026-10-13 08:13:09 +00:00
p3nicillinandClaude Opus 5.5 99efb32c40 feat: convert a title's other executables and start them with sceSystemServiceLoadExec
The relinker's repeatable --executable converts another executable of the
title beside the output, sharing its libs, app0 and guest modules.
sceSystemServiceLoadExec maps /app0 paths to those executables, passes the
argument list on the new command line and finds the main executable through
APS5_EBOOT. RetroArch (PPSA99169) starts its frontend picker this way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 08:51:50 +01:00
p3nicillinandClaude Opus 5.5 3292cd39fb feat(libSceSystemService): relaunch the title for sceSystemServiceLoadExec of its own eboot.bin
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 08:25:03 +01:00
AlxcBTW bc8587a6fe fix(libc): end the process without detach routines in _Exit on Windows
On Windows std::_Exit ends in ExitProcess, which still runs every module's
DLL_PROCESS_DETACH and TLS callbacks after the other threads are gone. A
static destructor that joins a worker then waits forever: a title that calls
_Exit while libSceVideoOut's flip queue runs (ps5-opengl's retirement
fail-stop) stays alive in FlipQueue's destructor. _Exit and libkernel's _exit
now terminate the process with TerminateProcess, as _exit ends a POSIX
process: no atexit handlers, stream flushes or module destructors.
2026-10-10 21:20:29 +13:00
Pouare514 2be3860983 fix(tests): flush stdout in QuickFirst so ctest pipe captures handler output 2026-10-04 15:24:44 +02:00
Pouare514 1cbf3fa8e4 feat(libc): implement at_quick_exit and quick_exit 2026-10-04 15:20:51 +02:00
asimplestray b42db4b6f3 feat(libc): implement RaiseEv, catchReturnFromMain and reallocalign 2026-09-30 23:55:00 +00:00
SamG-Coder 18ce03cba2 feat(libc): implement immediate guest process exit 2026-09-25 07:05:07 +10:00
SamG-Coder 2920c7f04c feat(system): handle console exit through runtime shutdown 2026-09-25 07:02:37 +10:00