Text file src/runtime/rt0_linux_mips64x.s

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build linux && (mips64 || mips64le)
     6  
     7  #include "textflag.h"
     8  
     9  TEXT _rt0_mips64_linux(SB),NOSPLIT,$0
    10  	JMP	_main<>(SB)
    11  
    12  TEXT _rt0_mips64le_linux(SB),NOSPLIT,$0
    13  	JMP	_main<>(SB)
    14  
    15  TEXT _main<>(SB),NOSPLIT|NOFRAME,$0
    16  	// In a statically linked binary, the stack contains argc,
    17  	// argv as argc string pointers followed by a NULL, envv as a
    18  	// sequence of string pointers followed by a NULL, and auxv.
    19  	// There is no TLS base pointer.
    20  #ifdef GOARCH_mips64
    21  	MOVW	4(R29), R4 // argc, big-endian ABI places int32 at offset 4
    22  #else
    23  	MOVW	0(R29), R4 // argc
    24  #endif
    25  	ADDV	$8, R29, R5 // argv
    26  	JMP	main(SB)
    27  
    28  TEXT main(SB),NOSPLIT|NOFRAME,$0
    29  	// in external linking, glibc jumps to main with argc in R4
    30  	// and argv in R5
    31  
    32  	// initialize REGSB = PC&0xffffffff00000000
    33  	BGEZAL	R0, 1(PC)
    34  	SRLV	$32, R31, RSB
    35  	SLLV	$32, RSB
    36  
    37  	MOVV	$runtime·rt0_go(SB), R1
    38  	JMP	(R1)
    39  

View as plain text