1*b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */ 271373068SPaul Mundt/* 371373068SPaul Mundt * linux/arch/sh/boot/compressed/head.S 471373068SPaul Mundt * 571373068SPaul Mundt * Copyright (C) 1999 Stuart Menefy 671373068SPaul Mundt * Copyright (C) 2003 SUGIOKA Toshinobu 771373068SPaul Mundt */ 871373068SPaul Mundt 971373068SPaul Mundt.text 1071373068SPaul Mundt 1171373068SPaul Mundt#include <asm/page.h> 1271373068SPaul Mundt 1371373068SPaul Mundt .global startup 1471373068SPaul Mundtstartup: 1571373068SPaul Mundt /* Load initial status register */ 1671373068SPaul Mundt mov.l init_sr, r1 1771373068SPaul Mundt ldc r1, sr 1871373068SPaul Mundt 1971373068SPaul Mundt /* Move myself to proper location if necessary */ 2071373068SPaul Mundt mova 1f, r0 2171373068SPaul Mundt mov.l 1f, r2 2271373068SPaul Mundt cmp/eq r2, r0 2371373068SPaul Mundt bt clear_bss 2471373068SPaul Mundt sub r0, r2 2571373068SPaul Mundt mov.l bss_start_addr, r0 26fea966f7SStuart Menefy mov #0xffffffe0, r1 2771373068SPaul Mundt and r1, r0 ! align cache line 2871373068SPaul Mundt mov.l text_start_addr, r3 2971373068SPaul Mundt mov r0, r1 3071373068SPaul Mundt sub r2, r1 3171373068SPaul Mundt3: 3271373068SPaul Mundt mov.l @r1, r4 3371373068SPaul Mundt mov.l @(4,r1), r5 3471373068SPaul Mundt mov.l @(8,r1), r6 3571373068SPaul Mundt mov.l @(12,r1), r7 3671373068SPaul Mundt mov.l @(16,r1), r8 3771373068SPaul Mundt mov.l @(20,r1), r9 3871373068SPaul Mundt mov.l @(24,r1), r10 3971373068SPaul Mundt mov.l @(28,r1), r11 4071373068SPaul Mundt mov.l r4, @r0 4171373068SPaul Mundt mov.l r5, @(4,r0) 4271373068SPaul Mundt mov.l r6, @(8,r0) 4371373068SPaul Mundt mov.l r7, @(12,r0) 4471373068SPaul Mundt mov.l r8, @(16,r0) 4571373068SPaul Mundt mov.l r9, @(20,r0) 4671373068SPaul Mundt mov.l r10, @(24,r0) 4771373068SPaul Mundt mov.l r11, @(28,r0) 4871373068SPaul Mundt#ifdef CONFIG_CPU_SH4 4971373068SPaul Mundt ocbwb @r0 5071373068SPaul Mundt#endif 5171373068SPaul Mundt cmp/hi r3, r0 5271373068SPaul Mundt add #-32, r0 5371373068SPaul Mundt bt/s 3b 5471373068SPaul Mundt add #-32, r1 5571373068SPaul Mundt mov.l 2f, r0 5671373068SPaul Mundt jmp @r0 5771373068SPaul Mundt nop 5871373068SPaul Mundt 5971373068SPaul Mundt .align 2 6071373068SPaul Mundt1: .long 1b 6171373068SPaul Mundt2: .long clear_bss 6271373068SPaul Mundttext_start_addr: 6371373068SPaul Mundt .long startup 6471373068SPaul Mundt 6571373068SPaul Mundt /* Clear BSS */ 6671373068SPaul Mundtclear_bss: 6771373068SPaul Mundt mov.l end_addr, r1 6871373068SPaul Mundt mov.l bss_start_addr, r2 6971373068SPaul Mundt mov #0, r0 7071373068SPaul Mundtl1: 7171373068SPaul Mundt mov.l r0, @-r1 7271373068SPaul Mundt cmp/eq r1,r2 7371373068SPaul Mundt bf l1 7471373068SPaul Mundt 7571373068SPaul Mundt /* Set the initial pointer. */ 7671373068SPaul Mundt mov.l init_stack_addr, r0 7771373068SPaul Mundt mov.l @r0, r15 7871373068SPaul Mundt 7971373068SPaul Mundt /* Decompress the kernel */ 8071373068SPaul Mundt mov.l decompress_kernel_addr, r0 8171373068SPaul Mundt jsr @r0 8271373068SPaul Mundt nop 8371373068SPaul Mundt 8471373068SPaul Mundt /* Jump to the start of the decompressed kernel */ 8571373068SPaul Mundt mov.l kernel_start_addr, r0 8671373068SPaul Mundt jmp @r0 8771373068SPaul Mundt nop 8871373068SPaul Mundt 8971373068SPaul Mundt .align 2 9071373068SPaul Mundtbss_start_addr: 9171373068SPaul Mundt .long __bss_start 9271373068SPaul Mundtend_addr: 9371373068SPaul Mundt .long _end 9471373068SPaul Mundtinit_sr: 9568a1aed7SMagnus Damm .long 0x500000F0 /* Privileged mode, Bank=0, Block=1, IMASK=0xF */ 9668a1aed7SMagnus Dammkexec_magic: 9768a1aed7SMagnus Damm .long 0x400000F0 /* magic used by kexec to parse zImage format */ 9871373068SPaul Mundtinit_stack_addr: 9971373068SPaul Mundt .long stack_start 10071373068SPaul Mundtdecompress_kernel_addr: 10171373068SPaul Mundt .long decompress_kernel 10271373068SPaul Mundtkernel_start_addr: 103b161313aSMatt Fleming#ifdef CONFIG_32BIT 104b161313aSMatt Fleming .long ___pa(_text+PAGE_SIZE) 105b161313aSMatt Fleming#else 10671373068SPaul Mundt .long _text+PAGE_SIZE 107b161313aSMatt Fleming#endif 10871373068SPaul Mundt 10971373068SPaul Mundt .align 9 11071373068SPaul Mundtfake_headers_as_bzImage: 11171373068SPaul Mundt .word 0 11271373068SPaul Mundt .ascii "HdrS" ! header signature 11371373068SPaul Mundt .word 0x0202 ! header version number (>= 0x0105) 11471373068SPaul Mundt ! or else old loadlin-1.5 will fail) 11571373068SPaul Mundt .word 0 ! default_switch 11671373068SPaul Mundt .word 0 ! SETUPSEG 11771373068SPaul Mundt .word 0x1000 11871373068SPaul Mundt .word 0 ! pointing to kernel version string 11971373068SPaul Mundt .byte 0 ! = 0, old one (LILO, Loadlin, 12071373068SPaul Mundt ! 0xTV: T=0 for LILO 12171373068SPaul Mundt ! V = version 12271373068SPaul Mundt .byte 1 ! Load flags bzImage=1 12371373068SPaul Mundt .word 0x8000 ! size to move, when setup is not 12471373068SPaul Mundt .long 0x100000 ! 0x100000 = default for big kernel 12571373068SPaul Mundt .long 0 ! address of loaded ramdisk image 12671373068SPaul Mundt .long 0 # its size in bytes 127