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

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2014 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 && (ppc64 || ppc64le)
     9  
    10  #include "textflag.h"
    11  
    12  // R1 is the stack pointer
    13  
    14  TEXT ·GetSP<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
    15  	MOVD R1, R3
    16  	RET
    17  
    18  TEXT ·SetSP<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
    19  	MOVD R3, R1
    20  	RET
    21  
    22  // Called during function prolog when more stack is needed.
    23  // Caller has already loaded:
    24  // R3: framesize, R4: argsize, R5: 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 (R5), and the unwinder currently doesn't understand.
    40  	// Make it SPWRITE to stop unwinding. (See issue 54332)
    41  	// Use OR R0, R1 instead of MOVD R1, R1 as the MOVD instruction
    42  	// has a special affect on Power8,9,10 by lowering the thread 
    43  	// priority and causing a slowdown in execution time
    44  
    45  	OR R0, R1
    46  	MOVD R0, R11
    47  	BR runtime·morestack(SB)