/* SPDX-License-Identifier: GPL-2.0-only */1/*2* linux/arch/arm/boot/bootp/init.S3*4* Copyright (C) 2000-2003 Russell King.5*6* "Header" file for splitting kernel + initrd. Note that we pass7* r0 through to r3 straight through.8*9* This demonstrates how to append code to the start of the kernel10* zImage, and boot the kernel without copying it around. This11* example would be simpler; if we didn't have an object of unknown12* size immediately following the kernel, we could build this into13* a binary blob, and concatenate the zImage using the cat command.14*/15.section .start, "ax"16.type _start, #function17.globl _start1819_start: add lr, pc, #-0x8 @ lr = current load addr20adr r13, data21ldmia r13!, {r4-r6} @ r5 = dest, r6 = length22add r4, r4, lr @ r4 = initrd_start + load addr23bl move @ move the initrd2425/*26* Setup the initrd parameters to pass to the kernel. This can only be27* passed in via the tagged list.28*/29ldmia r13, {r5-r9} @ get size and addr of initrd30@ r5 = ATAG_CORE31@ r6 = ATAG_INITRD232@ r7 = initrd start33@ r8 = initrd end34@ r9 = param_struct address3536ldr r10, [r9, #4] @ get first tag37teq r10, r5 @ is it ATAG_CORE?38/*39* If we didn't find a valid tag list, create a dummy ATAG_CORE entry.40*/41movne r10, #0 @ terminator42movne r4, #2 @ Size of this entry (2 words)43stmiane r9, {r4, r5, r10} @ Size, ATAG_CORE, terminator4445/*46* find the end of the tag list, and then add an INITRD tag on the end.47* If there is already an INITRD tag, then we ignore it; the last INITRD48* tag takes precedence.49*/50taglist: ldr r10, [r9, #0] @ tag length51teq r10, #0 @ last tag (zero length)?52addne r9, r9, r10, lsl #253bne taglist5455mov r5, #4 @ Size of initrd tag (4 words)56stmia r9, {r5, r6, r7, r8, r10}57b kernel_start @ call kernel5859/*60* Move the block of memory length r6 from address r4 to address r561*/62move: ldmia r4!, {r7 - r10} @ move 32-bytes at a time63stmia r5!, {r7 - r10}64ldmia r4!, {r7 - r10}65stmia r5!, {r7 - r10}66subs r6, r6, #8 * 467bcs move68mov pc, lr6970.size _start, . - _start7172.align7374.type data,#object75data: .word initrd_start @ source initrd address76.word initrd_phys @ destination initrd address77.word initrd_size @ initrd size7879.word 0x54410001 @ r5 = ATAG_CORE80.word 0x54420005 @ r6 = ATAG_INITRD281.word initrd_phys @ r782.word initrd_size @ r883.word params_phys @ r984.size data, . - data858687