Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 // +build !android | |
6 | |
7 #include "zasm_GOOS_GOARCH.h" | |
8 #include "funcdata.h" | |
9 #include "../../cmd/ld/textflag.h" | |
10 | |
11 // We have to resort to TLS variable to save g(R10) and | |
12 // m(R9). One reason is that external code might trigger | |
minux
2014/07/02 04:21:15
there is no m(R9) anymore. sync your client with t
crawshaw
2014/07/02 14:57:22
Done.
| |
13 // SIGSEGV, and our runtime.sigtramp don't even know we | |
14 // are in external code, and will continue to use R10/R9, | |
15 // this might as well result in another SIGSEGV. | |
16 // Note: all three functions will clobber R0, and the last | |
17 // two can be called from 5c ABI code. | |
18 | |
19 // save_g saves the g register into pthread-provided | |
20 // thread-local memory, so that we can call externally compiled | |
21 // ARM code that will overwrite those registers. | |
22 // NOTE: runtime.gogo assumes that R1 is preserved by this function. | |
23 // runtime.mcall assumes this function only clobbers R0 and R11. | |
minux
2014/07/02 04:21:14
this comment is fairly important, so I strongly su
crawshaw
2014/07/02 14:57:22
Done.
| |
24 TEXT runtime·save_g(SB),NOSPLIT,$0 | |
25 MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer | |
26 // $runtime.tlsg(SB) is a special linker symbol. | |
27 // It is the offset from the TLS base pointer to our | |
28 // thread-local storage for g. | |
29 MOVW $runtime·tlsg(SB), R11 | |
minux
2014/07/02 04:21:15
the difference between this file and the other is
dfc
2014/07/02 04:33:05
seconded, let's use an ifdef until that proves too
crawshaw
2014/07/02 14:57:22
Done.
| |
30 ADD R11, R0 | |
31 MOVW g, 0(R0) | |
32 RET | |
33 | |
34 // load_g loads the g register from pthread-provided | |
35 // thread-local memory, for use after calling externally compiled | |
36 // ARM code that overwrote those registers. | |
37 TEXT runtime·load_g(SB),NOSPLIT,$0 | |
38 MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer | |
39 // $runtime.tlsg(SB) is a special linker symbol. | |
40 // It is the offset from the TLS base pointer to our | |
41 // thread-local storage for g. | |
42 MOVW $runtime·tlsg(SB), R11 | |
43 ADD R11, R0 | |
44 MOVW 0(R0), g | |
45 RET | |
OLD | NEW |