2 * linux/arch/arm/boot/bootp/init.S
4 * Copyright (C) 2000-2002 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Header file for splitting kernel + initrd. Note that we pass
11 * r0 through to r3 straight through.
13 .section .start,#alloc,#execinstr
14 .type _start, #function
16 _start: adr r10, initdata
18 sub r11, r10, r11 @ work out exec offset
20 .size _entry,. - _entry
22 .type initdata, #object
23 initdata: .word initdata @ compiled address of this
24 .size initdata,. - initdata
26 splitify: adr r13, data
27 ldmia r13!, {r4-r6} @ move the initrd
28 add r4, r4, r11 @ correction
32 * Setup the initrd parameters to pass to the kernel. This can either be
33 * passed in via a param_struct or a tag list. We spot the param_struct
34 * method by looking at the first word; this should either indicate a page
35 * size of 4K, 16K or 32K.
37 ldmia r13, {r4-r8} @ get size and addr of initrd
41 @ r8 = param_struct address
42 ldr r9, [r8, #0] @ no param struct?
44 teqne r9, #0x4000 @ 16K?
45 teqne r9, #0x8000 @ 32K?
48 ldr r9, [r8, #4] @ get first tag
50 beq taglist @ ok, we have a tag list
53 * We didn't find a valid tag list - create one.
61 * find the end of the tag list, and then add an INITRD tag on the end.
62 * If there is already an INITRD tag, then we ignore it; the last INITRD
63 * tag takes precidence.
65 taglist: ldr r9, [r8, #0] @ tag length
66 teq r9, #0 @ last tag?
67 addne r8, r8, r9, lsl #2
69 mov r4, #(16 >> 2) @ length of initrd tag
70 mov r9, #0 @ end of tag list terminator
71 stmia r8, {r4, r5, r6, r7, r9}
73 mov pc, r12 @ call kernel
76 * We found a param struct. Modify the param struct for the initrd
78 param_struct: add r8, r8, #16*4
79 stmia r8, {r6,r7} @ save in param_struct
81 mov pc, r12 @ call kernel
83 move: ldmia r4!, {r7 - r10} @ move 32-bytes at a time
91 data: .word initrd_start
95 .word 0x54410001 @ r4 = ATAG_CORE
96 .word 0x54420005 @ r5 = ATAG_INITRD
97 .word initrd_addr @ r6
101 .type initrd_start,#object