aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_windows_arm64.s
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2021-04-13 08:44:56 -0400
committerAustin Clements <austin@google.com>2021-04-13 21:13:12 +0000
commitc19759aa487f7d6f479daa00e7462425f4efc481 (patch)
treea580e1b01eeb2ecdb81d383e922ad8bb155095b5 /src/runtime/sys_windows_arm64.s
parente69f02265c74529a368a2ff27fdce4aeb3483e8b (diff)
downloadgo-c19759aa487f7d6f479daa00e7462425f4efc481.tar.xz
runtime: eliminate externalthreadhandler
This function is no longer used. Eliminating this actually fixes several problems: - It made assumptions about what registers memclrNoHeapPointers would preserve. Besides being an abstraction violation and lurking maintenance issue, this actively became a problem for regabi because the call to memclrNoHeapPointers now happens through an ABI wrapper, which is generated by the compiler and hence we can't easily control what registers it clobbers. - The amd64 implementation (at least), does not interact with the host ABI correctly. Notably, it doesn't save many of the registers that are callee-save in the host ABI but caller-save in the Go ABI. - It interacts strangely with the NOSPLIT checker because it allocates an entire M and G on its stack. It worked around this on arm64, and happened to do things the NOSPLIT checker couldn't track on 386 and amd64, and happened to be *4 bytes* below the limit on arm (so any addition to the m or g structs would cause a NOSPLIT failure). See CL 309031 for a more complete explanation. Fixes #45530. Updates #40724. Change-Id: Ic70d4d7e1c17f1d796575b3377b8529449e93576 Reviewed-on: https://go-review.googlesource.com/c/go/+/309634 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/sys_windows_arm64.s')
-rw-r--r--src/runtime/sys_windows_arm64.s60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/runtime/sys_windows_arm64.s b/src/runtime/sys_windows_arm64.s
index 70f628c27d..6b28a0c2ef 100644
--- a/src/runtime/sys_windows_arm64.s
+++ b/src/runtime/sys_windows_arm64.s
@@ -299,66 +299,6 @@ TEXT runtime·lastcontinuetramp(SB),NOSPLIT|NOFRAME,$0
MOVD $runtime·lastcontinuehandler<ABIInternal>(SB), R1
B sigtramp<>(SB)
-// externalthreadhander called with R0 = uint32 arg, R1 = Go function f.
-// Need to call f(arg), which returns a uint32, and return it in R0.
-TEXT runtime·externalthreadhandler<ABIInternal>(SB),NOSPLIT|TOPFRAME,$96-0
- NO_LOCAL_POINTERS
-
- // Push C callee-save registers R19-R28. LR, FP already saved.
- SAVE_R19_TO_R28(-10*8)
-
- // Allocate space for args, saved R0+R1, g, and m structures.
- // Hide from nosplit check.
- #define extra ((64+g__size+m__size+15)&~15)
- SUB $extra, RSP, R2 // hide from nosplit overflow check
- MOVD R2, RSP
-
- // Save R0 and R1 (our args).
- MOVD R0, 32(RSP)
- MOVD R1, 40(RSP)
-
- // Zero out m and g structures.
- MOVD $64(RSP), R0
- MOVD R0, 8(RSP)
- MOVD $(m__size + g__size), R0
- MOVD R0, 16(RSP)
- MOVD $0, 0(RSP) // not-saved LR
- BL runtime·memclrNoHeapPointers(SB)
-
- // Initialize m and g structures.
- MOVD $64(RSP), g
- MOVD $g__size(g), R3 // m
- MOVD R3, g_m(g) // g->m = m
- MOVD g, m_g0(R3) // m->g0 = g
- MOVD g, m_curg(R3) // m->curg = g
- MOVD RSP, R0
- MOVD R0, g_stack+stack_hi(g)
- SUB $(32*1024), R0
- MOVD R0, (g_stack+stack_lo)(g)
- MOVD R0, g_stackguard0(g)
- MOVD R0, g_stackguard1(g)
- BL runtime·save_g(SB)
-
- // Call function.
- MOVD 32(RSP), R0
- MOVD 40(RSP), R1
- MOVW R0, 8(RSP)
- BL (R1)
-
- // Clear g.
- MOVD $0, g
- BL runtime·save_g(SB)
-
- // Load return value (save_g would have smashed)
- MOVW (2*8)(RSP), R0
-
- ADD $extra, RSP, R2
- MOVD R2, RSP
- #undef extra
-
- RESTORE_R19_TO_R28(-10*8)
- RET
-
GLOBL runtime·cbctxts(SB), NOPTR, $4
TEXT runtime·callbackasm1<ABIInternal>(SB),NOSPLIT,$208-0