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 #include "tls_arm64.h" 10 11 TEXT runtimeload_g(SB),NOSPLIT,$0 12 MOVB runtimeiscgo(SB), R0 13 CMP $0, R0 14 BEQ nocgo 15 16 MRS_TPIDR_R0 17 #ifdef GOOS_darwin 18 // Darwin sometimes returns unaligned pointers 19 AND $0xfffffffffffffff8, R0 20 #endif 21 MOVD runtimetls_g(SB), R27 22 ADD R27, R0 23 MOVD 0(R0), g 24 25 nocgo: 26 RET 27 28 TEXT runtimesave_g(SB),NOSPLIT,$0 29 MOVB runtimeiscgo(SB), R0 30 CMP $0, R0 31 BEQ nocgo 32 33 MRS_TPIDR_R0 34 #ifdef GOOS_darwin 35 // Darwin sometimes returns unaligned pointers 36 AND $0xfffffffffffffff8, R0 37 #endif 38 MOVD runtimetls_g(SB), R27 39 ADD R27, R0 40 MOVD g, 0(R0) 41 42 nocgo: 43 RET 44 45 #ifdef TLSG_IS_VARIABLE 46 GLOBL runtimetls_g+0(SB), NOPTR, $8 47 #else 48 GLOBL runtimetls_g+0(SB), TLSBSS, $8 49 #endif 50