Black Lives Matter. Support the Equal Justice Initiative.

Text file src/runtime/rt0_linux_mips64x.s

Documentation: runtime

     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  // +build linux
     7  // +build mips64 mips64le
     8  
     9  #include "textflag.h"
    10  
    11  TEXT _rt0_mips64_linux(SB),NOSPLIT,$0
    12  	JMP	_main<>(SB)
    13  
    14  TEXT _rt0_mips64le_linux(SB),NOSPLIT,$0
    15  	JMP	_main<>(SB)
    16  
    17  TEXT _main<>(SB),NOSPLIT|NOFRAME,$0
    18  	// In a statically linked binary, the stack contains argc,
    19  	// argv as argc string pointers followed by a NULL, envv as a
    20  	// sequence of string pointers followed by a NULL, and auxv.
    21  	// There is no TLS base pointer.
    22  #ifdef GOARCH_mips64
    23  	MOVW	4(R29), R4 // argc, big-endian ABI places int32 at offset 4
    24  #else
    25  	MOVW	0(R29), R4 // argc
    26  #endif
    27  	ADDV	$8, R29, R5 // argv
    28  	JMP	main(SB)
    29  
    30  TEXT main(SB),NOSPLIT|NOFRAME,$0
    31  	// in external linking, glibc jumps to main with argc in R4
    32  	// and argv in R5
    33  
    34  	// initialize REGSB = PC&0xffffffff00000000
    35  	BGEZAL	R0, 1(PC)
    36  	SRLV	$32, R31, RSB
    37  	SLLV	$32, RSB
    38  
    39  	MOVV	$runtime·rt0_go(SB), R1
    40  	JMP	(R1)
    41  

View as plain text