33#include <asm/regs.h>
44#include <asm/asmmacro.h>
55#include <asm/cacheasm.h>
6+ #include <asm/processor.h>
67 / *
78 * RB - Data: RedBoot data/bss
89 * P: Boot - Parameters
3637 .globl __start
3738 / * this must be the first byte of the loader! * /
3839__start:
39- entry sp , 32 # we do not intend to return
40+ abi_entry( 32 ) # we do not intend to return
4041 _call0 _start
4142__start_a0:
4243 . align 4
@@ -62,10 +63,12 @@ _start:
6263 wsr a4 , windowstart
6364 rsync
6465
65- movi a4 , 0x00040000
66+ movi a4 , KERNEL_PS_WOE_MASK
6667 wsr a4 , ps
6768 rsync
6869
70+ KABI_C0 mov abi_saved0 , abi_arg0
71+
6972 / * copy the loader to its address
7073 * Note: The loader itself is a very small piece , so we assume we
7174 * don't partially overlap. We also assume (even more important)
@@ -168,52 +171,52 @@ _reloc:
168171
169172 movi a3 , __image_load
170173 sub a4 , a3 , a4
171- add a8 , a0 , a4
174+ add abi_arg2 , a0 , a4
172175
173176 # a1 Stack
174177 # a8(a4) Load address of the image
175178
176- movi a6 , _image_start
177- movi a10 , _image_end
178- movi a7 , 0x1000000
179- sub a11 , a10 , a6
180- movi a9 , complen
181- s32i a11 , a9 , 0
179+ movi abi_arg0 , _image_start
180+ movi abi_arg4 , _image_end
181+ movi abi_arg1 , 0x1000000
182+ sub abi_tmp0 , abi_arg4 , abi_arg0
183+ movi abi_arg3 , complen
184+ s32i abi_tmp0 , abi_arg3 , 0
182185
183186 movi a0 , 0
184187
185- # a6 destination
186- # a7 maximum size of destination
187- # a8 source
188- # a9 ptr to length
188+ # abi_arg0 destination
189+ # abi_arg1 maximum size of destination
190+ # abi_arg2 source
191+ # abi_arg3 ptr to length
189192
190193 . extern gunzip
191- movi a4 , gunzip
192- beqz a4 , 1f
194+ movi abi_tmp0 , gunzip
195+ beqz abi_tmp0 , 1f
193196
194- callx4 a4
197+ abi_callx abi_tmp0
195198
196199 j 2f
197200
198201
199- # a6 destination start
200- # a7 maximum size of destination
201- # a8 source start
202- # a9 ptr to length
203- # a10 destination end
202+ # abi_arg0 destination start
203+ # abi_arg1 maximum size of destination
204+ # abi_arg2 source start
205+ # abi_arg3 ptr to length
206+ # abi_arg4 destination end
204207
2052081 :
206- l32i a9 , a8 , 0
207- l32i a11 , a8 , 4
208- s32i a9 , a6 , 0
209- s32i a11 , a6 , 4
210- l32i a9 , a8 , 8
211- l32i a11 , a8 , 12
212- s32i a9 , a6 , 8
213- s32i a11 , a6 , 12
214- addi a6 , a6 , 16
215- addi a8 , a8 , 16
216- blt a6 , a10 , 1b
209+ l32i abi_tmp0 , abi_arg2 , 0
210+ l32i abi_tmp1 , abi_arg2 , 4
211+ s32i abi_tmp0 , abi_arg0 , 0
212+ s32i abi_tmp1 , abi_arg0 , 4
213+ l32i abi_tmp0 , abi_arg2 , 8
214+ l32i abi_tmp1 , abi_arg2 , 12
215+ s32i abi_tmp0 , abi_arg0 , 8
216+ s32i abi_tmp1 , abi_arg0 , 12
217+ addi abi_arg0 , abi_arg0 , 16
218+ addi abi_arg2 , abi_arg2 , 16
219+ blt abi_arg0 , abi_arg4 , 1b
217220
218221
219222 / * jump to the kernel * /
@@ -230,6 +233,7 @@ _reloc:
230233
231234 # a2 Boot parameter list
232235
236+ KABI_C0 mov abi_arg0 , abi_saved0
233237 movi a0 , _image_start
234238 jx a0
235239
0 commit comments