github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/runtime/tls_riscv64.s (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 #include "go_asm.h" 6 #include "go_tls.h" 7 #include "funcdata.h" 8 #include "textflag.h" 9 10 // If !iscgo, this is a no-op. 11 // 12 // NOTE: mcall() assumes this clobbers only X31 (REG_TMP). 13 TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0-0 14 MOVB runtime·iscgo(SB), X31 15 BEQ X0, X31, nocgo 16 17 MOV runtime·tls_g(SB), X31 18 ADD X4, X31 // add offset to thread pointer (X4) 19 MOV g, (X31) 20 21 nocgo: 22 RET 23 24 TEXT runtime·load_g(SB),NOSPLIT|NOFRAME,$0-0 25 MOV runtime·tls_g(SB), X31 26 ADD X4, X31 // add offset to thread pointer (X4) 27 MOV (X31), g 28 RET 29 30 GLOBL runtime·tls_g(SB), TLSBSS, $8