2005-04-17 02:20:36 +04:00
/ *
2005-11-07 11:59:12 +03:00
* arch/ s39 0 / k e r n e l / h e a d64 . S
2005-04-17 02:20:36 +04:00
*
2006-06-29 16:58:17 +04:00
* Copyright ( C ) I B M C o r p . 1 9 9 9 ,2 0 0 6
2005-11-07 11:59:12 +03:00
*
* Author( s ) : H a r t m u t P e n n e r < h p @de.ibm.com>
* Martin S c h w i d e f s k y < s c h w i d e f s k y @de.ibm.com>
* Rob v a n d e r H e i j < r v d h e i @iae.nl>
* Heiko C a r s t e n s < h e i k o . c a r s t e n s @de.ibm.com>
2005-04-17 02:20:36 +04:00
*
* /
#
2005-11-07 11:59:12 +03:00
# startup- c o d e a t 0 x10 0 0 0 , r u n n i n g i n a b s o l u t e a d d r e s s i n g m o d e
2005-04-17 02:20:36 +04:00
# this i s c a l l e d e i t h e r b y t h e i p l l o a d e r o r d i r e c t l y b y P S W r e s t a r t
# or l i n l o a d o r S A L I P L
#
2006-09-28 18:56:37 +04:00
.org 0x10000
startup : basr % r13 ,0 # g e t b a s e
.LPG0 : l % r13 ,0 f - . L P G 0 ( % r13 )
b 0 ( % r13 )
0 : .long s t a r t u p _ c o n t i n u e
2006-06-29 16:58:17 +04:00
#
# params a t 1 0 4 0 0 ( s e t u p . h )
#
2006-09-28 18:56:37 +04:00
.org PARMAREA
.quad 0 # IPL_ D E V I C E
.quad 0 # INITRD_ S T A R T
.quad 0 # INITRD_ S I Z E
2006-06-29 16:58:17 +04:00
2006-09-28 18:56:37 +04:00
.org COMMAND_LINE
.byte " root= / d e v / r a m 0 r o "
.byte 0
2006-06-29 16:58:17 +04:00
2006-09-28 18:56:37 +04:00
.org 0x11000
2006-06-29 16:58:17 +04:00
startup_continue :
2006-09-28 18:56:37 +04:00
basr % r13 ,0 # g e t b a s e
.LPG1 : sll % r13 ,1 # r e m o v e h i g h o r d e r b i t
srl % r13 ,1
lhi % r1 ,1 # m o d e 1 = e s a m e
mvi _ _ L C _ A R _ M O D E _ I D ,1 # s e t e s a m e f l a g
slr % r0 ,% r0 # s e t c p u i d t o z e r o
sigp % r1 ,% r0 ,0 x12 # s w i t c h t o e s a m e m o d e
sam6 4 # s w i t c h t o 64 b i t m o d e
lctlg % c0 ,% c15 ,. L c t l - . L P G 1 ( % r13 ) # l o a d c o n t r o l r e g i s t e r s
lg % r12 ,. L p a r m a d d r - . L P G 1 ( % r13 ) # p o i n t e r t o p a r a m e t e r a r e a
# move I P L d e v i c e t o l o w c o r e
mvc _ _ L C _ I P L D E V ( 4 ) ,I P L _ D E V I C E + 4 - P A R M A R E A ( % r12 )
2006-09-20 17:59:15 +04:00
#
# Setup s t a c k
#
2006-09-28 18:56:37 +04:00
larl % r15 ,i n i t _ t h r e a d _ u n i o n
lg % r14 ,_ _ T I _ t a s k ( % r15 ) # c a c h e c u r r e n t i n l o w c o r e
stg % r14 ,_ _ L C _ C U R R E N T
aghi % r15 ,1 < < ( P A G E _ S H I F T + T H R E A D _ O R D E R ) # i n i t _ t a s k _ u n i o n + T H R E A D _ S I Z E
stg % r15 ,_ _ L C _ K E R N E L _ S T A C K # s e t e n d o f k e r n e l s t a c k
aghi % r15 ,- 1 6 0
xc _ _ S F _ B A C K C H A I N ( 4 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 ) # c l e a r b a c k c h a i n
2005-04-17 02:20:36 +04:00
#
2007-02-05 23:18:24 +03:00
# Save i p l p a r a m e t e r s , c l e a r b s s m e m o r y , i n i t i a l i z e s t o r a g e k e y f o r k e r n e l p a g e s ,
# and c r e a t e a k e r n e l N S S i f t h e S A V E S Y S = p a r m i s d e f i n e d
2005-04-17 02:20:36 +04:00
#
2007-02-05 23:18:24 +03:00
brasl % r14 ,s t a r t u p _ i n i t
2006-12-04 17:40:42 +03:00
# set p r o g r a m c h e c k n e w p s w m a s k
mvc _ _ L C _ P G M _ N E W _ P S W ( 8 ) ,. L p c m s k - . L P G 1 ( % r13 )
2006-09-28 18:56:37 +04:00
larl % r12 ,m a c h i n e _ f l a g s
2005-04-17 02:20:36 +04:00
#
# find o u t i f w e h a v e t h e M V P G i n s t r u c t i o n
#
2006-09-28 18:56:37 +04:00
la % r1 ,0 f - . L P G 1 ( % r13 ) # s e t p r o g r a m c h e c k a d d r e s s
stg % r1 ,_ _ L C _ P G M _ N E W _ P S W + 8
sgr % r0 ,% r0
lghi % r1 ,0
lghi % r2 ,0
mvpg % r1 ,% r2 # t e s t M V P G i n s t r u c t i o n
oi 7 ( % r12 ) ,1 6 # s e t M V P G f l a g
2005-04-17 02:20:36 +04:00
0 :
#
# find o u t i f t h e d i a g 0 x44 w o r k s i n 6 4 b i t m o d e
#
2006-09-28 18:56:37 +04:00
la % r1 ,0 f - . L P G 1 ( % r13 ) # s e t p r o g r a m c h e c k a d d r e s s
stg % r1 ,_ _ L C _ P G M _ N E W _ P S W + 8
diag 0 ,0 ,0 x44 # t e s t d i a g 0x44
oi 7 ( % r12 ) ,3 2 # s e t d i a g 44 f l a g
0 :
2005-04-17 02:20:36 +04:00
#
# find o u t i f w e h a v e t h e I D T E i n s t r u c t i o n
#
2006-09-28 18:56:37 +04:00
la % r1 ,0 f - . L P G 1 ( % r13 ) # s e t p r o g r a m c h e c k a d d r e s s
stg % r1 ,_ _ L C _ P G M _ N E W _ P S W + 8
2005-04-17 02:20:36 +04:00
.long 0xb2b10000 # store f a c i l i t y l i s t
tm 0 x c8 ,0 x08 # c h e c k b i t f o r c l e a r i n g - b y - A S C E
bno 0 f - . L P G 1 ( % r13 )
lhi % r1 ,2 0 9 4
lhi % r2 ,0
.long 0xb98e2001
oi 7 ( % r12 ) ,0 x80 # s e t I D T E f l a g
0 :
2006-10-01 10:27:45 +04:00
#
# find o u t i f t h e d i a g 0 x9 c i s a v a i l a b l e
#
2006-10-04 22:02:15 +04:00
la % r1 ,0 f - . L P G 1 ( % r13 ) # s e t p r o g r a m c h e c k a d d r e s s
stg % r1 ,_ _ L C _ P G M _ N E W _ P S W + 8
stap _ _ L C _ C P U I D + 4 # s t o r e c p u a d d r e s s
lh % r1 ,_ _ L C _ C P U I D + 4
diag % r1 ,0 ,0 x9 c # t e s t d i a g 0x9c
oi 6 ( % r12 ) ,1 # s e t d i a g 9 c f l a g
2006-10-01 10:27:45 +04:00
0 :
2006-09-20 17:59:44 +04:00
#
# find o u t i f w e h a v e t h e M V C O S i n s t r u c t i o n
#
la % r1 ,0 f - . L P G 1 ( % r13 ) # s e t p r o g r a m c h e c k a d d r e s s
stg % r1 ,_ _ L C _ P G M _ N E W _ P S W + 8
.short 0xc800 # mvcos 0 ( % r0 ) ,0 ( % r0 ) ,% r0
.short 0x0000
.short 0x0000
0 : tm 0 x8 f ,0 x13 # s p e c i a l - o p e r a t i o n e x c e p t i o n ?
bno 1 f - . L P G 1 ( % r13 ) # i f y e s , M V C O S i s p r e s e n t
oi 6 ( % r12 ) ,2 # s e t M V C O S f l a g
1 :
2006-09-28 18:56:37 +04:00
lpswe . L e n t r y - . L P G 1 ( 1 3 ) # j u m p t o _ s t e x t i n p r i m a r y - s p a c e ,
# virtual a n d n e v e r r e t u r n . . .
.align 16
.Lentry : .quad 0 x0 0 0 0 0 0 0 1 8 0 0 0 0 0 0 0 ,_ s t e x t
.Lctl : .quad 0x04b50002 # cr0 : various t h i n g s
.quad 0 # cr1 : primary s p a c e s e g m e n t t a b l e
.quad .Lduct # cr2 : dispatchable u n i t c o n t r o l t a b l e
.quad 0 # cr3 : instruction a u t h o r i z a t i o n
.quad 0 # cr4 : instruction a u t h o r i z a t i o n
.quad 0xffffffffffffffff # cr5 : primary- a s t e o r i g i n
.quad 0 # cr6 : I/ O i n t e r r u p t s
.quad 0 # cr7 : secondary s p a c e s e g m e n t t a b l e
.quad 0 # cr8 : access r e g i s t e r s t r a n s l a t i o n
.quad 0 # cr9 : tracing o f f
.quad 0 # cr10 : tracing o f f
.quad 0 # cr11 : tracing o f f
.quad 0 # cr12 : tracing o f f
.quad 0 # cr13 : home s p a c e s e g m e n t t a b l e
.quad 0xc0000000 # cr14 : machine c h e c k h a n d l i n g o f f
.quad 0 # cr15 : linkage s t a c k o p e r a t i o n s
.Lduct : .long 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
.long 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
.Lpcmsk : .quad 0x0000000180000000
2005-04-17 02:20:36 +04:00
.L4malign : .quad 0xffffffffffc00000
2006-09-28 18:56:37 +04:00
.Lscan2g : .quad 0x80000000 + 0 x2 0 0 0 0 - 8 # 2 G B + 1 2 8 K - 8
.Lnop : .long 0x07000700
2006-06-29 16:58:17 +04:00
.Lparmaddr :
.quad PARMAREA
2005-04-17 02:20:36 +04:00
2006-07-18 15:44:57 +04:00
.org 0x12000
2007-02-21 12:55:37 +03:00
.globl _ehead
_ehead :
2005-04-17 02:20:36 +04:00
# ifdef C O N F I G _ S H A R E D _ K E R N E L
2006-09-28 18:56:37 +04:00
.org 0x100000
2005-04-17 02:20:36 +04:00
# endif
2006-09-28 18:56:37 +04:00
2005-04-17 02:20:36 +04:00
#
2006-06-29 16:58:17 +04:00
# startup- c o d e , r u n n i n g i n a b s o l u t e a d d r e s s i n g m o d e
2005-04-17 02:20:36 +04:00
#
2006-09-28 18:56:37 +04:00
.globl _stext
_stext : basr % r13 ,0 # g e t b a s e
2005-10-31 02:00:11 +03:00
.LPG3 :
2005-04-17 02:20:36 +04:00
# check c o n t r o l r e g i s t e r s
2006-09-28 18:56:37 +04:00
stctg % c0 ,% c15 ,0 ( % r15 )
oi 6 ( % r15 ) ,0 x40 # e n a b l e s i g p e m e r g e n c y s i g n a l
oi 4 ( % r15 ) ,0 x10 # s w i t c h o n l o w a d d r e s s p r o c t e c t i o n
lctlg % c0 ,% c15 ,0 ( % r15 )
2005-04-17 02:20:36 +04:00
2006-09-28 18:56:37 +04:00
lam 0 ,1 5 ,. L a r e g s - . L P G 3 ( % r13 ) # l o a d a c r s n e e d e d b y u a c c e s s
brasl % r14 ,s t a r t _ k e r n e l # g o t o C c o d e
2005-04-17 02:20:36 +04:00
#
# We r e t u r n e d f r o m s t a r t _ k e r n e l ? ! ? P A N I K
#
2006-09-28 18:56:37 +04:00
basr % r13 ,0
lpswe . L d w - . ( % r13 ) # l o a d d i s a b l e d w a i t p s w
2006-09-20 17:59:15 +04:00
2006-09-28 18:56:37 +04:00
.align 8
.Ldw : .quad 0 x0 0 0 2 0 0 0 1 8 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0
.Laregs : .long 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0