src/runtime/asm_arm.s | 7 +++++++ src/runtime/asm_arm64.s | 7 +++++++ src/runtime/asm_mips64x.s | 7 +++++++ src/runtime/asm_mipsx.s | 7 +++++++ src/runtime/asm_ppc64x.s | 7 +++++++ src/runtime/asm_riscv64.s | 11 +++++++++-- src/runtime/asm_s390x.s | 7 +++++++ diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index b47184e36bc9801e1c2c2080b9a9ef629122304a..591ef2a399fb76711a609b1920d1ae32354439bd 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -387,6 +387,13 @@ // is still in this function, and not the beginning of the next. RET TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 + // Force SPWRITE. This function doesn't actually write SP, + // but it is called with a special calling convention where + // the caller doesn't save LR on stack but passes it as a + // register (R3), and the unwinder currently doesn't understand. + // Make it SPWRITE to stop unwinding. (See issue 54332) + MOVW R13, R13 + MOVW $0, R7 B runtime·morestack(SB) diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index fd65969b628ac7eebc1d5972434d6b155c0e43ca..64121b11aa64024c2b5f7f438699ad7a1036eabe 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -318,6 +318,13 @@ // is still in this function, and not the beginning of the next. UNDEF TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 + // Force SPWRITE. This function doesn't actually write SP, + // but it is called with a special calling convention where + // the caller doesn't save LR on stack but passes it as a + // register (R3), and the unwinder currently doesn't understand. + // Make it SPWRITE to stop unwinding. (See issue 54332) + MOVD RSP, RSP + MOVW $0, R26 B runtime·morestack(SB) diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index 3597ebec57c74ffad714f5fdc751d55c94032531..1abadb9c7df308857a84c30885c47c587f560df6 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -258,6 +258,13 @@ // is still in this function, and not the beginning of the next. UNDEF TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 + // Force SPWRITE. This function doesn't actually write SP, + // but it is called with a special calling convention where + // the caller doesn't save LR on stack but passes it as a + // register (R3), and the unwinder currently doesn't understand. + // Make it SPWRITE to stop unwinding. (See issue 54332) + MOVV R29, R29 + MOVV R0, REGCTXT JMP runtime·morestack(SB) diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s index 4a086b8eb302cf167f028351012b052c9ab9b4b8..877c1bb97b7bcf8bec5dcc287f44ccfc050abf13 100644 --- a/src/runtime/asm_mipsx.s +++ b/src/runtime/asm_mipsx.s @@ -257,6 +257,13 @@ // is still in this function, and not the beginning of the next. UNDEF TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0 + // Force SPWRITE. This function doesn't actually write SP, + // but it is called with a special calling convention where + // the caller doesn't save LR on stack but passes it as a + // register (R3), and the unwinder currently doesn't understand. + // Make it SPWRITE to stop unwinding. (See issue 54332) + MOVW R29, R29 + MOVW R0, REGCTXT JMP runtime·morestack(SB) diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index ae14213999534c9bf490f1cd5e8170d10a34fc46..10ae161a13f5a04da5e56af503c2ffac627a247c 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -338,6 +338,13 @@ // is still in this function, and not the beginning of the next. UNDEF TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 + // Force SPWRITE. This function doesn't actually write SP, + // but it is called with a special calling convention where + // the caller doesn't save LR on stack but passes it as a + // register (R5), and the unwinder currently doesn't understand. + // Make it SPWRITE to stop unwinding. (See issue 54332) + MOVD R1, R1 + MOVD R0, R11 BR runtime·morestack(SB) diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s index 2a4837b3991b5b7577548ca15f8f6a46b1c2196f..c88bef6ed8620ac0b62c128bda2ece25fec6fae4 100644 --- a/src/runtime/asm_riscv64.s +++ b/src/runtime/asm_riscv64.s @@ -158,8 +158,8 @@ * support for morestack */ // Called during function prolog when more stack is needed. -// Caller has already loaded: -// R1: framesize, R2: argsize, R3: LR +// Called with return address (i.e. caller's PC) in X5 (aka T0), +// and the LR register contains the caller's LR. // // The traceback routines see morestack on a g0 as being // the top of a stack (for example, morestack calling newstack @@ -209,6 +209,13 @@ UNDEF // func morestack_noctxt() TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 + // Force SPWRITE. This function doesn't actually write SP, + // but it is called with a special calling convention where + // the caller doesn't save LR on stack but passes it as a + // register, and the unwinder currently doesn't understand. + // Make it SPWRITE to stop unwinding. (See issue 54332) + MOV X2, X2 + MOV ZERO, CTXT JMP runtime·morestack(SB) diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s index 9159a673721ff3aad7928c446ebfb136dee8c51c..334e1aa909d3ef7a554cd479aef99cdf36853560 100644 --- a/src/runtime/asm_s390x.s +++ b/src/runtime/asm_s390x.s @@ -346,6 +346,13 @@ // is still in this function, and not the beginning of the next. UNDEF TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 + // Force SPWRITE. This function doesn't actually write SP, + // but it is called with a special calling convention where + // the caller doesn't save LR on stack but passes it as a + // register (R5), and the unwinder currently doesn't understand. + // Make it SPWRITE to stop unwinding. (See issue 54332) + MOVD R15, R15 + MOVD $0, R12 BR runtime·morestack(SB)