aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_windows_arm64.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/sys_windows_arm64.s')
-rw-r--r--src/runtime/sys_windows_arm64.s8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/runtime/sys_windows_arm64.s b/src/runtime/sys_windows_arm64.s
index 1161ad0132..22bf1dda70 100644
--- a/src/runtime/sys_windows_arm64.s
+++ b/src/runtime/sys_windows_arm64.s
@@ -12,6 +12,7 @@
// Offsets into Thread Environment Block (pointer in R18)
#define TEB_error 0x68
#define TEB_TlsSlots 0x1480
+#define TEB_ArbitraryPtr 0x28
// Note: R0-R7 are args, R8 is indirect return value address,
// R9-R15 are caller-save, R19-R29 are callee-save.
@@ -273,12 +274,15 @@ TEXT runtime·wintls(SB),NOSPLIT,$0
// Assert that slot is less than 64 so we can use _TEB->TlsSlots
CMP $64, R0
BLT ok
- MOVD $runtime·abort(SB), R1
- BL (R1)
+ // Fallback to the TEB arbitrary pointer.
+ // TODO: don't use the arbitrary pointer (see go.dev/issue/59824)
+ MOVD $TEB_ArbitraryPtr, R0
+ B settls
ok:
// Save offset from R18 into tls_g.
LSL $3, R0
ADD $TEB_TlsSlots, R0
+settls:
MOVD R0, runtime·tls_g(SB)
RET