diff options
author | Shenghou Ma <minux@golang.org> | 2015-04-10 22:14:43 -0400 |
---|---|---|
committer | David Crawshaw <crawshaw@golang.org> | 2015-04-16 13:01:19 +0000 |
commit | 4a71b91d294189e8ad7de8c10079be6baff3ede4 (patch) | |
tree | c8a10e4a0c762c3513f976438b6b6e1b8e8627cf /src/runtime/tls_arm64.s | |
parent | 110fa22c4562b0f9ada3c81b9bceeb76763f5608 (diff) | |
download | go-4a71b91d294189e8ad7de8c10079be6baff3ede4.tar.gz go-4a71b91d294189e8ad7de8c10079be6baff3ede4.zip |
runtime: darwin/arm64 support
Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f03
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8782
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime/tls_arm64.s')
-rw-r--r-- | src/runtime/tls_arm64.s | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/runtime/tls_arm64.s b/src/runtime/tls_arm64.s index 3ab087ada1..a5f86c4199 100644 --- a/src/runtime/tls_arm64.s +++ b/src/runtime/tls_arm64.s @@ -14,7 +14,18 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 BEQ nocgo MRS_TPIDR_R0 - MOVD 0x10(R0), g +#ifdef GOOS_darwin + // Darwin sometimes returns unaligned pointers + AND $0xfffffffffffffff8, R0 +#endif +#ifdef TLSG_IS_VARIABLE + MOVD runtime·tls_g(SB), R27 + ADD R27, R0 +#else + // TODO(minux): use real TLS relocation, instead of hard-code for Linux + ADD $0x10, R0 +#endif + MOVD 0(R0), g nocgo: RET @@ -25,7 +36,25 @@ TEXT runtime·save_g(SB),NOSPLIT,$0 BEQ nocgo MRS_TPIDR_R0 - MOVD g, 0x10(R0) +#ifdef GOOS_darwin + // Darwin sometimes returns unaligned pointers + AND $0xfffffffffffffff8, R0 +#endif +#ifdef TLSG_IS_VARIABLE + MOVD runtime·tls_g(SB), R27 + ADD R27, R0 +#else + // TODO(minux): use real TLS relocation, instead of hard-code for Linux + ADD $0x10, R0 +#endif + MOVD g, 0(R0) nocgo: RET + +#ifdef TLSG_IS_VARIABLE +// The runtime.tlsg name is being handled specially in the +// linker. As we just need a regular variable here, don't +// use that name. +GLOBL runtime·tls_g+0(SB), NOPTR, $8 +#endif |