mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 03:59:59 -04:00
Log the guest's ExitProcess line after the exit guard, and bring the comments on gfx_window_closed's return up to date.
The review of the exit sequence found that svc.c case 0x07 logged "guest ExitProcess at ...; exiting" before rt_exit_begin. When a close had already begun, the guest thread that the guard then parks still claimed to exit, and past the log cap the line fell outside the end's reserve, which rt_exit_begin opens. It also found that host.h and gfx_wsys.h still said gfx_window_closed does not return, though it returns for its own thread coming back, and that rt_exit_begin's comment spoke of the window thread handling a message inside the sequence, which since the close runs on a thread of its own happens only in the fallback. svc.c logs the line after rt_exit_begin returns 1. The two header comments say gfx_window_closed returns only for its own thread coming back (gfx_present.c rt_exit_begin), and rt_exit_begin's comment says the window thread runs the sequence itself only when gfx_window_win.c exit_start could make no thread. tests/exit_order_check.py checks statically that 0x07's rt_log comes after rt_exit_begin; it fails on the code before this change and passes after it. exit_order_check and the compile check of every runtime file (a header changed) pass, with no new -Wall warnings in svc.c and gfx_present.c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -240,11 +240,12 @@ static void svc_body(Cpu *c, uint32_t imm, uint64_t pc) {
|
||||
}
|
||||
case 0x29: get_info(c, pc); return;
|
||||
case 0x07: { // ExitProcess, as closing the window: the orderly end (gfx_present.c rt_exit_steps), exit code 0
|
||||
char at[160];
|
||||
rt_log("guest ExitProcess at %s; exiting", ldr_describe(pc, at, sizeof at));
|
||||
// once, shared with the window's close: a close already ending the process keeps this thread there; this
|
||||
// thread coming back would resume guest code after its ExitProcess, so it ends the process instead
|
||||
// once, shared with the window's close: a close already ending the process keeps this thread there, and the
|
||||
// exit line is that close's alone; this thread coming back would resume guest code after its ExitProcess, so it
|
||||
// ends the process instead
|
||||
if (!rt_exit_begin()) plat_exit(0);
|
||||
char at[160]; // after the guard, which also lets the line reach the log file past its cap (main.c log_sink)
|
||||
rt_log("guest ExitProcess at %s; exiting", ldr_describe(pc, at, sizeof at));
|
||||
rt_exit_steps(RT_EXIT_SETTINGS);
|
||||
fflush(NULL);
|
||||
if (svc_test_exit_hook) return svc_test_exit_hook(0);
|
||||
|
||||
Reference in New Issue
Block a user