github.com/primecitizens/pcz/std@v0.2.1/core/thread/thread.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 //go:build pcz 5 6 package thread 7 8 import ( 9 _ "unsafe" // for go:linkname 10 11 stdgo "github.com/primecitizens/pcz/std/builtin/go" 12 ) 13 14 // GetTLSBaseAddress returns the start address of thread local storage 15 func GetTLSBaseAddress() uintptr 16 17 // G returns the G 18 // 19 //go:linkname G runtime._getg 20 func G() *stdgo.GHead 21 22 // SetG 23 // 24 // NOTE: When changing g, the new g should return the same id from g.G().ID(). 25 // 26 //go:noescape 27 func SetG(g *stdgo.GHead) 28 29 // Topframe calls pc(arg1) and sets sp, its callframe is marked as top-frame. 30 // 31 //go:noescape 32 func Topframe(arg1, sp, pc uintptr)