2006-03-27 14:58:25 +01:00
/ *
* linux/ a r c h / a r m / k e r n e l / h e a d - n o m m u . S
*
* Copyright ( C ) 1 9 9 4 - 2 0 0 2 R u s s e l l K i n g
* Copyright ( C ) 2 0 0 3 - 2 0 0 6 H y o k S . C h o i
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
*
* Common k e r n e l s t a r t u p c o d e ( n o n - p a g e d M M )
*
* /
# include < l i n u x / l i n k a g e . h >
# include < l i n u x / i n i t . h >
# include < a s m / a s s e m b l e r . h >
# include < a s m / p t r a c e . h >
2006-05-05 15:11:14 +01:00
# include < a s m / a s m - o f f s e t s . h >
2006-04-24 09:45:35 +01:00
# include < a s m / t h r e a d _ i n f o . h >
2006-03-27 14:58:25 +01:00
# include < a s m / s y s t e m . h >
/ *
* Kernel s t a r t u p e n t r y p o i n t .
* - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* This i s n o r m a l l y c a l l e d f r o m t h e d e c o m p r e s s o r c o d e . T h e r e q u i r e m e n t s
* are : MMU = o f f , D - c a c h e = o f f , I - c a c h e = d o n t c a r e , r0 = 0 ,
* r1 = m a c h i n e n r .
*
* See l i n u x / a r c h / a r m / t o o l s / m a c h - t y p e s f o r t h e c o m p l e t e l i s t o f m a c h i n e
* numbers f o r r1 .
*
* /
2011-07-13 15:53:30 +01:00
.arm
2009-10-02 16:32:46 -04:00
_ _ HEAD
2006-03-27 14:58:25 +01:00
ENTRY( s t e x t )
2011-07-13 15:53:30 +01:00
THUMB( a d r r9 , B S Y M ( 1 f ) ) @ Kernel is always entered in ARM.
THUMB( b x r9 ) @ If this is a Thumb-2 kernel,
THUMB( . t h u m b ) @ switch to Thumb now.
THUMB( 1 : )
2009-07-24 12:32:54 +01:00
setmode P S R _ F _ B I T | P S R _ I _ B I T | S V C _ M O D E , r9 @ ensure svc mode
2006-03-27 14:58:25 +01:00
@ and irqs disabled
2006-09-26 17:36:37 +09:00
# ifndef C O N F I G _ C P U _ C P 1 5
ldr r9 , =CONFIG_PROCESSOR_ID
# else
2006-03-27 14:58:25 +01:00
mrc p15 , 0 , r9 , c0 , c0 @ get processor id
2006-09-26 17:36:37 +09:00
# endif
2006-03-27 14:58:25 +01:00
bl _ _ l o o k u p _ p r o c e s s o r _ t y p e @ r5=procinfo r9=cpuid
movs r10 , r5 @ invalid processor (r5=0)?
beq _ _ e r r o r _ p @ yes, error 'p'
2009-07-24 12:32:54 +01:00
adr l r , B S Y M ( _ _ a f t e r _ p r o c _ i n i t ) @ return (PIC) address
ARM( a d d p c , r10 , #P R O C I N F O _ I N I T F U N C )
THUMB( a d d r12 , r10 , #P R O C I N F O _ I N I T F U N C )
THUMB( m o v p c , r12 )
2008-08-28 11:22:32 +01:00
ENDPROC( s t e x t )
2006-03-27 14:58:25 +01:00
/ *
* Set t h e C o n t r o l R e g i s t e r a n d R e a d t h e p r o c e s s I D .
* /
__after_proc_init :
2006-09-26 17:36:37 +09:00
# ifdef C O N F I G _ C P U _ C P 1 5
2009-07-24 12:34:59 +01:00
/ *
* CP1 5 s y s t e m c o n t r o l r e g i s t e r v a l u e r e t u r n e d i n r0 f r o m
* the C P U i n i t f u n c t i o n .
* /
2006-03-27 14:58:25 +01:00
# ifdef C O N F I G _ A L I G N M E N T _ T R A P
orr r0 , r0 , #C R _ A
# else
bic r0 , r0 , #C R _ A
# endif
# ifdef C O N F I G _ C P U _ D C A C H E _ D I S A B L E
bic r0 , r0 , #C R _ C
# endif
# ifdef C O N F I G _ C P U _ B P R E D I C T _ D I S A B L E
bic r0 , r0 , #C R _ Z
# endif
# ifdef C O N F I G _ C P U _ I C A C H E _ D I S A B L E
bic r0 , r0 , #C R _ I
2006-09-28 21:46:34 +09:00
# endif
# ifdef C O N F I G _ C P U _ H I G H _ V E C T O R
orr r0 , r0 , #C R _ V
# else
bic r0 , r0 , #C R _ V
2006-03-27 14:58:25 +01:00
# endif
mcr p15 , 0 , r0 , c1 , c0 , 0 @ write control reg
2006-09-26 17:36:37 +09:00
# endif / * C O N F I G _ C P U _ C P 1 5 * /
2006-03-27 14:58:25 +01:00
2010-10-01 15:42:02 +01:00
b _ _ m m a p _ s w i t c h e d @ clear the BSS and jump
2006-03-27 14:58:25 +01:00
@ to start_kernel
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ a f t e r _ p r o c _ i n i t )
2006-04-24 09:45:35 +01:00
.ltorg
2006-03-27 14:58:25 +01:00
# include " h e a d - c o m m o n . S "