xref: /rk3399_rockchip-uboot/arch/mips/cpu/start.S (revision eef88dfb3e16e4631e078f42714dbcef3216e3e1)
1*eef88dfbSDaniel Schwierzeck/*
2*eef88dfbSDaniel Schwierzeck *  Startup Code for MIPS32 CPU-core
3*eef88dfbSDaniel Schwierzeck *
4*eef88dfbSDaniel Schwierzeck *  Copyright (c) 2003	Wolfgang Denk <wd@denx.de>
5*eef88dfbSDaniel Schwierzeck *
6*eef88dfbSDaniel Schwierzeck * SPDX-License-Identifier:	GPL-2.0+
7*eef88dfbSDaniel Schwierzeck */
8*eef88dfbSDaniel Schwierzeck
9*eef88dfbSDaniel Schwierzeck#include <asm-offsets.h>
10*eef88dfbSDaniel Schwierzeck#include <config.h>
11*eef88dfbSDaniel Schwierzeck#include <asm/asm.h>
12*eef88dfbSDaniel Schwierzeck#include <asm/regdef.h>
13*eef88dfbSDaniel Schwierzeck#include <asm/mipsregs.h>
14*eef88dfbSDaniel Schwierzeck
15*eef88dfbSDaniel Schwierzeck#ifndef CONFIG_SYS_MIPS_CACHE_MODE
16*eef88dfbSDaniel Schwierzeck#define CONFIG_SYS_MIPS_CACHE_MODE CONF_CM_CACHABLE_NONCOHERENT
17*eef88dfbSDaniel Schwierzeck#endif
18*eef88dfbSDaniel Schwierzeck
19*eef88dfbSDaniel Schwierzeck#ifndef CONFIG_SYS_INIT_SP_ADDR
20*eef88dfbSDaniel Schwierzeck#define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_SDRAM_BASE + \
21*eef88dfbSDaniel Schwierzeck				CONFIG_SYS_INIT_SP_OFFSET)
22*eef88dfbSDaniel Schwierzeck#endif
23*eef88dfbSDaniel Schwierzeck
24*eef88dfbSDaniel Schwierzeck#ifdef CONFIG_32BIT
25*eef88dfbSDaniel Schwierzeck# define MIPS_RELOC	3
26*eef88dfbSDaniel Schwierzeck# define STATUS_SET	0
27*eef88dfbSDaniel Schwierzeck#endif
28*eef88dfbSDaniel Schwierzeck
29*eef88dfbSDaniel Schwierzeck#ifdef CONFIG_64BIT
30*eef88dfbSDaniel Schwierzeck# ifdef CONFIG_SYS_LITTLE_ENDIAN
31*eef88dfbSDaniel Schwierzeck#  define MIPS64_R_INFO(ssym, r_type3, r_type2, r_type) \
32*eef88dfbSDaniel Schwierzeck	(((r_type) << 24) | ((r_type2) << 16) | ((r_type3) << 8) | (ssym))
33*eef88dfbSDaniel Schwierzeck# else
34*eef88dfbSDaniel Schwierzeck#  define MIPS64_R_INFO(ssym, r_type3, r_type2, r_type) \
35*eef88dfbSDaniel Schwierzeck	((r_type) | ((r_type2) << 8) | ((r_type3) << 16) | (ssym) << 24)
36*eef88dfbSDaniel Schwierzeck# endif
37*eef88dfbSDaniel Schwierzeck# define MIPS_RELOC	MIPS64_R_INFO(0x00, 0x00, 0x12, 0x03)
38*eef88dfbSDaniel Schwierzeck# define STATUS_SET	ST0_KX
39*eef88dfbSDaniel Schwierzeck#endif
40*eef88dfbSDaniel Schwierzeck
41*eef88dfbSDaniel Schwierzeck	/*
42*eef88dfbSDaniel Schwierzeck	 * For the moment disable interrupts, mark the kernel mode and
43*eef88dfbSDaniel Schwierzeck	 * set ST0_KX so that the CPU does not spit fire when using
44*eef88dfbSDaniel Schwierzeck	 * 64-bit addresses.
45*eef88dfbSDaniel Schwierzeck	 */
46*eef88dfbSDaniel Schwierzeck	.macro	setup_c0_status set clr
47*eef88dfbSDaniel Schwierzeck	.set	push
48*eef88dfbSDaniel Schwierzeck	mfc0	t0, CP0_STATUS
49*eef88dfbSDaniel Schwierzeck	or	t0, ST0_CU0 | \set | 0x1f | \clr
50*eef88dfbSDaniel Schwierzeck	xor	t0, 0x1f | \clr
51*eef88dfbSDaniel Schwierzeck	mtc0	t0, CP0_STATUS
52*eef88dfbSDaniel Schwierzeck	.set	noreorder
53*eef88dfbSDaniel Schwierzeck	sll	zero, 3				# ehb
54*eef88dfbSDaniel Schwierzeck	.set	pop
55*eef88dfbSDaniel Schwierzeck	.endm
56*eef88dfbSDaniel Schwierzeck
57*eef88dfbSDaniel Schwierzeck	.set noreorder
58*eef88dfbSDaniel Schwierzeck
59*eef88dfbSDaniel Schwierzeck	.globl _start
60*eef88dfbSDaniel Schwierzeck	.text
61*eef88dfbSDaniel Schwierzeck_start:
62*eef88dfbSDaniel Schwierzeck	/* U-boot entry point */
63*eef88dfbSDaniel Schwierzeck	b	reset
64*eef88dfbSDaniel Schwierzeck	 nop
65*eef88dfbSDaniel Schwierzeck
66*eef88dfbSDaniel Schwierzeck	.org 0x10
67*eef88dfbSDaniel Schwierzeck#if defined(CONFIG_SYS_XWAY_EBU_BOOTCFG)
68*eef88dfbSDaniel Schwierzeck	/*
69*eef88dfbSDaniel Schwierzeck	 * Almost all Lantiq XWAY SoC devices have an external bus unit (EBU) to
70*eef88dfbSDaniel Schwierzeck	 * access external NOR flashes. If the board boots from NOR flash the
71*eef88dfbSDaniel Schwierzeck	 * internal BootROM does a blind read at address 0xB0000010 to read the
72*eef88dfbSDaniel Schwierzeck	 * initial configuration for that EBU in order to access the flash
73*eef88dfbSDaniel Schwierzeck	 * device with correct parameters. This config option is board-specific.
74*eef88dfbSDaniel Schwierzeck	 */
75*eef88dfbSDaniel Schwierzeck	.word CONFIG_SYS_XWAY_EBU_BOOTCFG
76*eef88dfbSDaniel Schwierzeck	.word 0x0
77*eef88dfbSDaniel Schwierzeck#elif defined(CONFIG_MALTA)
78*eef88dfbSDaniel Schwierzeck	/*
79*eef88dfbSDaniel Schwierzeck	 * Linux expects the Board ID here.
80*eef88dfbSDaniel Schwierzeck	 */
81*eef88dfbSDaniel Schwierzeck	.word 0x00000420	# 0x420 (Malta Board with CoreLV)
82*eef88dfbSDaniel Schwierzeck	.word 0x00000000
83*eef88dfbSDaniel Schwierzeck#endif
84*eef88dfbSDaniel Schwierzeck
85*eef88dfbSDaniel Schwierzeck	.org 0x200
86*eef88dfbSDaniel Schwierzeck	/* TLB refill, 32 bit task */
87*eef88dfbSDaniel Schwierzeck1:	b	1b
88*eef88dfbSDaniel Schwierzeck	 nop
89*eef88dfbSDaniel Schwierzeck
90*eef88dfbSDaniel Schwierzeck	.org 0x280
91*eef88dfbSDaniel Schwierzeck	/* XTLB refill, 64 bit task */
92*eef88dfbSDaniel Schwierzeck1:	b	1b
93*eef88dfbSDaniel Schwierzeck	 nop
94*eef88dfbSDaniel Schwierzeck
95*eef88dfbSDaniel Schwierzeck	.org 0x300
96*eef88dfbSDaniel Schwierzeck	/* Cache error exception */
97*eef88dfbSDaniel Schwierzeck1:	b	1b
98*eef88dfbSDaniel Schwierzeck	 nop
99*eef88dfbSDaniel Schwierzeck
100*eef88dfbSDaniel Schwierzeck	.org 0x380
101*eef88dfbSDaniel Schwierzeck	/* General exception */
102*eef88dfbSDaniel Schwierzeck1:	b	1b
103*eef88dfbSDaniel Schwierzeck	 nop
104*eef88dfbSDaniel Schwierzeck
105*eef88dfbSDaniel Schwierzeck	.org 0x400
106*eef88dfbSDaniel Schwierzeck	/* Catch interrupt exceptions */
107*eef88dfbSDaniel Schwierzeck1:	b	1b
108*eef88dfbSDaniel Schwierzeck	 nop
109*eef88dfbSDaniel Schwierzeck
110*eef88dfbSDaniel Schwierzeck	.org 0x480
111*eef88dfbSDaniel Schwierzeck	/* EJTAG debug exception */
112*eef88dfbSDaniel Schwierzeck1:	b	1b
113*eef88dfbSDaniel Schwierzeck	 nop
114*eef88dfbSDaniel Schwierzeck
115*eef88dfbSDaniel Schwierzeck	.align 4
116*eef88dfbSDaniel Schwierzeckreset:
117*eef88dfbSDaniel Schwierzeck
118*eef88dfbSDaniel Schwierzeck	/* Clear watch registers */
119*eef88dfbSDaniel Schwierzeck	MTC0	zero, CP0_WATCHLO
120*eef88dfbSDaniel Schwierzeck	MTC0	zero, CP0_WATCHHI
121*eef88dfbSDaniel Schwierzeck
122*eef88dfbSDaniel Schwierzeck	/* WP(Watch Pending), SW0/1 should be cleared */
123*eef88dfbSDaniel Schwierzeck	mtc0	zero, CP0_CAUSE
124*eef88dfbSDaniel Schwierzeck
125*eef88dfbSDaniel Schwierzeck	setup_c0_status STATUS_SET 0
126*eef88dfbSDaniel Schwierzeck
127*eef88dfbSDaniel Schwierzeck	/* Init Timer */
128*eef88dfbSDaniel Schwierzeck	mtc0	zero, CP0_COUNT
129*eef88dfbSDaniel Schwierzeck	mtc0	zero, CP0_COMPARE
130*eef88dfbSDaniel Schwierzeck
131*eef88dfbSDaniel Schwierzeck#ifndef CONFIG_SKIP_LOWLEVEL_INIT
132*eef88dfbSDaniel Schwierzeck	/* CONFIG0 register */
133*eef88dfbSDaniel Schwierzeck	li	t0, CONF_CM_UNCACHED
134*eef88dfbSDaniel Schwierzeck	mtc0	t0, CP0_CONFIG
135*eef88dfbSDaniel Schwierzeck#endif
136*eef88dfbSDaniel Schwierzeck
137*eef88dfbSDaniel Schwierzeck	/*
138*eef88dfbSDaniel Schwierzeck	 * Initialize $gp, force pointer sized alignment of bal instruction to
139*eef88dfbSDaniel Schwierzeck	 * forbid the compiler to put nop's between bal and _gp. This is
140*eef88dfbSDaniel Schwierzeck	 * required to keep _gp and ra aligned to 8 byte.
141*eef88dfbSDaniel Schwierzeck	 */
142*eef88dfbSDaniel Schwierzeck	.align	PTRLOG
143*eef88dfbSDaniel Schwierzeck	bal	1f
144*eef88dfbSDaniel Schwierzeck	 nop
145*eef88dfbSDaniel Schwierzeck	PTR	_gp
146*eef88dfbSDaniel Schwierzeck1:
147*eef88dfbSDaniel Schwierzeck	PTR_L	gp, 0(ra)
148*eef88dfbSDaniel Schwierzeck
149*eef88dfbSDaniel Schwierzeck#ifndef CONFIG_SKIP_LOWLEVEL_INIT
150*eef88dfbSDaniel Schwierzeck	/* Initialize any external memory */
151*eef88dfbSDaniel Schwierzeck	PTR_LA	t9, lowlevel_init
152*eef88dfbSDaniel Schwierzeck	jalr	t9
153*eef88dfbSDaniel Schwierzeck	 nop
154*eef88dfbSDaniel Schwierzeck
155*eef88dfbSDaniel Schwierzeck	/* Initialize caches... */
156*eef88dfbSDaniel Schwierzeck	PTR_LA	t9, mips_cache_reset
157*eef88dfbSDaniel Schwierzeck	jalr	t9
158*eef88dfbSDaniel Schwierzeck	 nop
159*eef88dfbSDaniel Schwierzeck
160*eef88dfbSDaniel Schwierzeck	/* ... and enable them */
161*eef88dfbSDaniel Schwierzeck	li	t0, CONFIG_SYS_MIPS_CACHE_MODE
162*eef88dfbSDaniel Schwierzeck	mtc0	t0, CP0_CONFIG
163*eef88dfbSDaniel Schwierzeck#endif
164*eef88dfbSDaniel Schwierzeck
165*eef88dfbSDaniel Schwierzeck	/* Set up temporary stack */
166*eef88dfbSDaniel Schwierzeck	PTR_LI	t0, -16
167*eef88dfbSDaniel Schwierzeck	PTR_LI	t1, CONFIG_SYS_INIT_SP_ADDR
168*eef88dfbSDaniel Schwierzeck	and	sp, t1, t0		# force 16 byte alignment
169*eef88dfbSDaniel Schwierzeck	PTR_SUB	sp, sp, GD_SIZE		# reserve space for gd
170*eef88dfbSDaniel Schwierzeck	and	sp, sp, t0		# force 16 byte alignment
171*eef88dfbSDaniel Schwierzeck	move	k0, sp			# save gd pointer
172*eef88dfbSDaniel Schwierzeck#ifdef CONFIG_SYS_MALLOC_F_LEN
173*eef88dfbSDaniel Schwierzeck	PTR_LI	t2, CONFIG_SYS_MALLOC_F_LEN
174*eef88dfbSDaniel Schwierzeck	PTR_SUB	sp, sp, t2		# reserve space for early malloc
175*eef88dfbSDaniel Schwierzeck	and	sp, sp, t0		# force 16 byte alignment
176*eef88dfbSDaniel Schwierzeck#endif
177*eef88dfbSDaniel Schwierzeck	move	fp, sp
178*eef88dfbSDaniel Schwierzeck
179*eef88dfbSDaniel Schwierzeck	/* Clear gd */
180*eef88dfbSDaniel Schwierzeck	move	t0, k0
181*eef88dfbSDaniel Schwierzeck1:
182*eef88dfbSDaniel Schwierzeck	sw	zero, 0(t0)
183*eef88dfbSDaniel Schwierzeck	blt	t0, t1, 1b
184*eef88dfbSDaniel Schwierzeck	 PTR_ADDI t0, 4
185*eef88dfbSDaniel Schwierzeck
186*eef88dfbSDaniel Schwierzeck#ifdef CONFIG_SYS_MALLOC_F_LEN
187*eef88dfbSDaniel Schwierzeck	PTR_ADDU t0, k0, GD_MALLOC_BASE	# gd->malloc_base offset
188*eef88dfbSDaniel Schwierzeck	sw	sp, 0(t0)
189*eef88dfbSDaniel Schwierzeck#endif
190*eef88dfbSDaniel Schwierzeck
191*eef88dfbSDaniel Schwierzeck	PTR_LA	t9, board_init_f
192*eef88dfbSDaniel Schwierzeck	jr	t9
193*eef88dfbSDaniel Schwierzeck	 move	ra, zero
194*eef88dfbSDaniel Schwierzeck
195*eef88dfbSDaniel Schwierzeck/*
196*eef88dfbSDaniel Schwierzeck * void relocate_code (addr_sp, gd, addr_moni)
197*eef88dfbSDaniel Schwierzeck *
198*eef88dfbSDaniel Schwierzeck * This "function" does not return, instead it continues in RAM
199*eef88dfbSDaniel Schwierzeck * after relocating the monitor code.
200*eef88dfbSDaniel Schwierzeck *
201*eef88dfbSDaniel Schwierzeck * a0 = addr_sp
202*eef88dfbSDaniel Schwierzeck * a1 = gd
203*eef88dfbSDaniel Schwierzeck * a2 = destination address
204*eef88dfbSDaniel Schwierzeck */
205*eef88dfbSDaniel Schwierzeck	.globl	relocate_code
206*eef88dfbSDaniel Schwierzeck	.ent	relocate_code
207*eef88dfbSDaniel Schwierzeckrelocate_code:
208*eef88dfbSDaniel Schwierzeck	move	sp, a0			# set new stack pointer
209*eef88dfbSDaniel Schwierzeck	move	fp, sp
210*eef88dfbSDaniel Schwierzeck
211*eef88dfbSDaniel Schwierzeck	move	s0, a1			# save gd in s0
212*eef88dfbSDaniel Schwierzeck	move	s2, a2			# save destination address in s2
213*eef88dfbSDaniel Schwierzeck
214*eef88dfbSDaniel Schwierzeck	PTR_LI	t0, CONFIG_SYS_MONITOR_BASE
215*eef88dfbSDaniel Schwierzeck	PTR_SUB	s1, s2, t0		# s1 <-- relocation offset
216*eef88dfbSDaniel Schwierzeck
217*eef88dfbSDaniel Schwierzeck	PTR_LA	t3, in_ram
218*eef88dfbSDaniel Schwierzeck	PTR_L	t2, -(3 * PTRSIZE)(t3)	# t2 <-- __image_copy_end
219*eef88dfbSDaniel Schwierzeck	move	t1, a2
220*eef88dfbSDaniel Schwierzeck
221*eef88dfbSDaniel Schwierzeck	PTR_ADD	gp, s1			# adjust gp
222*eef88dfbSDaniel Schwierzeck
223*eef88dfbSDaniel Schwierzeck	/*
224*eef88dfbSDaniel Schwierzeck	 * t0 = source address
225*eef88dfbSDaniel Schwierzeck	 * t1 = target address
226*eef88dfbSDaniel Schwierzeck	 * t2 = source end address
227*eef88dfbSDaniel Schwierzeck	 */
228*eef88dfbSDaniel Schwierzeck1:
229*eef88dfbSDaniel Schwierzeck	lw	t3, 0(t0)
230*eef88dfbSDaniel Schwierzeck	sw	t3, 0(t1)
231*eef88dfbSDaniel Schwierzeck	PTR_ADDU t0, 4
232*eef88dfbSDaniel Schwierzeck	blt	t0, t2, 1b
233*eef88dfbSDaniel Schwierzeck	 PTR_ADDU t1, 4
234*eef88dfbSDaniel Schwierzeck
235*eef88dfbSDaniel Schwierzeck	/* If caches were enabled, we would have to flush them here. */
236*eef88dfbSDaniel Schwierzeck	PTR_SUB	a1, t1, s2		# a1 <-- size
237*eef88dfbSDaniel Schwierzeck	PTR_LA	t9, flush_cache
238*eef88dfbSDaniel Schwierzeck	jalr	t9
239*eef88dfbSDaniel Schwierzeck	 move	a0, s2			# a0 <-- destination address
240*eef88dfbSDaniel Schwierzeck
241*eef88dfbSDaniel Schwierzeck	/* Jump to where we've relocated ourselves */
242*eef88dfbSDaniel Schwierzeck	PTR_ADDI t0, s2, in_ram - _start
243*eef88dfbSDaniel Schwierzeck	jr	t0
244*eef88dfbSDaniel Schwierzeck	 nop
245*eef88dfbSDaniel Schwierzeck
246*eef88dfbSDaniel Schwierzeck	PTR	__rel_dyn_end
247*eef88dfbSDaniel Schwierzeck	PTR	__rel_dyn_start
248*eef88dfbSDaniel Schwierzeck	PTR	__image_copy_end
249*eef88dfbSDaniel Schwierzeck	PTR	_GLOBAL_OFFSET_TABLE_
250*eef88dfbSDaniel Schwierzeck	PTR	num_got_entries
251*eef88dfbSDaniel Schwierzeck
252*eef88dfbSDaniel Schwierzeckin_ram:
253*eef88dfbSDaniel Schwierzeck	/*
254*eef88dfbSDaniel Schwierzeck	 * Now we want to update GOT.
255*eef88dfbSDaniel Schwierzeck	 *
256*eef88dfbSDaniel Schwierzeck	 * GOT[0] is reserved. GOT[1] is also reserved for the dynamic object
257*eef88dfbSDaniel Schwierzeck	 * generated by GNU ld. Skip these reserved entries from relocation.
258*eef88dfbSDaniel Schwierzeck	 */
259*eef88dfbSDaniel Schwierzeck	PTR_L	t3, -(1 * PTRSIZE)(t0)	# t3 <-- num_got_entries
260*eef88dfbSDaniel Schwierzeck	PTR_L	t8, -(2 * PTRSIZE)(t0)	# t8 <-- _GLOBAL_OFFSET_TABLE_
261*eef88dfbSDaniel Schwierzeck	PTR_ADD	t8, s1			# t8 now holds relocated _G_O_T_
262*eef88dfbSDaniel Schwierzeck	PTR_ADDI t8, t8, 2 * PTRSIZE	# skipping first two entries
263*eef88dfbSDaniel Schwierzeck	PTR_LI	t2, 2
264*eef88dfbSDaniel Schwierzeck1:
265*eef88dfbSDaniel Schwierzeck	PTR_L	t1, 0(t8)
266*eef88dfbSDaniel Schwierzeck	beqz	t1, 2f
267*eef88dfbSDaniel Schwierzeck	 PTR_ADD t1, s1
268*eef88dfbSDaniel Schwierzeck	PTR_S	t1, 0(t8)
269*eef88dfbSDaniel Schwierzeck2:
270*eef88dfbSDaniel Schwierzeck	PTR_ADDI t2, 1
271*eef88dfbSDaniel Schwierzeck	blt	t2, t3, 1b
272*eef88dfbSDaniel Schwierzeck	 PTR_ADDI t8, PTRSIZE
273*eef88dfbSDaniel Schwierzeck
274*eef88dfbSDaniel Schwierzeck	/* Update dynamic relocations */
275*eef88dfbSDaniel Schwierzeck	PTR_L	t1, -(4 * PTRSIZE)(t0)	# t1 <-- __rel_dyn_start
276*eef88dfbSDaniel Schwierzeck	PTR_L	t2, -(5 * PTRSIZE)(t0)	# t2 <-- __rel_dyn_end
277*eef88dfbSDaniel Schwierzeck
278*eef88dfbSDaniel Schwierzeck	b	2f			# skip first reserved entry
279*eef88dfbSDaniel Schwierzeck	 PTR_ADDI t1, 2 * PTRSIZE
280*eef88dfbSDaniel Schwierzeck
281*eef88dfbSDaniel Schwierzeck1:
282*eef88dfbSDaniel Schwierzeck	lw	t8, -4(t1)		# t8 <-- relocation info
283*eef88dfbSDaniel Schwierzeck
284*eef88dfbSDaniel Schwierzeck	PTR_LI	t3, MIPS_RELOC
285*eef88dfbSDaniel Schwierzeck	bne	t8, t3, 2f		# skip non-MIPS_RELOC entries
286*eef88dfbSDaniel Schwierzeck	 nop
287*eef88dfbSDaniel Schwierzeck
288*eef88dfbSDaniel Schwierzeck	PTR_L	t3, -(2 * PTRSIZE)(t1)	# t3 <-- location to fix up in FLASH
289*eef88dfbSDaniel Schwierzeck
290*eef88dfbSDaniel Schwierzeck	PTR_L	t8, 0(t3)		# t8 <-- original pointer
291*eef88dfbSDaniel Schwierzeck	PTR_ADD	t8, s1			# t8 <-- adjusted pointer
292*eef88dfbSDaniel Schwierzeck
293*eef88dfbSDaniel Schwierzeck	PTR_ADD	t3, s1			# t3 <-- location to fix up in RAM
294*eef88dfbSDaniel Schwierzeck	PTR_S	t8, 0(t3)
295*eef88dfbSDaniel Schwierzeck
296*eef88dfbSDaniel Schwierzeck2:
297*eef88dfbSDaniel Schwierzeck	blt	t1, t2, 1b
298*eef88dfbSDaniel Schwierzeck	 PTR_ADDI t1, 2 * PTRSIZE	# each rel.dyn entry is 2*PTRSIZE bytes
299*eef88dfbSDaniel Schwierzeck
300*eef88dfbSDaniel Schwierzeck	/*
301*eef88dfbSDaniel Schwierzeck	 * Clear BSS
302*eef88dfbSDaniel Schwierzeck	 *
303*eef88dfbSDaniel Schwierzeck	 * GOT is now relocated. Thus __bss_start and __bss_end can be
304*eef88dfbSDaniel Schwierzeck	 * accessed directly via $gp.
305*eef88dfbSDaniel Schwierzeck	 */
306*eef88dfbSDaniel Schwierzeck	PTR_LA	t1, __bss_start		# t1 <-- __bss_start
307*eef88dfbSDaniel Schwierzeck	PTR_LA	t2, __bss_end		# t2 <-- __bss_end
308*eef88dfbSDaniel Schwierzeck
309*eef88dfbSDaniel Schwierzeck1:
310*eef88dfbSDaniel Schwierzeck	PTR_S	zero, 0(t1)
311*eef88dfbSDaniel Schwierzeck	blt	t1, t2, 1b
312*eef88dfbSDaniel Schwierzeck	 PTR_ADDI t1, PTRSIZE
313*eef88dfbSDaniel Schwierzeck
314*eef88dfbSDaniel Schwierzeck	move	a0, s0			# a0 <-- gd
315*eef88dfbSDaniel Schwierzeck	move	a1, s2
316*eef88dfbSDaniel Schwierzeck	PTR_LA	t9, board_init_r
317*eef88dfbSDaniel Schwierzeck	jr	t9
318*eef88dfbSDaniel Schwierzeck	 move	ra, zero
319*eef88dfbSDaniel Schwierzeck
320*eef88dfbSDaniel Schwierzeck	.end	relocate_code
321