Expand description
Guest thread support: host pthread spawn + bsdthread_* helpers.
Model (micro / clean-room):
bsdthread_registerstores the libpthread start trampoline VA.bsdthread_createspawns a host thread that jumps into that trampoline with Darwin_pthread_startregister convention (x0–x3).bsdthread_terminateswitches back to a saved host stack then ends this host thread only (never exit on the guest stack).- Guest
pthread_joincompletion (done+ futex wake) is published from the host stack so joiners nevermunmapa stack still in use. - Worker teardown uses raw
SYS_exit(notpthread_exit): glibcpthread_exitruns_Unwind_ForcedUnwind, which walksx29into guest / hypercall frames and SEGV’s inlibgcc_sunder 7zz MT. - Live spawn requires Linux aarch64 (same as the trap backend).
Structs§
- Guest
Thread Start - Arguments for a newly created guest worker.
Functions§
- alloc_
tid - Allocates a new guest thread id (unique within the process run).
- ensure_
host_ alt_ stack - live_
workers - Number of live worker threads spawned via
bsdthread_create. - reset_
thread_ runtime - Resets thread counters for a new guest run.
- spawn_
guest_ thread - Spawns a host thread that enters guest code at
start.entry. - thread_
selfid - Current host thread’s guest tid (stable for the host thread lifetime).