mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 19:39:57 -04:00
Fix two Linux crashes before Ocarina reaches gameplay
plat_frame_capture was a stub on Linux, so the font rasterizer's first setjmp ended the run (setjmp: no host frame). It now walks the stack with libgcc's _Unwind_Backtrace and fills a PlatJmp of its own (glibc's jmp_buf mangles rsp, rbp and rip, so it cannot be filled by hand); plat_jmp_save and plat_jmp_go are small SysV assembly routines like the Win32 ones. plat_fiber_entry called the fiber function with rsp 8 bytes off the 16-byte alignment the SysV ABI requires, so the first aligned SSE store on a fiber (movaps in ov_poll) faulted as an access violation at address 0. It now aligns rsp before the call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,12 @@ void plat_fiber_free(PlatFiber *f); // a fiber nobody runs
|
||||
typedef struct { uint64_t gpr[10]; uint32_t mxcsr, fpcw; uint64_t pad; uint8_t xmm[160]; } PlatJmp;
|
||||
int plat_jmp_save(PlatJmp *j) __attribute__((returns_twice, nothrow));
|
||||
_Noreturn void plat_jmp_go(PlatJmp *j);
|
||||
#elif defined(__linux__) && defined(__x86_64__)
|
||||
// SysV: rbx, rbp, r12-r15, the caller's rsp and the return address, then MXCSR and the x87 control word (linux.c).
|
||||
// Not glibc's jmp_buf: it mangles rsp, rbp and rip, so plat_frame_capture could not fill one.
|
||||
typedef struct { uint64_t gpr[8]; uint32_t mxcsr, fpcw; } PlatJmp;
|
||||
int plat_jmp_save(PlatJmp *j) __attribute__((returns_twice, nothrow));
|
||||
_Noreturn void plat_jmp_go(PlatJmp *j);
|
||||
#else
|
||||
#include <setjmp.h>
|
||||
typedef struct { jmp_buf b; } PlatJmp;
|
||||
|
||||
Reference in New Issue
Block a user