...
Text file src/runtime/tls_arm64.s
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 runtime·load_g(SB),NOSPLIT,$0
12 MOVB runtime·iscgo(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 runtime·tls_g(SB), R27
22 ADD R27, R0
23 MOVD 0(R0), g
24
25 nocgo:
26 RET
27
28 TEXT runtime·save_g(SB),NOSPLIT,$0
29 MOVB runtime·iscgo(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 runtime·tls_g(SB), R27
39 ADD R27, R0
40 MOVD g, 0(R0)
41
42 nocgo:
43 RET
44
45 #ifdef TLSG_IS_VARIABLE
46 #ifdef GOOS_android
47 // Use the free TLS_SLOT_APP slot #2 on Android Q.
48 // Earlier androids are set up in gcc_android.c.
49 DATA runtime·tls_g+0(SB)/8, $16
50 #endif
51 GLOBL runtime·tls_g+0(SB), NOPTR, $8
52 #else
53 GLOBL runtime·tls_g+0(SB), TLSBSS, $8
54 #endif
View as plain text