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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2015 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 && (mips64 || mips64le)
     9  
    10  #include "textflag.h"
    11  
    12  TEXT ·GetSP(SB),NOSPLIT,$0-8
    13  	MOVV R29, R0
    14  	ADDV $16, R0
    15  	MOVV R0, sp+0(FP)
    16  	RET
    17  
    18  TEXT ·SetSP(SB),NOSPLIT,$8-8
    19  	MOVV sp+0(FP), R29
    20  	RET
    21  
    22  // Called during function prolog when more stack is needed.
    23  // Caller has already loaded:
    24  // R1: framesize, R2: argsize, R3: LR
    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  	UNDEF // crash
    33  
    34  // morestack but not preserving ctxt.
    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  	MOVV R29, R29
    42  
    43  	MOVV R0, REGCTXT
    44  	JMP runtime·morestack(SB)