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