A much nicer code base to study is: https://swtch.com/libtask/
The stack save/restore happens in: https://swtch.com/libtask/asm.S