Text file
src/runtime/rt0_aix_ppc64.s
1 // Copyright 2018 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 #include "asm_ppc64x.h"
7
8 // _rt0_ppc64_aix is a function descriptor of the entrypoint function
9 // __start. This name is needed by cmd/link.
10 DEFINE_PPC64X_FUNCDESC(_rt0_ppc64_aix, __start<>)
11
12 // The starting function must return in the loader to
13 // initialise some libraries, especially libthread which
14 // creates the main thread and adds the TLS in R13
15 // R19 contains a function descriptor to the loader function
16 // which needs to be called.
17 // This code is similar to the __start function in C
18 TEXT __start<>(SB),NOSPLIT,$-8
19 XOR R0, R0
20 MOVD $libc___n_pthreads(SB), R4
21 MOVD 0(R4), R4
22 MOVD $libc___mod_init(SB), R5
23 MOVD 0(R5), R5
24 MOVD 0(R19), R0
25 MOVD R2, 40(R1)
26 MOVD 8(R19), R2
27 MOVD R18, R3
28 MOVD R0, CTR
29 BL (CTR) // Return to AIX loader
30
31 // Launch rt0_go
32 MOVD 40(R1), R2
33 MOVD R14, R3 // argc
34 MOVD R15, R4 // argv
35 BL _main(SB)
36
37
38 DEFINE_PPC64X_FUNCDESC(main, _main)
39 TEXT _main(SB),NOSPLIT,$-8
40 MOVD $runtime·rt0_go(SB), R12
41 MOVD R12, CTR
42 BR (CTR)
43
44 TEXT _rt0_ppc64_aix_lib(SB),NOSPLIT,$0
45 MOVD R14, R3 // argc
46 MOVD R15, R4 // argv
47 JMP _rt0_ppc64x_lib(SB)
48
View as plain text