github.com/primecitizens/pcz/std@v0.2.1/core/stack/asm_arm.s (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2009 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build pcz && arm
     9  
    10  #include "textflag.h"
    11  
    12  TEXT ·GetSP(SB),NOSPLIT,$0-4
    13  	MOVW R13, R0
    14  	ADD $8, R0
    15  	MOVW R0, sp+0(FP)
    16  	RET
    17  
    18  TEXT ·SetSP(SB),NOSPLIT,$0-4
    19  	MOVW sp+0(FP), R13
    20  	RET
    21  
    22  // Called during function prolog when more stack is needed.
    23  // R3 prolog's LR
    24  // using NOFRAME means do not save LR on stack.
    25  //
    26  // The traceback routines see morestack on a g0 as being
    27  // the top of a stack (for example, morestack calling newstack
    28  // calling the scheduler calling newm calling gc), so we must
    29  // record an argument size. For that purpose, it has no arguments.
    30  TEXT runtime·morestack(SB),NOSPLIT|NOFRAME,$0-0
    31  	// TODO: implement
    32  	MOVW $0, R0
    33  	MOVW (R0), R1 // crash
    34  
    35  TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
    36  	// Force SPWRITE. This function doesn't actually write SP,
    37  	// but it is called with a special calling convention where
    38  	// the caller doesn't save LR on stack but passes it as a
    39  	// register (R3), and the unwinder currently doesn't understand.
    40  	// Make it SPWRITE to stop unwinding. (See issue 54332)
    41  	MOVW R13, R13
    42  
    43  	MOVW $0, R7
    44  	B runtime·morestack(SB)