github.com/zhiqiangxu/util@v0.0.0-20230112053021-0a7aee056cd5/hack_amd64.s (about) 1 #include "go_asm.h" 2 // Copyright 2014 The Go Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 #ifdef GOARCH_arm 7 #define LR R14 8 #endif 9 10 #ifdef GOARCH_amd64 11 #define get_tls(r) MOVQ TLS, r 12 #define g(r) 0(r)(TLS*1) 13 #endif 14 15 #ifdef GOARCH_amd64p32 16 #define get_tls(r) MOVL TLS, r 17 #define g(r) 0(r)(TLS*1) 18 #endif 19 20 #ifdef GOARCH_386 21 #define get_tls(r) MOVL TLS, r 22 #define g(r) 0(r)(TLS*1) 23 #endif 24 #include "funcdata.h" 25 #include "textflag.h" 26 27 28 // func getg() *g 29 TEXT ·getg(SB),NOSPLIT,$0-0 30 get_tls(CX) 31 MOVQ g(CX), AX 32 MOVQ AX, ret+0(FP) 33 RET