• Keith Randall's avatar
    runtime: fix darwin 386/amd64 stack switches · e86c2678
    Keith Randall authored
    A few libc_ calls were missing stack switches.
    
    Unfortunately, adding the stack switches revealed a deeper problem.
    systemstack() is fundamentally flawed because when you do
    
        systemstack(func() { ... })
    
    There's no way to mark the anonymous function as nosplit.  At first I
    thought it didn't matter, as that function runs on the g0 stack.  But
    nosplit is still required, because some syscalls are done when stack
    bounds are not set up correctly (e.g. in a signal handler, which runs
    on the g0 stack, but g is still pointing at the g stack).  Instead use
    asmcgocall and funcPC, so we can be nosplit all the way down.
    
    Mid-stack inlining now pushes darwin over the nosplit limit also.
    Leaving that as a TODO.
    Update #23168
    
    This might fix the cause of occasional darwin hangs.
    Update #25181
    
    Update #17490
    
    Change-Id: If9c3ef052822c7679f5a1dd192443f714483327e
    Reviewed-on: https://go-review.googlesource.com/111258Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    e86c2678
sys_darwin_386.s 13.8 KB