]> Git Repo - J-u-boot.git/blob - examples/api/crt0.S
Merge tag 'u-boot-imx-master-20250127' of https://gitlab.denx.de/u-boot/custodians...
[J-u-boot.git] / examples / api / crt0.S
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2007 Semihalf
4  *
5  * Written by: Rafal Jaworowski <[email protected]>
6  */
7
8 #if defined(CONFIG_PPC)
9
10         .text
11         .globl _start
12 _start:
13         lis     %r11, search_hint@ha
14         addi    %r11, %r11, search_hint@l
15         stw     %r1, 0(%r11)
16         b       main
17
18
19         .globl syscall
20 syscall:
21         lis     %r11, syscall_ptr@ha
22         addi    %r11, %r11, syscall_ptr@l
23         lwz     %r11, 0(%r11)
24         mtctr   %r11
25         bctr
26
27 #elif defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
28
29         .text
30         .globl _start
31 _start:
32         ldr     ip, =search_hint
33         str     sp, [ip]
34         b       main
35
36
37         .globl syscall
38 syscall:
39         ldr     ip, =syscall_ptr
40         ldr     pc, [ip]
41
42 #elif defined(CONFIG_ARM64)
43
44         .text
45         .globl _start
46 _start:
47         ldr     x17, =search_hint
48         mov     x16, sp
49         str     x16, [x17]
50         b       main
51
52         .globl syscall
53 syscall:
54         ldr     x16, =syscall_ptr
55         ldr     x16, [x16]
56         br      x16
57
58 #elif defined(CONFIG_MIPS)
59 #include <asm/asm.h>
60         .text
61         .globl __start
62         .ent __start
63 __start:
64         PTR_S   $sp, search_hint
65         b       main
66         .end __start
67
68         .globl syscall
69         .ent syscall
70 syscall:
71         PTR_S   $ra, return_addr
72         PTR_L   $t9, syscall_ptr
73         jalr    $t9
74         nop
75         PTR_L   $ra, return_addr
76         jr      $ra
77         nop
78         .end syscall
79
80 return_addr:
81         .align 8
82         .long 0
83 #elif defined(CONFIG_ARCH_RV32I)
84
85         .text
86         .globl _start
87 _start:
88         la      t0, search_hint
89         sw      sp, 0(t0)
90         la      t0, main
91         jalr    x0, t0
92
93         .globl syscall
94 syscall:
95         la      t0, syscall_ptr
96         lw      t0, 0(t0)
97         jalr    x0, t0
98
99 #elif defined(CONFIG_ARCH_RV64I)
100
101         .text
102         .globl _start
103 _start:
104         la      t0, search_hint
105         sd      sp, 0(t0)
106         la      t0, main
107         jalr    x0, t0
108
109         .globl syscall
110 syscall:
111         la      t0, syscall_ptr
112         ld      t0, 0(t0)
113         jalr    x0, t0
114
115 #else
116 #error No support for this arch!
117 #endif
118
119 .section .data
120
121         .globl syscall_ptr
122 syscall_ptr:
123         .align  8
124         .long   0
125
126         .globl search_hint
127 search_hint:
128         .long   0
This page took 0.033039 seconds and 4 git commands to generate.