/*1* linux/arch/arm/boot/bootp/init.S2*3* Copyright (C) 2000-2003 Russell King.4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*9* "Header" file for splitting kernel + initrd. Note that we pass10* r0 through to r3 straight through.11*12* This demonstrates how to append code to the start of the kernel13* zImage, and boot the kernel without copying it around. This14* example would be simpler; if we didn't have an object of unknown15* size immediately following the kernel, we could build this into16* a binary blob, and concatenate the zImage using the cat command.17*/18.section .start,#alloc,#execinstr19.type _start, #function20.globl _start2122_start: add lr, pc, #-0x8 @ lr = current load addr23adr r13, data24ldmia r13!, {r4-r6} @ r5 = dest, r6 = length25add r4, r4, lr @ r4 = initrd_start + load addr26bl move @ move the initrd2728/*29* Setup the initrd parameters to pass to the kernel. This can only be30* passed in via the tagged list.31*/32ldmia r13, {r5-r9} @ get size and addr of initrd33@ r5 = ATAG_CORE34@ r6 = ATAG_INITRD235@ r7 = initrd start36@ r8 = initrd end37@ r9 = param_struct address3839ldr r10, [r9, #4] @ get first tag40teq r10, r5 @ is it ATAG_CORE?41/*42* If we didn't find a valid tag list, create a dummy ATAG_CORE entry.43*/44movne r10, #0 @ terminator45movne r4, #2 @ Size of this entry (2 words)46stmneia r9, {r4, r5, r10} @ Size, ATAG_CORE, terminator4748/*49* find the end of the tag list, and then add an INITRD tag on the end.50* If there is already an INITRD tag, then we ignore it; the last INITRD51* tag takes precedence.52*/53taglist: ldr r10, [r9, #0] @ tag length54teq r10, #0 @ last tag (zero length)?55addne r9, r9, r10, lsl #256bne taglist5758mov r5, #4 @ Size of initrd tag (4 words)59stmia r9, {r5, r6, r7, r8, r10}60b kernel_start @ call kernel6162/*63* Move the block of memory length r6 from address r4 to address r564*/65move: ldmia r4!, {r7 - r10} @ move 32-bytes at a time66stmia r5!, {r7 - r10}67ldmia r4!, {r7 - r10}68stmia r5!, {r7 - r10}69subs r6, r6, #8 * 470bcs move71mov pc, lr7273.size _start, . - _start7475.align7677.type data,#object78data: .word initrd_start @ source initrd address79.word initrd_phys @ destination initrd address80.word initrd_size @ initrd size8182.word 0x54410001 @ r5 = ATAG_CORE83.word 0x54420005 @ r6 = ATAG_INITRD284.word initrd_phys @ r785.word initrd_size @ r886.word params_phys @ r987.size data, . - data888990