1/* 2 * linux/arch/sh/boot/compressed/head.S 3 * 4 * Copyright (C) 1999 Stuart Menefy 5 * Copyright (C) 2003 SUGIOKA Toshinobu 6 */ 7 8.text 9 10#include <asm/page.h> 11 12 .global startup 13startup: 14 /* Load initial status register */ 15 mov.l init_sr, r1 16 ldc r1, sr 17 18 /* Move myself to proper location if necessary */ 19 mova 1f, r0 20 mov.l 1f, r2 21 cmp/eq r2, r0 22 bt clear_bss 23 sub r0, r2 24 mov.l bss_start_addr, r0 25 mov #0xffffffe0, r1 26 and r1, r0 ! align cache line 27 mov.l text_start_addr, r3 28 mov r0, r1 29 sub r2, r1 303: 31 mov.l @r1, r4 32 mov.l @(4,r1), r5 33 mov.l @(8,r1), r6 34 mov.l @(12,r1), r7 35 mov.l @(16,r1), r8 36 mov.l @(20,r1), r9 37 mov.l @(24,r1), r10 38 mov.l @(28,r1), r11 39 mov.l r4, @r0 40 mov.l r5, @(4,r0) 41 mov.l r6, @(8,r0) 42 mov.l r7, @(12,r0) 43 mov.l r8, @(16,r0) 44 mov.l r9, @(20,r0) 45 mov.l r10, @(24,r0) 46 mov.l r11, @(28,r0) 47#ifdef CONFIG_CPU_SH4 48 ocbwb @r0 49#endif 50 cmp/hi r3, r0 51 add #-32, r0 52 bt/s 3b 53 add #-32, r1 54 mov.l 2f, r0 55 jmp @r0 56 nop 57 58 .align 2 591: .long 1b 602: .long clear_bss 61text_start_addr: 62 .long startup 63 64 /* Clear BSS */ 65clear_bss: 66 mov.l end_addr, r1 67 mov.l bss_start_addr, r2 68 mov #0, r0 69l1: 70 mov.l r0, @-r1 71 cmp/eq r1,r2 72 bf l1 73 74 /* Set the initial pointer. */ 75 mov.l init_stack_addr, r0 76 mov.l @r0, r15 77 78 /* Decompress the kernel */ 79 mov.l decompress_kernel_addr, r0 80 jsr @r0 81 nop 82 83 /* Jump to the start of the decompressed kernel */ 84 mov.l kernel_start_addr, r0 85 jmp @r0 86 nop 87 88 .align 2 89bss_start_addr: 90 .long __bss_start 91end_addr: 92 .long _end 93init_sr: 94 .long 0x500000F0 /* Privileged mode, Bank=0, Block=1, IMASK=0xF */ 95kexec_magic: 96 .long 0x400000F0 /* magic used by kexec to parse zImage format */ 97init_stack_addr: 98 .long stack_start 99decompress_kernel_addr: 100 .long decompress_kernel 101kernel_start_addr: 102#ifdef CONFIG_32BIT 103 .long ___pa(_text+PAGE_SIZE) 104#else 105 .long _text+PAGE_SIZE 106#endif 107 108 .align 9 109fake_headers_as_bzImage: 110 .word 0 111 .ascii "HdrS" ! header signature 112 .word 0x0202 ! header version number (>= 0x0105) 113 ! or else old loadlin-1.5 will fail) 114 .word 0 ! default_switch 115 .word 0 ! SETUPSEG 116 .word 0x1000 117 .word 0 ! pointing to kernel version string 118 .byte 0 ! = 0, old one (LILO, Loadlin, 119 ! 0xTV: T=0 for LILO 120 ! V = version 121 .byte 1 ! Load flags bzImage=1 122 .word 0x8000 ! size to move, when setup is not 123 .long 0x100000 ! 0x100000 = default for big kernel 124 .long 0 ! address of loaded ramdisk image 125 .long 0 # its size in bytes 126