blob: 200c1d4f1efe4c518a6470993603d748550d4eae [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Paul Mundte2dfb912006-12-12 08:53:29 +090010#include <asm/page.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
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
Stuart Menefyfea966f2009-08-24 17:09:53 +090025 mov #0xffffffe0, r1
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 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 0x400000F0 /* Privileged mode, Bank=0, Block=0, IMASK=0xF */
95init_stack_addr:
96 .long stack_start
97decompress_kernel_addr:
98 .long decompress_kernel
99kernel_start_addr:
Matt Flemingb1613132010-04-24 13:28:20 +0100100#ifdef CONFIG_32BIT
101 .long ___pa(_text+PAGE_SIZE)
102#else
Paul Mundte2dfb912006-12-12 08:53:29 +0900103 .long _text+PAGE_SIZE
Matt Flemingb1613132010-04-24 13:28:20 +0100104#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106 .align 9
107fake_headers_as_bzImage:
108 .word 0
109 .ascii "HdrS" ! header signature
110 .word 0x0202 ! header version number (>= 0x0105)
111 ! or else old loadlin-1.5 will fail)
112 .word 0 ! default_switch
113 .word 0 ! SETUPSEG
114 .word 0x1000
115 .word 0 ! pointing to kernel version string
116 .byte 0 ! = 0, old one (LILO, Loadlin,
117 ! 0xTV: T=0 for LILO
118 ! V = version
119 .byte 1 ! Load flags bzImage=1
120 .word 0x8000 ! size to move, when setup is not
121 .long 0x100000 ! 0x100000 = default for big kernel
122 .long 0 ! address of loaded ramdisk image
123 .long 0 # its size in bytes