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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2016 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 && s390x
     9  
    10  #include "textflag.h"
    11  
    12  // R15 is the stack pointer
    13  
    14  TEXT ·GetSP(SB),NOSPLIT,$0-8
    15  	MOVD R15, R0
    16  	ADD $16, R0
    17  	MOVD R0, sp+0(FP)
    18  	RET
    19  
    20  TEXT ·SetSP(SB),NOSPLIT|NOFRAME,$8-8
    21  	MOVD sp+0(FP), R15
    22  	RET
    23  
    24  // Called during function prolog when more stack is needed.
    25  // Caller has already loaded:
    26  // R3: framesize, R4: argsize, R5: LR
    27  //
    28  // The traceback routines see morestack on a g0 as being
    29  // the top of a stack (for example, morestack calling newstack
    30  // calling the scheduler calling newm calling gc), so we must
    31  // record an argument size. For that purpose, it has no arguments.
    32  TEXT runtime·morestack(SB),NOSPLIT|NOFRAME,$0-0
    33  	// TODO: implement
    34  	UNDEF // crash
    35  
    36  // morestack but not preserving ctxt.
    37  TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
    38  	// Force SPWRITE. This function doesn't actually write SP,
    39  	// but it is called with a special calling convention where
    40  	// the caller doesn't save LR on stack but passes it as a
    41  	// register (R5), and the unwinder currently doesn't understand.
    42  	// Make it SPWRITE to stop unwinding. (See issue 54332)
    43  	MOVD R15, R15
    44  
    45  	MOVD $0, R12
    46  	BR runtime·morestack(SB)