2005-04-16 15:20:36 -07:00
/ * $ Id : head. S ,v 1 . 7 2 0 0 3 / 0 9 / 0 1 1 7 : 5 8 : 1 9 l e t h a l E x p $
*
* arch/ s h / k e r n e l / h e a d . S
*
* Copyright ( C ) 1 9 9 9 , 2 0 0 0 N i i b e Y u t a k a & K a z K o j i m a
*
* This f i l e i s s u b j e c t t o t h e t e r m s a n d c o n d i t i o n s o f t h e G N U G e n e r a l P u b l i c
* License. S e e t h e f i l e " C O P Y I N G " i n t h e m a i n d i r e c t o r y o f t h i s a r c h i v e
* for m o r e d e t a i l s .
*
* Head. S c o n t a i n s t h e S H e x c e p t i o n h a n d l e r s a n d s t a r t u p c o d e .
* /
# include < l i n u x / l i n k a g e . h >
2006-09-27 18:20:16 +09:00
# include < a s m / t h r e a d _ i n f o . h >
2005-04-16 15:20:36 -07:00
2006-09-27 15:00:04 +09:00
# ifdef C O N F I G _ C P U _ S H 4 A
# define S Y N C O ( ) s y n c o
# define P R E F I ( l a b e l , r e g ) \
mov. l l a b e l , r e g ; \
prefi @reg
# else
# define S Y N C O ( )
# define P R E F I ( l a b e l , r e g )
# endif
2005-04-16 15:20:36 -07:00
.section .empty_zero_page , " aw"
ENTRY( e m p t y _ z e r o _ p a g e )
.long 1 /* MOUNT_ROOT_RDONLY */
.long 0 /* RAMDISK_FLAGS */
.long 0x0200 /* ORIG_ROOT_DEV */
.long 1 /* LOADER_TYPE */
.long 0x00360000 /* INITRD_START */
.long 0x000a0000 /* INITRD_SIZE */
.long 0
2006-12-12 08:53:29 +09:00
1 :
.skip PAGE_SIZE - empty_ z e r o _ p a g e - 1 b
2005-04-16 15:20:36 -07:00
2007-07-20 17:40:03 +09:00
.section .text .head , " ax"
2005-04-16 15:20:36 -07:00
/ *
* Condition a t t h e e n t r y o f _ s t e x t :
*
* BSC h a s a l r e a d y b e e n i n i t i a l i z e d .
* INTC m a y o r m a y n o t b e i n i t i a l i z e d .
* VBR m a y o r m a y n o t b e i n i t i a l i z e d .
* MMU m a y o r m a y n o t b e i n i t i a l i z e d .
* Cache m a y o r m a y n o t b e i n i t i a l i z e d .
* Hardware ( i n c l u d i n g o n - c h i p m o d u l e s ) m a y o r m a y n o t b e i n i t i a l i z e d .
*
* /
ENTRY( _ s t e x t )
! Initialize S t a t u s R e g i s t e r
mov. l 1 f , r0 ! M D =1 , R B =0 , B L =0 , I M A S K =0xF
ldc r0 , s r
! Initialize g l o b a l i n t e r r u p t m a s k
mov #0 , r0
2006-11-05 16:15:19 +09:00
# ifdef C O N F I G _ C P U _ H A S _ S R _ R B
2005-04-16 15:20:36 -07:00
ldc r0 , r6 _ b a n k
2006-11-05 16:15:19 +09:00
# endif
2006-09-27 15:00:04 +09:00
/ *
* Prefetch i f p o s s i b l e t o r e d u c e c a c h e m i s s p e n a l t y .
*
* We d o t h i s e a r l y o n f o r S H - 4 A a s a m i c r o - o p t i m i z a t i o n ,
* as l a t e r o n w e w i l l h a v e s p e c u l a t i v e e x e c u t i o n e n a b l e d
* and t h i s w i l l b e c o m e l e s s o f a n i s s u e .
* /
PREFI( 5 f , r0 )
PREFI( 6 f , r0 )
2005-04-16 15:20:36 -07:00
!
mov. l 2 f , r0
mov r0 , r15 ! S e t i n i t i a l r15 ( s t a c k p o i n t e r )
2006-11-27 12:06:26 +09:00
mov #( T H R E A D _ S I Z E > > 10 ) , r1
2006-09-27 18:22:14 +09:00
shll8 r1 ! r1 = T H R E A D _ S I Z E
2006-11-27 12:06:26 +09:00
shll2 r1
2005-04-16 15:20:36 -07:00
sub r1 , r0 !
2006-11-05 16:15:19 +09:00
# ifdef C O N F I G _ C P U _ H A S _ S R _ R B
2005-04-16 15:20:36 -07:00
ldc r0 , r7 _ b a n k ! . . . a n d i n i t i a l t h r e a d _ i n f o
2006-11-05 16:15:19 +09:00
# endif
2005-04-16 15:20:36 -07:00
! Clear B S S a r e a
mov. l 3 f , r1
add #4 , r1
mov. l 4 f , r2
mov #0 , r0
9 : cmp/ h s r2 , r1
bf/ s 9 b ! w h i l e ( r1 < r2 )
mov. l r0 ,@-r2
2006-09-27 15:00:04 +09:00
! Additional C P U i n i t i a l i z a t i o n
mov. l 6 f , r0
jsr @r0
nop
SYNCO( ) ! W a i t f o r p e n d i n g i n s t r u c t i o n s . .
2005-04-16 15:20:36 -07:00
! Start k e r n e l
mov. l 5 f , r0
jmp @r0
nop
.balign 4
2006-11-05 16:15:19 +09:00
# if d e f i n e d ( C O N F I G _ C P U _ S H 2 )
1 : .long 0x000000F0 ! IMASK=0xF
# else
2005-04-16 15:20:36 -07:00
1 : .long 0x400080F0 ! MD=1 , R B =0 , B L =0 , F D =1 , I M A S K =0xF
2006-11-05 16:15:19 +09:00
# endif
2006-09-27 18:20:16 +09:00
2 : .long i n i t _ t h r e a d _ u n i o n + T H R E A D _ S I Z E
2005-04-16 15:20:36 -07:00
3 : .long _ _ b s s _ s t a r t
4 : .long _ e n d
5 : .long s t a r t _ k e r n e l
6 : .long s h _ c p u _ i n i t