mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 16:43:05 -05:00
scePthreadCreate on Linux started guest threads with std::thread, so every thread got the host default stack (RLIMIT_STACK, usually 8 MiB) whatever the title asked for. A thread that asks for more than that and uses it crashes with SIGSEGV. Once the thread ran, scePthreadAttrGet also reported the host size instead of the requested one. Create the thread with pthread_create and a stack of the requested size plus what glibc keeps at its top (static TLS, the thread control block and the start_thread frame). That reserve is measured once with a probe thread. The thread reports [top - reserve - size, top - reserve) as its stack, as Windows reports [top - size, top), and the creator waits until the range is set, as on Windows. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>