diff --git a/internal/fakecgo/threadentry_amd64.go b/internal/fakecgo/threadentry_amd64.go index 1bbf9292..0e9868f2 100644 --- a/internal/fakecgo/threadentry_amd64.go +++ b/internal/fakecgo/threadentry_amd64.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2026 The Ebitengine Authors -//go:build !cgo && amd64 && (darwin || freebsd || illumos || linux || netbsd) +//go:build !cgo && (darwin || freebsd || illumos || linux || netbsd) package fakecgo diff --git a/internal/fakecgo/trampolines_amd64.s b/internal/fakecgo/trampolines_amd64.s index 98a362ef..8b85a9bd 100644 --- a/internal/fakecgo/trampolines_amd64.s +++ b/internal/fakecgo/trampolines_amd64.s @@ -78,7 +78,12 @@ TEXT threadentry_trampoline(SB), NOSPLIT, $0 MOVQ DI, AX MOVQ ·threadentry_call(SB), R11 MOVQ (R11), R11 + // threadentry is ABIInternal, so the caller reserves the spill slot for + // its register argument, as runtime·sigtramp does. The slot must not + // overlap the registers saved by PUSH_REGS_HOST_TO_ABI0. + ADJSP $8 CALL R11 + ADJSP $-8 POP_REGS_HOST_TO_ABI0() RET