• Joel Sing's avatar
    runtime: fix TLS handling for netbsd · b42ebb6f
    Joel Sing authored
    Set the TLS base using the _lwp_setprivate() syscall, instead of via
    sysarch(). NetBSD tracks the pointer passed to _lwp_setprivate() and
    restores this value when restoring mcontext. If sysarch() is used
    directly, restoring an mcontext trashes the FS/GS value, resulting
    in a segfault when we next try to access the TLS.
    
    R=golang-dev, r
    CC=golang-dev
    https://golang.org/cl/6206062
    b42ebb6f
sys_netbsd_amd64.s 5.52 KB