2005-04-16 15:20:36 -07:00
/ *
* linux/ a r c h / s h / b o o t / c o m p r e s s e d / h e a d . S
*
* Copyright ( C ) 1 9 9 9 S t u a r t M e n e f y
* Copyright ( C ) 2 0 0 3 S U G I O K A T o s h i n o b u
* /
.text
2006-12-12 08:53:29 +09:00
# include < a s m / p a g e . h >
2005-04-16 15:20:36 -07:00
.global startup
startup :
/* Load initial status register */
mov. l i n i t _ s r , r1
ldc r1 , s r
/* Move myself to proper location if necessary */
mova 1 f , r0
mov. l 1 f , r2
cmp/ e q r2 , r0
bt c l e a r _ b s s
sub r0 , r2
mov. l b s s _ s t a r t _ a d d r , r0
2009-08-24 17:09:53 +09:00
mov #0xffffffe0 , r1
2005-04-16 15:20:36 -07:00
and r1 , r0 ! a l i g n c a c h e l i n e
mov. l t e x t _ s t a r t _ a d d r , r3
mov r0 , r1
sub r2 , r1
3 :
mov. l @r1, r4
mov. l @(4,r1), r5
mov. l @(8,r1), r6
mov. l @(12,r1), r7
mov. l @(16,r1), r8
mov. l @(20,r1), r9
mov. l @(24,r1), r10
mov. l @(28,r1), r11
mov. l r4 , @r0
mov. l r5 , @(4,r0)
mov. l r6 , @(8,r0)
mov. l r7 , @(12,r0)
mov. l r8 , @(16,r0)
mov. l r9 , @(20,r0)
mov. l r10 , @(24,r0)
mov. l r11 , @(28,r0)
# ifdef C O N F I G _ C P U _ S H 4
ocbwb @r0
# endif
cmp/ h i r3 , r0
add #- 32 , r0
bt/ s 3 b
add #- 32 , r1
mov. l 2 f , r0
jmp @r0
nop
.align 2
1 : .long 1 b
2 : .long c l e a r _ b s s
text_start_addr :
.long startup
/* Clear BSS */
clear_bss :
mov. l e n d _ a d d r , r1
mov. l b s s _ s t a r t _ a d d r , r2
mov #0 , r0
l1 :
mov. l r0 , @-r1
cmp/ e q r1 ,r2
bf l 1
/* Set the initial pointer. */
mov. l i n i t _ s t a c k _ a d d r , r0
mov. l @r0, r15
/* Decompress the kernel */
mov. l d e c o m p r e s s _ k e r n e l _ a d d r , r0
jsr @r0
nop
/* Jump to the start of the decompressed kernel */
mov. l k e r n e l _ s t a r t _ a d d r , r0
jmp @r0
nop
.align 2
bss_start_addr :
.long __bss_start
end_addr :
.long _end
init_sr :
2010-09-24 09:05:38 +00:00
.long 0x500000F0 /* Privileged mode, Bank=0, Block=1, IMASK=0xF */
kexec_magic :
.long 0x400000F0 /* magic used by kexec to parse zImage format */
2005-04-16 15:20:36 -07:00
init_stack_addr :
.long stack_start
decompress_kernel_addr :
.long decompress_kernel
kernel_start_addr :
2010-04-24 13:28:20 +01:00
# ifdef C O N F I G _ 3 2 B I T
.long _ _ _ pa( _ t e x t + P A G E _ S I Z E )
# else
2006-12-12 08:53:29 +09:00
.long _ text+ P A G E _ S I Z E
2010-04-24 13:28:20 +01:00
# endif
2005-04-16 15:20:36 -07:00
.align 9
fake_headers_as_bzImage :
.word 0
.ascii " HdrS" ! h e a d e r s i g n a t u r e
.word 0x0202 ! header v e r s i o n n u m b e r ( > = 0 x01 0 5 )
! or e l s e o l d l o a d l i n - 1 . 5 w i l l f a i l )
.word 0 ! default_ s w i t c h
.word 0 ! SETUPSEG
.word 0x1000
.word 0 ! pointing t o k e r n e l v e r s i o n s t r i n g
.byte 0 ! = 0 , old o n e ( L I L O , L o a d l i n ,
! 0xTV : T=0 f o r L I L O
! V = v e r s i o n
.byte 1 ! Load f l a g s b z I m a g e =1
.word 0x8000 ! size t o m o v e , w h e n s e t u p i s n o t
.long 0x100000 ! 0 x1 0 0 0 0 0 = d e f a u l t f o r b i g k e r n e l
.long 0 ! address o f l o a d e d r a m d i s k i m a g e
.long 0 # its s i z e i n b y t e s