A much nicer code base to study is: https://swtch.com/libtask/

The stack save/restore happens in: https://swtch.com/libtask/asm.S

Single OS thread only, FWIW (no M:N scheduling). And like any stackful implementation, requires relatively huge stack allocations if you actually call into stdlib, particularly things like getaddrinfo().