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