2005-04-17 02:20:36 +04:00
/ *
2006-02-01 14:06:38 +03:00
* arch/ s39 0 / k e r n e l / e n t r y 6 4 . S
2005-04-17 02:20:36 +04:00
* S3 9 0 l o w - l e v e l e n t r y p o i n t s .
*
2010-05-17 12:00:04 +04:00
* Copyright ( C ) I B M C o r p . 1 9 9 9 ,2 0 1 0
2005-04-17 02:20:36 +04:00
* Author( s ) : M a r t i n 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),
2006-09-28 18:56:37 +04:00
* Hartmut P e n n e r ( h p @de.ibm.com),
* Denis J o s e p h B a r r o w ( d j b a r r o w @de.ibm.com,barrow_dj@yahoo.com),
2005-06-26 01:55:30 +04:00
* 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
* /
2008-02-05 18:50:40 +03:00
# include < l i n u x / i n i t . h >
2011-07-24 12:48:19 +04:00
# include < l i n u x / l i n k a g e . h >
2005-04-17 02:20:36 +04:00
# include < a s m / c a c h e . h >
# include < a s m / e r r n o . h >
# include < a s m / p t r a c e . h >
# include < a s m / t h r e a d _ i n f o . h >
2005-09-09 22:57:26 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-17 02:20:36 +04:00
# include < a s m / u n i s t d . h >
# include < a s m / p a g e . h >
2011-12-27 14:27:15 +04:00
_ _ PT_ R 0 = _ _ P T _ G P R S
_ _ PT_ R 1 = _ _ P T _ G P R S + 8
_ _ PT_ R 2 = _ _ P T _ G P R S + 1 6
_ _ PT_ R 3 = _ _ P T _ G P R S + 2 4
_ _ PT_ R 4 = _ _ P T _ G P R S + 3 2
_ _ PT_ R 5 = _ _ P T _ G P R S + 4 0
_ _ PT_ R 6 = _ _ P T _ G P R S + 4 8
_ _ PT_ R 7 = _ _ P T _ G P R S + 5 6
_ _ PT_ R 8 = _ _ P T _ G P R S + 6 4
_ _ PT_ R 9 = _ _ P T _ G P R S + 7 2
_ _ PT_ R 1 0 = _ _ P T _ G P R S + 8 0
_ _ PT_ R 1 1 = _ _ P T _ G P R S + 8 8
_ _ PT_ R 1 2 = _ _ P T _ G P R S + 9 6
_ _ PT_ R 1 3 = _ _ P T _ G P R S + 1 0 4
_ _ PT_ R 1 4 = _ _ P T _ G P R S + 1 1 2
_ _ PT_ R 1 5 = _ _ P T _ G P R S + 1 2 0
2005-04-17 02:20:36 +04:00
STACK_ S H I F T = P A G E _ S H I F T + T H R E A D _ O R D E R
STACK_ S I Z E = 1 < < S T A C K _ S H I F T
2008-10-10 23:33:20 +04:00
_ TIF_ W O R K _ S V C = ( _ T I F _ S I G P E N D I N G | _ T I F _ N O T I F Y _ R E S U M E | _ T I F _ N E E D _ R E S C H E D | \
2011-10-30 18:16:49 +04:00
_ TIF_ M C C K _ P E N D I N G | _ T I F _ P E R _ T R A P )
2008-10-10 23:33:20 +04:00
_ TIF_ W O R K _ I N T = ( _ T I F _ S I G P E N D I N G | _ T I F _ N O T I F Y _ R E S U M E | _ T I F _ N E E D _ R E S C H E D | \
2006-02-01 14:06:38 +03:00
_ TIF_ M C C K _ P E N D I N G )
2011-10-30 18:16:49 +04:00
_ TIF_ T R A C E = ( _ T I F _ S Y S C A L L _ T R A C E | _ T I F _ S Y S C A L L _ A U D I T | _ T I F _ S E C C O M P | \
_ TIF_ S Y S C A L L _ T R A C E P O I N T )
2011-07-24 12:48:18 +04:00
_ TIF_ E X I T _ S I E = ( _ T I F _ S I G P E N D I N G | _ T I F _ N E E D _ R E S C H E D | _ T I F _ M C C K _ P E N D I N G )
2005-04-17 02:20:36 +04:00
# define B A S E D ( n a m e ) n a m e - s y s t e m _ c a l l ( % r13 )
2006-07-03 11:24:46 +04:00
.macro TRACE_IRQS_ON
2011-12-27 14:27:15 +04:00
# ifdef C O N F I G _ T R A C E _ I R Q F L A G S
2010-05-17 12:00:02 +04:00
basr % r2 ,% r0
brasl % r14 ,t r a c e _ h a r d i r q s _ o n _ c a l l e r
2011-12-27 14:27:15 +04:00
# endif
2006-07-03 11:24:46 +04:00
.endm
.macro TRACE_IRQS_OFF
2011-12-27 14:27:15 +04:00
# ifdef C O N F I G _ T R A C E _ I R Q F L A G S
2010-05-17 12:00:02 +04:00
basr % r2 ,% r0
brasl % r14 ,t r a c e _ h a r d i r q s _ o f f _ c a l l e r
2007-11-20 13:13:32 +03:00
# endif
2011-12-27 14:27:15 +04:00
.endm
2007-11-20 13:13:32 +03:00
.macro LOCKDEP_SYS_EXIT
2011-12-27 14:27:15 +04:00
# ifdef C O N F I G _ L O C K D E P
tm _ _ P T _ P S W + 1 ( % r11 ) ,0 x01 # r e t u r n i n g t o u s e r ?
jz . + 1 0
2007-11-20 13:13:32 +03:00
brasl % r14 ,l o c k d e p _ s y s _ e x i t
2006-07-03 11:24:46 +04:00
# endif
2005-04-17 02:20:36 +04:00
.endm
2011-12-27 14:27:15 +04:00
.macro SPP newpp
# if d e f i n e d ( C O N F I G _ K V M ) | | d e f i n e d ( C O N F I G _ K V M _ M O D U L E )
tm _ _ L C _ M A C H I N E _ F L A G S + 6 ,0 x20 # M A C H I N E _ F L A G _ S P P
jz . + 8
.insn s,0 x b28 0 0 0 0 0 ,\ n e w p p
# endif
.endm
2005-04-17 02:20:36 +04:00
2011-12-27 14:27:15 +04:00
.macro HANDLE_SIE_INTERCEPT scratch
# if d e f i n e d ( C O N F I G _ K V M ) | | d e f i n e d ( C O N F I G _ K V M _ M O D U L E )
tm _ _ T I _ f l a g s + 6 ( % r12 ) ,_ T I F _ S I E > > 8
jz . + 4 2
tm _ _ L C _ M A C H I N E _ F L A G S + 6 ,0 x20 # M A C H I N E _ F L A G _ S P P
jz . + 8
.insn s,0 x b28 0 0 0 0 0 ,B A S E D ( . L h o s t _ i d ) # s e t h o s t i d
lgr \ s c r a t c h ,% r9
slg \ s c r a t c h ,B A S E D ( . L s i e _ l o o p )
clg \ s c r a t c h ,B A S E D ( . L s i e _ l e n g t h )
jhe . + 1 0
lg % r9 ,B A S E D ( . L s i e _ l o o p )
# endif
2007-07-10 13:24:18 +04:00
.endm
2011-12-27 14:27:15 +04:00
.macro CHECK_STACK stacksize,s a v e a r e a
2006-06-29 16:58:05 +04:00
# ifdef C O N F I G _ C H E C K _ S T A C K
2011-12-27 14:27:15 +04:00
tml % r15 ,\ s t a c k s i z e - C O N F I G _ S T A C K _ G U A R D
lghi % r14 ,\ s a v e a r e a
jz s t a c k _ o v e r f l o w
2006-06-29 16:58:05 +04:00
# endif
.endm
2011-12-27 14:27:15 +04:00
.macro SWITCH_ASYNC savearea,s t a c k ,s h i f t
tmhh % r8 ,0 x00 0 1 # i n t e r r u p t i n g f r o m u s e r ?
jnz 1 f
lgr % r14 ,% r9
slg % r14 ,B A S E D ( . L c r i t i c a l _ s t a r t )
clg % r14 ,B A S E D ( . L c r i t i c a l _ l e n g t h )
2005-04-17 02:20:36 +04:00
jhe 0 f
2011-12-27 14:27:15 +04:00
lghi % r11 ,\ s a v e a r e a # i n s i d e c r i t i c a l s e c t i o n , d o c l e a n u p
2005-04-17 02:20:36 +04:00
brasl % r14 ,c l e a n u p _ c r i t i c a l
2011-12-27 14:27:15 +04:00
tmhh % r8 ,0 x00 0 1 # r e t e s t p r o b l e m s t a t e a f t e r c l e a n u p
2005-04-17 02:20:36 +04:00
jnz 1 f
2011-12-27 14:27:15 +04:00
0 : lg % r14 ,\ s t a c k # a r e w e a l r e a d y o n t h e t a r g e t s t a c k ?
2005-04-17 02:20:36 +04:00
slgr % r14 ,% r15
2011-12-27 14:27:15 +04:00
srag % r14 ,% r14 ,\ s h i f t
2010-05-17 12:00:05 +04:00
jnz 1 f
2011-12-27 14:27:15 +04:00
CHECK_ S T A C K 1 < < \ s h i f t ,\ s a v e a r e a
j 2 f
1 : lg % r15 ,\ s t a c k # l o a d t a r g e t s t a c k
2 : aghi % r15 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 )
2006-09-28 18:56:37 +04:00
.endm
2005-04-17 02:20:36 +04:00
2011-12-27 14:27:15 +04:00
.macro UPDATE_VTIME scratch,e n t e r _ t i m e r
lg \ s c r a t c h ,_ _ L C _ E X I T _ T I M E R
slg \ s c r a t c h ,\ e n t e r _ t i m e r
alg \ s c r a t c h ,_ _ L C _ U S E R _ T I M E R
stg \ s c r a t c h ,_ _ L C _ U S E R _ T I M E R
lg \ s c r a t c h ,_ _ L C _ L A S T _ U P D A T E _ T I M E R
slg \ s c r a t c h ,_ _ L C _ E X I T _ T I M E R
alg \ s c r a t c h ,_ _ L C _ S Y S T E M _ T I M E R
stg \ s c r a t c h ,_ _ L C _ S Y S T E M _ T I M E R
mvc _ _ L C _ L A S T _ U P D A T E _ T I M E R ( 8 ) ,\ e n t e r _ t i m e r
2005-04-17 02:20:36 +04:00
.endm
2011-12-27 14:27:15 +04:00
.macro LAST_BREAK scratch
srag \ s c r a t c h ,% r10 ,2 3
jz . + 1 0
stg % r10 ,_ _ T I _ l a s t _ b r e a k ( % r12 )
2010-05-17 12:00:05 +04:00
.endm
2010-10-25 18:10:37 +04:00
.macro REENABLE_IRQS
2011-12-27 14:27:15 +04:00
stg % r8 ,_ _ L C _ R E T U R N _ P S W
ni _ _ L C _ R E T U R N _ P S W ,0 x b f
ssm _ _ L C _ R E T U R N _ P S W
2010-10-25 18:10:37 +04:00
.endm
2011-01-05 14:47:25 +03:00
.section .kprobes .text , " ax"
2005-04-17 02:20:36 +04:00
/ *
* Scheduler r e s u m e f u n c t i o n , c a l l e d b y s w i t c h _ t o
* gpr2 = ( t a s k _ s t r u c t * ) p r e v
* gpr3 = ( t a s k _ s t r u c t * ) n e x t
* Returns :
* gpr2 = p r e v
* /
2011-07-24 12:48:19 +04:00
ENTRY( _ _ s w i t c h _ t o )
2011-01-05 14:48:10 +03:00
lg % r4 ,_ _ T H R E A D _ i n f o ( % r2 ) # g e t t h r e a d _ i n f o o f p r e v
lg % r5 ,_ _ T H R E A D _ i n f o ( % r3 ) # g e t t h r e a d _ i n f o o f n e x t
2005-06-26 01:55:30 +04:00
tm _ _ T I _ f l a g s + 7 ( % r4 ) ,_ T I F _ M C C K _ P E N D I N G # m a c h i n e c h e c k p e n d i n g ?
2011-01-05 14:48:10 +03:00
jz 0 f
ni _ _ T I _ f l a g s + 7 ( % r4 ) ,2 5 5 - _ T I F _ M C C K _ P E N D I N G # c l e a r f l a g i n p r e v
oi _ _ T I _ f l a g s + 7 ( % r5 ) ,_ T I F _ M C C K _ P E N D I N G # s e t i t i n n e x t
0 : stmg % r6 ,% r15 ,_ _ S F _ G P R S ( % r15 ) # s t o r e g p r s o f p r e v t a s k
stg % r15 ,_ _ T H R E A D _ k s p ( % r2 ) # s t o r e k e r n e l s t a c k o f p r e v
lg % r15 ,_ _ T H R E A D _ k s p ( % r3 ) # l o a d k e r n e l s t a c k o f n e x t
lctl % c4 ,% c4 ,_ _ T A S K _ p i d ( % r3 ) # l o a d p i d t o c o n t r o l r e g . 4
lmg % r6 ,% r15 ,_ _ S F _ G P R S ( % r15 ) # l o a d g p r s o f n e x t t a s k
stg % r3 ,_ _ L C _ C U R R E N T # s t o r e t a s k s t r u c t o f n e x t
2011-05-23 12:24:34 +04:00
mvc _ _ L C _ C U R R E N T _ P I D + 4 ( 4 ,% r0 ) ,_ _ T A S K _ p i d ( % r3 ) # s t o r e p i d o f n e x t
2011-01-05 14:48:10 +03:00
stg % r5 ,_ _ L C _ T H R E A D _ I N F O # s t o r e t h r e a d i n f o o f n e x t
aghi % r5 ,S T A C K _ S I Z E # e n d o f k e r n e l s t a c k o f n e x t
stg % r5 ,_ _ L C _ K E R N E L _ S T A C K # s t o r e e n d o f k e r n e l s t a c k
2005-04-17 02:20:36 +04:00
br % r14
__critical_start :
/ *
* SVC i n t e r r u p t h a n d l e r r o u t i n e . S y s t e m c a l l s a r e s y n c h r o n o u s e v e n t s a n d
* are e x e c u t e d w i t h i n t e r r u p t s e n a b l e d .
* /
2011-07-24 12:48:19 +04:00
ENTRY( s y s t e m _ c a l l )
2008-12-25 15:39:25 +03:00
stpt _ _ L C _ S Y N C _ E N T E R _ T I M E R
2011-12-27 14:27:15 +04:00
sysc_stmg :
stmg % r8 ,% r15 ,_ _ L C _ S A V E _ A R E A _ S Y N C
lg % r10 ,_ _ L C _ L A S T _ B R E A K
lg % r12 ,_ _ L C _ T H R E A D _ I N F O
larl % r13 ,s y s t e m _ c a l l
sysc_per :
lg % r15 ,_ _ L C _ K E R N E L _ S T A C K
aghi % r15 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 ) # p o i n t e r t o p t _ r e g s
2005-04-17 02:20:36 +04:00
sysc_vtime :
2011-12-27 14:27:15 +04:00
UPDATE_ V T I M E % r13 ,_ _ L C _ S Y N C _ E N T E R _ T I M E R
LAST_ B R E A K % r13
stmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r11 )
mvc _ _ P T _ R 8 ( 6 4 ,% r11 ) ,_ _ L C _ S A V E _ A R E A _ S Y N C
mvc _ _ P T _ P S W ( 1 6 ,% r11 ) ,_ _ L C _ S V C _ O L D _ P S W
2011-12-27 14:27:18 +04:00
mvc _ _ P T _ I N T _ C O D E ( 4 ,% r11 ) ,_ _ L C _ S V C _ I L C
2005-04-17 02:20:36 +04:00
sysc_do_svc :
2011-12-27 14:27:15 +04:00
oi _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ S Y S C A L L
2011-12-27 14:27:18 +04:00
llgh % r8 ,_ _ P T _ I N T _ C O D E + 2 ( % r11 )
2011-12-27 14:27:15 +04:00
slag % r8 ,% r8 ,2 # s h i f t a n d t e s t f o r s v c 0
2005-04-17 02:20:36 +04:00
jnz s y s c _ n r _ o k
# svc 0 : system c a l l n u m b e r i n % r1
2011-12-27 14:27:15 +04:00
llgfr % r1 ,% r1 # c l e a r h i g h w o r d i n r 1
2010-05-17 12:00:05 +04:00
cghi % r1 ,N R _ s y s c a l l s
2005-04-17 02:20:36 +04:00
jnl s y s c _ n r _ o k
2011-12-27 14:27:18 +04:00
sth % r1 ,_ _ P T _ I N T _ C O D E + 2 ( % r11 )
2011-12-27 14:27:15 +04:00
slag % r8 ,% r1 ,2
2005-04-17 02:20:36 +04:00
sysc_nr_ok :
2011-12-27 14:27:15 +04:00
larl % r10 ,s y s _ c a l l _ t a b l e # 64 b i t s y s t e m c a l l t a b l e
2006-01-06 11:19:28 +03:00
# ifdef C O N F I G _ C O M P A T
2011-12-27 14:27:15 +04:00
tm _ _ T I _ f l a g s + 5 ( % r12 ) ,( _ T I F _ 3 1 B I T > > 1 6 )
2005-09-04 02:58:04 +04:00
jno s y s c _ n o e m u
2011-12-27 14:27:15 +04:00
larl % r10 ,s y s _ c a l l _ t a b l e _ e m u # 31 b i t s y s t e m c a l l t a b l e
2005-04-17 02:20:36 +04:00
sysc_noemu :
# endif
2011-12-27 14:27:15 +04:00
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
stg % r2 ,_ _ P T _ O R I G _ G P R 2 ( % r11 )
stg % r7 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 )
lgf % r9 ,0 ( % r8 ,% r10 ) # g e t s y s t e m c a l l a d d .
2011-10-30 18:16:49 +04:00
tm _ _ T I _ f l a g s + 6 ( % r12 ) ,_ T I F _ T R A C E > > 8
2006-09-28 18:56:37 +04:00
jnz s y s c _ t r a c e s y s
2011-12-27 14:27:15 +04:00
basr % r14 ,% r9 # c a l l s y s _ x x x x
stg % r2 ,_ _ P T _ R 2 ( % r11 ) # s t o r e r e t u r n v a l u e
2005-04-17 02:20:36 +04:00
sysc_return :
2010-05-17 12:00:02 +04:00
LOCKDEP_ S Y S _ E X I T
sysc_tif :
2011-12-27 14:27:15 +04:00
tm _ _ P T _ P S W + 1 ( % r11 ) ,0 x01 # r e t u r n i n g t o u s e r ?
2011-10-30 18:16:49 +04:00
jno s y s c _ r e s t o r e
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ W O R K _ S V C
2011-12-27 14:27:15 +04:00
jnz s y s c _ w o r k # c h e c k f o r w o r k
2011-10-30 18:16:49 +04:00
ni _ _ T I _ f l a g s + 7 ( % r12 ) ,2 5 5 - _ T I F _ S Y S C A L L
2007-11-20 13:13:32 +03:00
sysc_restore :
2011-12-27 14:27:15 +04:00
lg % r14 ,_ _ L C _ V D S O _ P E R _ C P U
lmg % r0 ,% r10 ,_ _ P T _ R 0 ( % r11 )
mvc _ _ L C _ R E T U R N _ P S W ( 1 6 ) ,_ _ P T _ P S W ( % r11 )
stpt _ _ L C _ E X I T _ T I M E R
mvc _ _ V D S O _ E C T G _ B A S E ( 1 6 ,% r14 ) ,_ _ L C _ E X I T _ T I M E R
lmg % r11 ,% r15 ,_ _ P T _ R 1 1 ( % r11 )
lpswe _ _ L C _ R E T U R N _ P S W
2007-11-20 13:13:32 +03:00
sysc_done :
2010-05-17 12:00:01 +04:00
#
# One o f t h e w o r k b i t s i s o n . F i n d o u t w h i c h o n e .
#
2011-10-30 18:16:49 +04:00
sysc_work :
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ M C C K _ P E N D I N G
2005-06-26 01:55:30 +04:00
jo s y s c _ m c c k _ p e n d i n g
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ N E E D _ R E S C H E D
2005-04-17 02:20:36 +04:00
jo s y s c _ r e s c h e d u l e
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ S I G P E N D I N G
2010-05-17 12:00:01 +04:00
jo s y s c _ s i g p e n d i n g
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ N O T I F Y _ R E S U M E
2010-05-17 12:00:01 +04:00
jo s y s c _ n o t i f y _ r e s u m e
2011-01-05 14:48:10 +03:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ P E R _ T R A P
2005-04-17 02:20:36 +04:00
jo s y s c _ s i n g l e s t e p
2010-05-17 12:00:01 +04:00
j s y s c _ r e t u r n # b e w a r e o f c r i t i c a l s e c t i o n c l e a n u p
2005-04-17 02:20:36 +04:00
#
# _ TIF_ N E E D _ R E S C H E D i s s e t , c a l l s c h e d u l e
2006-09-28 18:56:37 +04:00
#
sysc_reschedule :
2010-05-17 12:00:02 +04:00
larl % r14 ,s y s c _ r e t u r n
2011-12-27 14:27:15 +04:00
jg s c h e d u l e
2005-04-17 02:20:36 +04:00
2005-06-26 01:55:30 +04:00
#
# _ TIF_ M C C K _ P E N D I N G i s s e t , c a l l h a n d l e r
#
sysc_mcck_pending :
2010-05-17 12:00:02 +04:00
larl % r14 ,s y s c _ r e t u r n
2006-09-28 18:56:37 +04:00
jg s39 0 _ h a n d l e _ m c c k # T I F b i t w i l l b e c l e a r e d b y h a n d l e r
2005-06-26 01:55:30 +04:00
2005-04-17 02:20:36 +04:00
#
2008-04-30 11:53:08 +04:00
# _ TIF_ S I G P E N D I N G i s s e t , c a l l d o _ s i g n a l
2005-04-17 02:20:36 +04:00
#
2006-09-28 18:56:37 +04:00
sysc_sigpending :
2011-01-05 14:48:10 +03:00
ni _ _ T I _ f l a g s + 7 ( % r12 ) ,2 5 5 - _ T I F _ P E R _ T R A P # c l e a r T I F _ P E R _ T R A P
2011-12-27 14:27:15 +04:00
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
brasl % r14 ,d o _ s i g n a l
2011-10-30 18:16:49 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ S Y S C A L L
jno s y s c _ r e t u r n
2011-12-27 14:27:15 +04:00
lmg % r2 ,% r7 ,_ _ P T _ R 2 ( % r11 ) # l o a d s v c a r g u m e n t s
lghi % r8 ,0 # s v c 0 r e t u r n s - E N O S Y S
2011-12-27 14:27:18 +04:00
lh % r1 ,_ _ P T _ I N T _ C O D E + 2 ( % r11 ) # l o a d n e w s v c n u m b e r
2011-10-30 18:16:49 +04:00
cghi % r1 ,N R _ s y s c a l l s
jnl s y s c _ n r _ o k # i n v a l i d s v c n u m b e r - > d o s v c 0
2011-12-27 14:27:15 +04:00
slag % r8 ,% r1 ,2
2011-10-30 18:16:49 +04:00
j s y s c _ n r _ o k # r e s t a r t s v c
2005-04-17 02:20:36 +04:00
2008-10-10 23:33:20 +04:00
#
# _ TIF_ N O T I F Y _ R E S U M E i s s e t , c a l l d o _ n o t i f y _ r e s u m e
#
sysc_notify_resume :
2011-12-27 14:27:15 +04:00
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
2010-05-17 12:00:02 +04:00
larl % r14 ,s y s c _ r e t u r n
2011-12-27 14:27:15 +04:00
jg d o _ n o t i f y _ r e s u m e
2008-10-10 23:33:20 +04:00
2005-04-17 02:20:36 +04:00
#
2011-01-05 14:48:10 +03:00
# _ TIF_ P E R _ T R A P i s s e t , c a l l d o _ p e r _ t r a p
2005-04-17 02:20:36 +04:00
#
sysc_singlestep :
2011-10-30 18:16:49 +04:00
ni _ _ T I _ f l a g s + 7 ( % r12 ) ,2 5 5 - ( _ T I F _ S Y S C A L L | _ T I F _ P E R _ T R A P )
2011-12-27 14:27:15 +04:00
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
larl % r14 ,s y s c _ r e t u r n
2011-01-05 14:48:10 +03:00
jg d o _ p e r _ t r a p
2005-04-17 02:20:36 +04:00
#
2008-10-10 23:33:20 +04:00
# call t r a c e h o o k _ r e p o r t _ s y s c a l l _ e n t r y / t r a c e h o o k _ r e p o r t _ s y s c a l l _ e x i t b e f o r e
# and a f t e r t h e s y s t e m c a l l
2005-04-17 02:20:36 +04:00
#
sysc_tracesys :
2011-12-27 14:27:15 +04:00
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
2005-04-17 02:20:36 +04:00
la % r3 ,0
2011-12-27 14:27:18 +04:00
llgh % r0 ,_ _ P T _ I N T _ C O D E + 2 ( % r11 )
2011-12-27 14:27:15 +04:00
stg % r0 ,_ _ P T _ R 2 ( % r11 )
2008-10-10 23:33:20 +04:00
brasl % r14 ,d o _ s y s c a l l _ t r a c e _ e n t e r
2005-04-17 02:20:36 +04:00
lghi % r0 ,N R _ s y s c a l l s
2008-10-10 23:33:20 +04:00
clgr % r0 ,% r2
2005-04-17 02:20:36 +04:00
jnh s y s c _ t r a c e n o g o
2011-12-27 14:27:15 +04:00
sllg % r8 ,% r2 ,2
lgf % r9 ,0 ( % r8 ,% r10 )
2005-04-17 02:20:36 +04:00
sysc_tracego :
2011-12-27 14:27:15 +04:00
lmg % r3 ,% r7 ,_ _ P T _ R 3 ( % r11 )
stg % r7 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 )
lg % r2 ,_ _ P T _ O R I G _ G P R 2 ( % r11 )
basr % r14 ,% r9 # c a l l s y s _ x x x
stg % r2 ,_ _ P T _ R 2 ( % r11 ) # s t o r e r e t u r n v a l u e
2005-04-17 02:20:36 +04:00
sysc_tracenogo :
2011-10-30 18:16:49 +04:00
tm _ _ T I _ f l a g s + 6 ( % r12 ) ,_ T I F _ T R A C E > > 8
2006-09-28 18:56:37 +04:00
jz s y s c _ r e t u r n
2011-12-27 14:27:15 +04:00
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
larl % r14 ,s y s c _ r e t u r n
2008-10-10 23:33:20 +04:00
jg d o _ s y s c a l l _ t r a c e _ e x i t
2005-04-17 02:20:36 +04:00
#
# a n e w p r o c e s s e x i t s t h e k e r n e l w i t h r e t _ f r o m _ f o r k
#
2011-07-24 12:48:19 +04:00
ENTRY( r e t _ f r o m _ f o r k )
2011-12-27 14:27:15 +04:00
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 )
lg % r12 ,_ _ L C _ T H R E A D _ I N F O
tm _ _ P T _ P S W + 1 ( % r11 ) ,0 x01 # f o r k i n g a k e r n e l t h r e a d ?
2005-04-17 02:20:36 +04:00
jo 0 f
2011-12-27 14:27:15 +04:00
stg % r15 ,_ _ P T _ R 1 5 ( % r11 ) # s t o r e s t a c k p o i n t e r f o r n e w k t h r e a d
2006-09-28 18:56:37 +04:00
0 : brasl % r14 ,s c h e d u l e _ t a i l
2006-07-03 11:24:46 +04:00
TRACE_ I R Q S _ O N
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ S V C _ N E W _ P S W # r e e n a b l e i n t e r r u p t s
[S390] audit: get s390 ret_from_fork in sync with other architectures
On s390 we have ret_from_fork jump not to the "do all work we
normally do on return from syscall" as on x86, ppc, etc., but to the
"do all such work except audit". Historical reasons - the codepath
triggered when we have AUDIT process flag set is separated from the
normall one and they converge at sysc_return, which is the common
part of post-syscall work. And does not include calling audit_syscall_exit() -
that's done in the end of sysc_tracesys path, just before that path jumps
to sysc_return.
IOW, the child returning from fork()/clone()/vfork() doesn't
call audit_syscall_exit() at all, so no matter what we do with its
audit context, we are not going to see the audit entry.
The fix is simple: have ret_from_fork go to the point just past
the call of sys_.... in the 'we have AUDIT flag set' path. There we
have (64bit variant; for 31bit the situation is the same):
sysc_tracenogo:
tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
jz sysc_return
la %r2,SP_PTREGS(%r15) # load pt_regs
larl %r14,sysc_return # return point is sysc_return
jg do_syscall_trace_exit
which is precisely what we need - check the flag, bugger off to sysc_return
if not set, otherwise call do_syscall_trace_exit() and bugger off to
sysc_return. r9 has just been properly set by ret_from_fork itself,
so we are fine.
Tested on s390x, seems to work fine. WARNING: it's been about
16 years since my last contact with 3X0 assembler[1], so additional
review would be very welcome. I don't think I've managed to screw it
up, but...
[1] that *was* in another country and besides, the box is dead...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-12-25 15:37:58 +03:00
j s y s c _ t r a c e n o g o
2005-04-17 02:20:36 +04:00
#
2007-04-27 18:01:40 +04:00
# kernel_ e x e c v e f u n c t i o n n e e d s t o d e a l w i t h p t _ r e g s t h a t i s n o t
# at t h e u s u a l p l a c e
2005-04-17 02:20:36 +04:00
#
2011-07-24 12:48:19 +04:00
ENTRY( k e r n e l _ e x e c v e )
2007-04-27 18:01:40 +04:00
stmg % r12 ,% r15 ,9 6 ( % r15 )
lgr % r14 ,% r15
2011-12-27 14:27:15 +04:00
aghi % r15 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
2007-04-27 18:01:40 +04:00
stg % r14 ,_ _ S F _ B A C K C H A I N ( % r15 )
2011-12-27 14:27:15 +04:00
la % r12 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 )
2007-04-27 18:01:40 +04:00
xc 0 ( _ _ P T _ S I Z E ,% r12 ) ,0 ( % r12 )
lgr % r5 ,% r12
brasl % r14 ,d o _ e x e c v e
ltgfr % r2 ,% r2
je 0 f
2011-12-27 14:27:15 +04:00
aghi % r15 ,( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
2007-04-27 18:01:40 +04:00
lmg % r12 ,% r15 ,9 6 ( % r15 )
br % r14
# execve s u c c e e d e d .
2011-12-27 14:27:15 +04:00
0 : ssm _ _ L C _ P G M _ N E W _ P S W # d i s a b l e I / O a n d e x t . i n t e r r u p t s
2007-04-27 18:01:40 +04:00
lg % r15 ,_ _ L C _ K E R N E L _ S T A C K # l o a d k s p
2011-12-27 14:27:15 +04:00
aghi % r15 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 )
mvc 0 ( _ _ P T _ S I Z E ,% r11 ) ,0 ( % r12 ) # c o p y p t _ r e g s
2010-05-17 12:00:05 +04:00
lg % r12 ,_ _ L C _ T H R E A D _ I N F O
2007-04-27 18:01:40 +04:00
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ S V C _ N E W _ P S W # r e e n a b l e i n t e r r u p t s
2007-04-27 18:01:40 +04:00
brasl % r14 ,e x e c v e _ t a i l
j s y s c _ r e t u r n
2005-04-17 02:20:36 +04:00
/ *
* Program c h e c k h a n d l e r r o u t i n e
* /
2011-07-24 12:48:19 +04:00
ENTRY( p g m _ c h e c k _ h a n d l e r )
2008-12-25 15:39:25 +03:00
stpt _ _ L C _ S Y N C _ E N T E R _ T I M E R
2011-12-27 14:27:15 +04:00
stmg % r8 ,% r15 ,_ _ L C _ S A V E _ A R E A _ S Y N C
lg % r10 ,_ _ L C _ L A S T _ B R E A K
lg % r12 ,_ _ L C _ T H R E A D _ I N F O
larl % r13 ,s y s t e m _ c a l l
lmg % r8 ,% r9 ,_ _ L C _ P G M _ O L D _ P S W
HANDLE_ S I E _ I N T E R C E P T % r14
tmhh % r8 ,0 x00 0 1 # t e s t p r o b l e m s t a t e b i t
jnz 1 f # - > f a u l t i n u s e r s p a c e
tmhh % r8 ,0 x40 0 0 # P E R b i t s e t i n o l d P S W ?
jnz 0 f # - > e n a b l e d , c a n ' t b e a d o u b l e f a u l t
tm _ _ L C _ P G M _ I L C + 3 ,0 x80 # c h e c k f o r p e r e x c e p t i o n
jnz p g m _ s v c p e r # - > s i n g l e s t e p p e d s v c
0 : CHECK_ S T A C K S T A C K _ S I Z E ,_ _ L C _ S A V E _ A R E A _ S Y N C
j 2 f
1 : UPDATE_ V T I M E % r14 ,_ _ L C _ S Y N C _ E N T E R _ T I M E R
LAST_ B R E A K % r14
lg % r15 ,_ _ L C _ K E R N E L _ S T A C K
2 : aghi % r15 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r15 )
stmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r11 )
mvc _ _ P T _ R 8 ( 6 4 ,% r11 ) ,_ _ L C _ S A V E _ A R E A _ S Y N C
stmg % r8 ,% r9 ,_ _ P T _ P S W ( % r11 )
2011-12-27 14:27:18 +04:00
mvc _ _ P T _ I N T _ C O D E ( 4 ,% r11 ) ,_ _ L C _ P G M _ I L C
mvc _ _ P T _ I N T _ P A R M _ L O N G ( 8 ,% r11 ) ,_ _ L C _ T R A N S _ E X C _ C O D E
2011-12-27 14:27:15 +04:00
stg % r10 ,_ _ P T _ A R G S ( % r11 )
tm _ _ L C _ P G M _ I L C + 3 ,0 x80 # c h e c k f o r p e r e x c e p t i o n
jz 0 f
2010-05-17 12:00:05 +04:00
lg % r1 ,_ _ T I _ t a s k ( % r12 )
2011-12-27 14:27:15 +04:00
tmhh % r8 ,0 x00 0 1 # k e r n e l p e r e v e n t ?
jz p g m _ k p r o b e
oi _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ P E R _ T R A P
2011-01-05 14:48:10 +03:00
mvc _ _ T H R E A D _ p e r _ a d d r e s s ( 8 ,% r1 ) ,_ _ L C _ P E R _ A D D R E S S
2011-12-27 14:27:15 +04:00
mvc _ _ T H R E A D _ p e r _ c a u s e ( 2 ,% r1 ) ,_ _ L C _ P E R _ C A U S E
2011-01-05 14:48:10 +03:00
mvc _ _ T H R E A D _ p e r _ p a i d ( 1 ,% r1 ) ,_ _ L C _ P E R _ P A I D
2011-12-27 14:27:18 +04:00
0 : REENABLE_ I R Q S
2011-12-27 14:27:15 +04:00
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
2010-07-27 21:29:37 +04:00
larl % r1 ,p g m _ c h e c k _ t a b l e
2011-12-27 14:27:18 +04:00
llgh % r10 ,_ _ P T _ I N T _ C O D E + 2 ( % r11 )
nill % r10 ,0 x00 7 f
sll % r10 ,3
je s y s c _ r e t u r n
2011-12-27 14:27:15 +04:00
lg % r1 ,0 ( % r10 ,% r1 ) # l o a d a d d r e s s o f h a n d l e r r o u t i n e
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
2010-07-27 21:29:37 +04:00
basr % r14 ,% r1 # b r a n c h t o i n t e r r u p t - h a n d l e r
j s y s c _ r e t u r n
2005-04-17 02:20:36 +04:00
#
2011-12-27 14:27:15 +04:00
# PER e v e n t i n s u p e r v i s o r s t a t e , m u s t b e k p r o b e s
2005-04-17 02:20:36 +04:00
#
2011-12-27 14:27:15 +04:00
pgm_kprobe :
REENABLE_ I R Q S
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
brasl % r14 ,d o _ p e r _ t r a p
j s y s c _ r e t u r n
2005-04-17 02:20:36 +04:00
2006-09-20 17:58:39 +04:00
#
2011-12-27 14:27:15 +04:00
# single s t e p p e d s y s t e m c a l l
2006-09-20 17:58:39 +04:00
#
2011-12-27 14:27:15 +04:00
pgm_svcper :
oi _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ P E R _ T R A P
mvc _ _ L C _ R E T U R N _ P S W ( 8 ) ,_ _ L C _ S V C _ N E W _ P S W
larl % r14 ,s y s c _ p e r
stg % r14 ,_ _ L C _ R E T U R N _ P S W + 8
lpswe _ _ L C _ R E T U R N _ P S W # b r a n c h t o s y s c _ p e r a n d e n a b l e i r q s
2006-09-20 17:58:39 +04:00
2005-04-17 02:20:36 +04:00
/ *
* IO i n t e r r u p t h a n d l e r r o u t i n e
* /
2011-07-24 12:48:19 +04:00
ENTRY( i o _ i n t _ h a n d l e r )
2005-04-17 02:20:36 +04:00
stck _ _ L C _ I N T _ C L O C K
2008-12-31 17:11:41 +03:00
stpt _ _ L C _ A S Y N C _ E N T E R _ T I M E R
2011-12-27 14:27:15 +04:00
stmg % r8 ,% r15 ,_ _ L C _ S A V E _ A R E A _ A S Y N C
lg % r10 ,_ _ L C _ L A S T _ B R E A K
lg % r12 ,_ _ L C _ T H R E A D _ I N F O
larl % r13 ,s y s t e m _ c a l l
lmg % r8 ,% r9 ,_ _ L C _ I O _ O L D _ P S W
HANDLE_ S I E _ I N T E R C E P T % r14
SWITCH_ A S Y N C _ _ L C _ S A V E _ A R E A _ A S Y N C ,_ _ L C _ A S Y N C _ S T A C K ,S T A C K _ S H I F T
tmhh % r8 ,0 x00 0 1 # i n t e r r u p t i n g f r o m u s e r ?
jz i o _ s k i p
UPDATE_ V T I M E % r14 ,_ _ L C _ A S Y N C _ E N T E R _ T I M E R
LAST_ B R E A K % r14
io_skip :
stmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r11 )
mvc _ _ P T _ R 8 ( 6 4 ,% r11 ) ,_ _ L C _ S A V E _ A R E A _ A S Y N C
stmg % r8 ,% r9 ,_ _ P T _ P S W ( % r11 )
2006-07-03 11:24:46 +04:00
TRACE_ I R Q S _ O F F
2011-12-27 14:27:15 +04:00
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
brasl % r14 ,d o _ I R Q
2005-04-17 02:20:36 +04:00
io_return :
2010-05-17 12:00:02 +04:00
LOCKDEP_ S Y S _ E X I T
TRACE_ I R Q S _ O N
io_tif :
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ W O R K _ I N T
2006-09-28 18:56:37 +04:00
jnz i o _ w o r k # t h e r e i s w o r k t o d o ( s i g n a l s e t c . )
2007-11-20 13:13:32 +03:00
io_restore :
2011-12-27 14:27:15 +04:00
lg % r14 ,_ _ L C _ V D S O _ P E R _ C P U
lmg % r0 ,% r10 ,_ _ P T _ R 0 ( % r11 )
mvc _ _ L C _ R E T U R N _ P S W ( 1 6 ) ,_ _ P T _ P S W ( % r11 )
ni _ _ L C _ R E T U R N _ P S W + 1 ,0 x f d # c l e a r w a i t s t a t e b i t
stpt _ _ L C _ E X I T _ T I M E R
mvc _ _ V D S O _ E C T G _ B A S E ( 1 6 ,% r14 ) ,_ _ L C _ E X I T _ T I M E R
lmg % r11 ,% r15 ,_ _ P T _ R 1 1 ( % r11 )
lpswe _ _ L C _ R E T U R N _ P S W
2005-09-04 02:57:56 +04:00
io_done :
2005-04-17 02:20:36 +04:00
2008-05-07 11:22:52 +04:00
#
2010-05-17 12:00:01 +04:00
# There i s w o r k t o d o , f i n d o u t i n w h i c h c o n t e x t w e h a v e b e e n i n t e r r u p t e d :
# 1 ) if w e r e t u r n t o u s e r s p a c e w e c a n d o a l l _ T I F _ W O R K _ I N T w o r k
# 2 ) if w e r e t u r n t o k e r n e l c o d e a n d k v m i s e n a b l e d c h e c k i f w e n e e d t o
# modify t h e p s w t o l e a v e S I E
# 3 ) if w e r e t u r n t o k e r n e l c o d e a n d p r e e m p t i v e s c h e d u l i n g i s e n a b l e d c h e c k
# the p r e e m p t i o n c o u n t e r a n d i f i t i s z e r o c a l l p r e e m p t _ s c h e d u l e _ i r q
# Before a n y w o r k c a n b e d o n e , a s w i t c h t o t h e k e r n e l s t a c k i s r e q u i r e d .
2008-05-07 11:22:52 +04:00
#
io_work :
2011-12-27 14:27:15 +04:00
tm _ _ P T _ P S W + 1 ( % r11 ) ,0 x01 # r e t u r n i n g t o u s e r ?
2010-05-17 12:00:01 +04:00
jo i o _ w o r k _ u s e r # y e s - > d o r e s c h e d & s i g n a l
# ifdef C O N F I G _ P R E E M P T
2008-05-07 11:22:52 +04:00
# check f o r p r e e m p t i v e s c h e d u l i n g
2010-05-17 12:00:05 +04:00
icm % r0 ,1 5 ,_ _ T I _ p r e c o u n t ( % r12 )
2008-05-07 11:22:52 +04:00
jnz i o _ r e s t o r e # p r e e m p t i o n i s d i s a b l e d
2010-05-17 12:00:02 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ N E E D _ R E S C H E D
jno i o _ r e s t o r e
2005-04-17 02:20:36 +04:00
# switch t o k e r n e l s t a c k
2011-12-27 14:27:15 +04:00
lg % r1 ,_ _ P T _ R 1 5 ( % r11 )
aghi % r1 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
mvc S T A C K _ F R A M E _ O V E R H E A D ( _ _ P T _ S I Z E ,% r1 ) ,0 ( % r11 )
xc _ _ S F _ B A C K C H A I N ( 8 ,% r1 ) ,_ _ S F _ B A C K C H A I N ( % r1 )
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r1 )
2005-04-17 02:20:36 +04:00
lgr % r15 ,% r1
2010-05-17 12:00:02 +04:00
# TRACE_ I R Q S _ O N a l r e a d y d o n e a t i o _ r e t u r n , c a l l
# TRACE_ I R Q S _ O F F t o k e e p t h i n g s s y m m e t r i c a l
TRACE_ I R Q S _ O F F
brasl % r14 ,p r e e m p t _ s c h e d u l e _ i r q
j i o _ r e t u r n
# else
2010-05-17 12:00:01 +04:00
j i o _ r e s t o r e
2010-05-17 12:00:02 +04:00
# endif
2005-04-17 02:20:36 +04:00
2010-05-17 12:00:01 +04:00
#
# Need t o d o w o r k b e f o r e r e t u r n i n g t o u s e r s p a c e , s w i t c h t o k e r n e l s t a c k
#
2008-05-07 11:22:52 +04:00
io_work_user :
2005-04-17 02:20:36 +04:00
lg % r1 ,_ _ L C _ K E R N E L _ S T A C K
2011-12-27 14:27:15 +04:00
aghi % r1 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
mvc S T A C K _ F R A M E _ O V E R H E A D ( _ _ P T _ S I Z E ,% r1 ) ,0 ( % r11 )
xc _ _ S F _ B A C K C H A I N ( 8 ,% r1 ) ,_ _ S F _ B A C K C H A I N ( % r1 )
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r1 )
2005-04-17 02:20:36 +04:00
lgr % r15 ,% r1
2010-05-17 12:00:01 +04:00
2005-04-17 02:20:36 +04:00
#
# One o f t h e w o r k b i t s i s o n . F i n d o u t w h i c h o n e .
2010-05-17 12:00:01 +04:00
# Checked a r e : _ T I F _ S I G P E N D I N G , _ T I F _ N O T I F Y _ R E S U M E , _ T I F _ N E E D _ R E S C H E D
2006-02-01 14:06:38 +03:00
# and _ T I F _ M C C K _ P E N D I N G
2005-04-17 02:20:36 +04:00
#
2010-05-17 12:00:02 +04:00
io_work_tif :
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ M C C K _ P E N D I N G
2005-06-26 01:55:30 +04:00
jo i o _ m c c k _ p e n d i n g
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ N E E D _ R E S C H E D
2005-04-17 02:20:36 +04:00
jo i o _ r e s c h e d u l e
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ S I G P E N D I N G
2010-05-17 12:00:01 +04:00
jo i o _ s i g p e n d i n g
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ N O T I F Y _ R E S U M E
2010-05-17 12:00:01 +04:00
jo i o _ n o t i f y _ r e s u m e
j i o _ r e t u r n # b e w a r e o f c r i t i c a l s e c t i o n c l e a n u p
2008-05-07 11:22:53 +04:00
2005-06-26 01:55:30 +04:00
#
# _ TIF_ M C C K _ P E N D I N G i s s e t , c a l l h a n d l e r
#
io_mcck_pending :
2010-05-17 12:00:02 +04:00
# TRACE_ I R Q S _ O N a l r e a d y d o n e a t i o _ r e t u r n
2007-07-27 14:29:18 +04:00
brasl % r14 ,s39 0 _ h a n d l e _ m c c k # T I F b i t w i l l b e c l e a r e d b y h a n d l e r
2010-05-17 12:00:02 +04:00
TRACE_ I R Q S _ O F F
j i o _ r e t u r n
2005-06-26 01:55:30 +04:00
2005-04-17 02:20:36 +04:00
#
# _ TIF_ N E E D _ R E S C H E D i s s e t , c a l l s c h e d u l e
2006-09-28 18:56:37 +04:00
#
io_reschedule :
2010-05-17 12:00:02 +04:00
# TRACE_ I R Q S _ O N a l r e a d y d o n e a t i o _ r e t u r n
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ S V C _ N E W _ P S W # r e e n a b l e i n t e r r u p t s
2006-09-28 18:56:37 +04:00
brasl % r14 ,s c h e d u l e # c a l l s c h e d u l e r
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ P G M _ N E W _ P S W # d i s a b l e I / O a n d e x t . i n t e r r u p t s
2007-11-20 13:13:32 +03:00
TRACE_ I R Q S _ O F F
2010-05-17 12:00:02 +04:00
j i o _ r e t u r n
2005-04-17 02:20:36 +04:00
#
2008-04-30 11:53:08 +04:00
# _ TIF_ S I G P E N D I N G o r i s s e t , c a l l d o _ s i g n a l
2005-04-17 02:20:36 +04:00
#
2006-09-28 18:56:37 +04:00
io_sigpending :
2010-05-17 12:00:02 +04:00
# TRACE_ I R Q S _ O N a l r e a d y d o n e a t i o _ r e t u r n
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ S V C _ N E W _ P S W # r e e n a b l e i n t e r r u p t s
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
brasl % r14 ,d o _ s i g n a l
ssm _ _ L C _ P G M _ N E W _ P S W # d i s a b l e I / O a n d e x t . i n t e r r u p t s
2007-11-20 13:13:32 +03:00
TRACE_ I R Q S _ O F F
2010-05-17 12:00:02 +04:00
j i o _ r e t u r n
2005-04-17 02:20:36 +04:00
2008-10-10 23:33:20 +04:00
#
# _ TIF_ N O T I F Y _ R E S U M E o r i s s e t , c a l l d o _ n o t i f y _ r e s u m e
#
io_notify_resume :
2010-05-17 12:00:02 +04:00
# TRACE_ I R Q S _ O N a l r e a d y d o n e a t i o _ r e t u r n
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ S V C _ N E W _ P S W # r e e n a b l e i n t e r r u p t s
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
brasl % r14 ,d o _ n o t i f y _ r e s u m e
ssm _ _ L C _ P G M _ N E W _ P S W # d i s a b l e I / O a n d e x t . i n t e r r u p t s
2008-10-10 23:33:20 +04:00
TRACE_ I R Q S _ O F F
2010-05-17 12:00:02 +04:00
j i o _ r e t u r n
2008-10-10 23:33:20 +04:00
2005-04-17 02:20:36 +04:00
/ *
* External i n t e r r u p t h a n d l e r r o u t i n e
* /
2011-07-24 12:48:19 +04:00
ENTRY( e x t _ i n t _ h a n d l e r )
2005-04-17 02:20:36 +04:00
stck _ _ L C _ I N T _ C L O C K
2008-12-31 17:11:41 +03:00
stpt _ _ L C _ A S Y N C _ E N T E R _ T I M E R
2011-12-27 14:27:15 +04:00
stmg % r8 ,% r15 ,_ _ L C _ S A V E _ A R E A _ A S Y N C
lg % r10 ,_ _ L C _ L A S T _ B R E A K
lg % r12 ,_ _ L C _ T H R E A D _ I N F O
larl % r13 ,s y s t e m _ c a l l
lmg % r8 ,% r9 ,_ _ L C _ E X T _ O L D _ P S W
HANDLE_ S I E _ I N T E R C E P T % r14
SWITCH_ A S Y N C _ _ L C _ S A V E _ A R E A _ A S Y N C ,_ _ L C _ A S Y N C _ S T A C K ,S T A C K _ S H I F T
tmhh % r8 ,0 x00 0 1 # i n t e r r u p t i n g f r o m u s e r ?
jz e x t _ s k i p
UPDATE_ V T I M E % r14 ,_ _ L C _ A S Y N C _ E N T E R _ T I M E R
LAST_ B R E A K % r14
ext_skip :
stmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r11 )
mvc _ _ P T _ R 8 ( 6 4 ,% r11 ) ,_ _ L C _ S A V E _ A R E A _ A S Y N C
stmg % r8 ,% r9 ,_ _ P T _ P S W ( % r11 )
2006-07-03 11:24:46 +04:00
TRACE_ I R Q S _ O F F
2010-10-25 18:10:38 +04:00
lghi % r1 ,4 0 9 6
2011-12-27 14:27:15 +04:00
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
2012-03-11 19:59:25 +04:00
llgf % r3 ,_ _ L C _ E X T _ C P U _ A D D R # g e t c p u a d d r e s s + i n t e r r u p t i o n c o d e
2010-10-25 18:10:38 +04:00
llgf % r4 ,_ _ L C _ E X T _ P A R A M S # g e t e x t e r n a l p a r a m e t e r
lg % r5 ,_ _ L C _ E X T _ P A R A M S 2 - 4 0 9 6 ( % r1 ) # g e t 64 b i t e x t e r n a l p a r a m e t e r
2006-09-28 18:56:37 +04:00
brasl % r14 ,d o _ e x t i n t
2005-04-17 02:20:36 +04:00
j i o _ r e t u r n
2005-09-04 02:57:56 +04:00
__critical_end :
2005-04-17 02:20:36 +04:00
/ *
* Machine c h e c k h a n d l e r r o u t i n e s
* /
2011-07-24 12:48:19 +04:00
ENTRY( m c c k _ i n t _ h a n d l e r )
2010-05-17 12:00:03 +04:00
stck _ _ L C _ M C C K _ C L O C K
2005-06-26 01:55:30 +04:00
la % r1 ,4 0 9 5 # r e v a l i d a t e r 1
spt _ _ L C _ C P U _ T I M E R _ S A V E _ A R E A - 4 0 9 5 ( % r1 ) # r e v a l i d a t e c p u t i m e r
2006-09-28 18:56:37 +04:00
lmg % r0 ,% r15 ,_ _ L C _ G P R E G S _ S A V E _ A R E A - 4 0 9 5 ( % r1 ) # r e v a l i d a t e g p r s
2011-12-27 14:27:15 +04:00
lg % r10 ,_ _ L C _ L A S T _ B R E A K
lg % r12 ,_ _ L C _ T H R E A D _ I N F O
2010-05-17 12:00:05 +04:00
larl % r13 ,s y s t e m _ c a l l
2011-12-27 14:27:15 +04:00
lmg % r8 ,% r9 ,_ _ L C _ M C K _ O L D _ P S W
HANDLE_ S I E _ I N T E R C E P T % r14
2006-09-28 18:56:37 +04:00
tm _ _ L C _ M C C K _ C O D E ,0 x80 # s y s t e m d a m a g e ?
2011-12-27 14:27:15 +04:00
jo m c c k _ p a n i c # y e s - > r e s t o f m c c k c o d e i n v a l i d
lghi % r14 ,_ _ L C _ C P U _ T I M E R _ S A V E _ A R E A
mvc _ _ L C _ M C C K _ E N T E R _ T I M E R ( 8 ) ,0 ( % r14 )
2006-06-29 16:58:05 +04:00
tm _ _ L C _ M C C K _ C O D E + 5 ,0 x02 # s t o r e d c p u t i m e r v a l u e v a l i d ?
2011-12-27 14:27:15 +04:00
jo 3 f
2006-06-29 16:58:05 +04:00
la % r14 ,_ _ L C _ S Y N C _ E N T E R _ T I M E R
clc 0 ( 8 ,% r14 ) ,_ _ L C _ A S Y N C _ E N T E R _ T I M E R
jl 0 f
la % r14 ,_ _ L C _ A S Y N C _ E N T E R _ T I M E R
0 : clc 0 ( 8 ,% r14 ) ,_ _ L C _ E X I T _ T I M E R
2011-12-27 14:27:15 +04:00
jl 1 f
2006-06-29 16:58:05 +04:00
la % r14 ,_ _ L C _ E X I T _ T I M E R
2011-12-27 14:27:15 +04:00
1 : clc 0 ( 8 ,% r14 ) ,_ _ L C _ L A S T _ U P D A T E _ T I M E R
jl 2 f
2006-06-29 16:58:05 +04:00
la % r14 ,_ _ L C _ L A S T _ U P D A T E _ T I M E R
2011-12-27 14:27:15 +04:00
2 : spt 0 ( % r14 )
2010-05-17 12:00:03 +04:00
mvc _ _ L C _ M C C K _ E N T E R _ T I M E R ( 8 ) ,0 ( % r14 )
2011-12-27 14:27:15 +04:00
3 : tm _ _ L C _ M C C K _ C O D E + 2 ,0 x09 # m w p + i a o f o l d p s w v a l i d ?
jno m c c k _ p a n i c # n o - > s k i p c l e a n u p c r i t i c a l
SWITCH_ A S Y N C _ _ L C _ G P R E G S _ S A V E _ A R E A + 6 4 ,_ _ L C _ P A N I C _ S T A C K ,P A G E _ S H I F T
tm % r8 ,0 x00 0 1 # i n t e r r u p t i n g f r o m u s e r ?
jz m c c k _ s k i p
UPDATE_ V T I M E % r14 ,_ _ L C _ M C C K _ E N T E R _ T I M E R
LAST_ B R E A K % r14
mcck_skip :
lghi % r14 ,_ _ L C _ G P R E G S _ S A V E _ A R E A
mvc _ _ P T _ R 0 ( 1 2 8 ,% r11 ) ,0 ( % r14 )
stmg % r8 ,% r9 ,_ _ P T _ P S W ( % r11 )
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
2005-06-26 01:55:30 +04:00
brasl % r14 ,s39 0 _ d o _ m a c h i n e _ c h e c k
2011-12-27 14:27:15 +04:00
tm _ _ P T _ P S W + 1 ( % r11 ) ,0 x01 # r e t u r n i n g t o u s e r ?
2005-06-26 01:55:30 +04:00
jno m c c k _ r e t u r n
lg % r1 ,_ _ L C _ K E R N E L _ S T A C K # s w i t c h t o k e r n e l s t a c k
2011-12-27 14:27:15 +04:00
aghi % r1 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
mvc S T A C K _ F R A M E _ O V E R H E A D ( _ _ P T _ S I Z E ,% r1 ) ,0 ( % r11 )
xc _ _ S F _ B A C K C H A I N ( 8 ,% r1 ) ,_ _ S F _ B A C K C H A I N ( % r1 )
la % r11 ,S T A C K _ F R A M E _ O V E R H E A D ( % r1 )
2005-06-26 01:55:30 +04:00
lgr % r15 ,% r1
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ P G M _ N E W _ P S W # t u r n d a t o n , k e e p i r q s o f f
2010-05-17 12:00:05 +04:00
tm _ _ T I _ f l a g s + 7 ( % r12 ) ,_ T I F _ M C C K _ P E N D I N G
2005-06-26 01:55:30 +04:00
jno m c c k _ r e t u r n
2006-07-03 11:24:46 +04:00
TRACE_ I R Q S _ O F F
2005-06-26 01:55:30 +04:00
brasl % r14 ,s39 0 _ h a n d l e _ m c c k
2006-07-03 11:24:46 +04:00
TRACE_ I R Q S _ O N
2005-04-17 02:20:36 +04:00
mcck_return :
2011-12-27 14:27:15 +04:00
lg % r14 ,_ _ L C _ V D S O _ P E R _ C P U
lmg % r0 ,% r10 ,_ _ P T _ R 0 ( % r11 )
mvc _ _ L C _ R E T U R N _ M C C K _ P S W ( 1 6 ) ,_ _ P T _ P S W ( % r11 ) # m o v e r e t u r n P S W
2006-06-29 16:58:05 +04:00
ni _ _ L C _ R E T U R N _ M C C K _ P S W + 1 ,0 x f d # c l e a r w a i t s t a t e b i t
tm _ _ L C _ R E T U R N _ M C C K _ P S W + 1 ,0 x01 # r e t u r n i n g t o u s e r ?
jno 0 f
stpt _ _ L C _ E X I T _ T I M E R
2011-12-27 14:27:15 +04:00
mvc _ _ V D S O _ E C T G _ B A S E ( 1 6 ,% r14 ) ,_ _ L C _ E X I T _ T I M E R
0 : lmg % r11 ,% r15 ,_ _ P T _ R 1 1 ( % r11 )
lpswe _ _ L C _ R E T U R N _ M C C K _ P S W
mcck_panic :
lg % r14 ,_ _ L C _ P A N I C _ S T A C K
slgr % r14 ,% r15
srag % r14 ,% r14 ,P A G E _ S H I F T
jz 0 f
lg % r15 ,_ _ L C _ P A N I C _ S T A C K
0 : aghi % r15 ,- ( S T A C K _ F R A M E _ O V E R H E A D + _ _ P T _ S I Z E )
j m c c k _ s k i p
2005-04-17 02:20:36 +04:00
/ *
* Restart i n t e r r u p t i o n h a n d l e r , k i c k s t a r t e r f o r a d d i t i o n a l C P U s
* /
2007-06-19 15:10:03 +04:00
# ifdef C O N F I G _ S M P
2008-02-05 18:50:40 +03:00
_ _ CPUINIT
2011-07-24 12:48:19 +04:00
ENTRY( r e s t a r t _ i n t _ h a n d l e r )
2009-04-14 17:36:27 +04:00
basr % r1 ,0
restart_base :
spt r e s t a r t _ v t i m e - r e s t a r t _ b a s e ( % r1 )
stck _ _ L C _ L A S T _ U P D A T E _ C L O C K
mvc _ _ L C _ L A S T _ U P D A T E _ T I M E R ( 8 ) ,r e s t a r t _ v t i m e - r e s t a r t _ b a s e ( % r1 )
mvc _ _ L C _ E X I T _ T I M E R ( 8 ) ,r e s t a r t _ v t i m e - r e s t a r t _ b a s e ( % r1 )
2011-12-27 14:27:15 +04:00
lghi % r10 ,_ _ L C _ G P R E G S _ S A V E _ A R E A
lg % r15 ,1 2 0 ( % r10 ) # l o a d k s p
2006-09-28 18:56:37 +04:00
lghi % r10 ,_ _ L C _ C R E G S _ S A V E _ A R E A
2011-12-27 14:27:15 +04:00
lctlg % c0 ,% c15 ,0 ( % r10 ) # g e t n e w c t l r e g s
2006-09-28 18:56:37 +04:00
lghi % r10 ,_ _ L C _ A R E G S _ S A V E _ A R E A
lam % a0 ,% a15 ,0 ( % r10 )
2011-12-27 14:27:15 +04:00
lmg % r6 ,% r15 ,_ _ S F _ G P R S ( % r15 ) # l o a d r e g i s t e r s f r o m c l o n e
2009-04-14 17:36:27 +04:00
lg % r1 ,_ _ L C _ T H R E A D _ I N F O
mvc _ _ L C _ U S E R _ T I M E R ( 8 ) ,_ _ T I _ u s e r _ t i m e r ( % r1 )
mvc _ _ L C _ S Y S T E M _ T I M E R ( 8 ) ,_ _ T I _ s y s t e m _ t i m e r ( % r1 )
xc _ _ L C _ S T E A L _ T I M E R ( 8 ) ,_ _ L C _ S T E A L _ T I M E R
2011-12-27 14:27:15 +04:00
ssm _ _ L C _ P G M _ N E W _ P S W # t u r n d a t o n , k e e p i r q s o f f
2011-05-10 19:13:39 +04:00
brasl % r14 ,s t a r t _ s e c o n d a r y
2009-04-14 17:36:27 +04:00
.align 8
restart_vtime :
.long 0 x7 f f f f f f f ,0 x f f f f f f f f
2007-06-19 15:10:03 +04:00
.previous
2005-04-17 02:20:36 +04:00
# else
/ *
* If w e d o n o t r u n w i t h S M P e n a b l e d , l e t t h e n e w C P U c r a s h . . .
* /
2011-07-24 12:48:19 +04:00
ENTRY( r e s t a r t _ i n t _ h a n d l e r )
2006-09-28 18:56:37 +04:00
basr % r1 ,0
2005-04-17 02:20:36 +04:00
restart_base :
2006-09-28 18:56:37 +04:00
lpswe r e s t a r t _ c r a s h - r e s t a r t _ b a s e ( % r1 )
.align 8
2005-04-17 02:20:36 +04:00
restart_crash :
2006-09-28 18:56:37 +04:00
.long 0 x0 0 0 a00 0 0 ,0 x00 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
2005-04-17 02:20:36 +04:00
restart_go :
# endif
2011-08-03 18:44:19 +04:00
#
# PSW r e s t a r t i n t e r r u p t h a n d l e r
#
ENTRY( p s w _ r e s t a r t _ i n t _ h a n d l e r )
2011-12-27 14:27:15 +04:00
stg % r15 ,_ _ L C _ S A V E _ A R E A _ R E S T A R T
2011-08-03 18:44:19 +04:00
larl % r15 ,r e s t a r t _ s t a c k # l o a d r e s t a r t s t a c k
lg % r15 ,0 ( % r15 )
2011-12-27 14:27:15 +04:00
aghi % r15 ,- _ _ P T _ S I Z E # c r e a t e p t _ r e g s o n s t a c k
stmg % r0 ,% r14 ,_ _ P T _ R 0 ( % r15 )
mvc _ _ P T _ R 1 5 ( 8 ,% r15 ) ,_ _ L C _ S A V E _ A R E A _ R E S T A R T
mvc _ _ P T _ P S W ( 1 6 ,% r15 ) ,_ _ L C _ R S T _ O L D _ P S W # s t o r e r e s t a r t o l d p s w
aghi % r15 ,- S T A C K _ F R A M E _ O V E R H E A D
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
2011-08-03 18:44:19 +04:00
brasl % r14 ,d o _ r e s t a r t
larl % r14 ,r e s t a r t _ p s w _ c r a s h # l o a d d i s a b l e d w a i t P S W i f
lpswe 0 ( % r14 ) # d o _ r e s t a r t r e t u r n s
.align 8
restart_psw_crash :
.quad 0 x0 0 0 2 0 0 0 0 8 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + r e s t a r t _ p s w _ c r a s h
2011-01-05 14:47:25 +03:00
.section .kprobes .text , " ax"
2005-04-17 02:20:36 +04:00
# ifdef C O N F I G _ C H E C K _ S T A C K
/ *
* The s y n c h r o n o u s o r t h e a s y n c h r o n o u s s t a c k o v e r f l o w e d . W e a r e d e a d .
* No n e e d t o p r o p e r l y s a v e t h e r e g i s t e r s , w e a r e g o i n g t o p a n i c a n y w a y .
* Setup a p t _ r e g s s o t h a t s h o w _ t r a c e c a n p r o v i d e a g o o d c a l l t r a c e .
* /
stack_overflow :
2011-12-27 14:27:15 +04:00
lg % r11 ,_ _ L C _ P A N I C _ S T A C K # c h a n g e t o p a n i c s t a c k
aghi % r11 ,- _ _ P T _ S I Z E # c r e a t e p t _ r e g s
stmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r11 )
stmg % r8 ,% r9 ,_ _ P T _ P S W ( % r11 )
mvc _ _ P T _ R 8 ( 6 4 ,% r11 ) ,0 ( % r14 )
stg % r10 ,_ _ P T _ O R I G _ G P R 2 ( % r11 ) # s t o r e l a s t b r e a k t o o r i g _ g p r 2
lgr % r15 ,% r11
aghi % r15 ,- S T A C K _ F R A M E _ O V E R H E A D
xc _ _ S F _ B A C K C H A I N ( 8 ,% r15 ) ,_ _ S F _ B A C K C H A I N ( % r15 )
lgr % r2 ,% r11 # p a s s p o i n t e r t o p t _ r e g s
2005-04-17 02:20:36 +04:00
jg k e r n e l _ s t a c k _ o v e r f l o w
# endif
2011-12-27 14:27:15 +04:00
.align 8
cleanup_table :
.quad system_call
.quad sysc_do_svc
.quad sysc_tif
.quad sysc_restore
.quad sysc_done
.quad io_tif
.quad io_restore
.quad io_done
2005-04-17 02:20:36 +04:00
cleanup_critical :
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e ) # s y s t e m _ c a l l
2005-04-17 02:20:36 +04:00
jl 0 f
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e + 8 ) # s y s c _ d o _ s v c
2005-04-17 02:20:36 +04:00
jl c l e a n u p _ s y s t e m _ c a l l
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e + 1 6 ) # s y s c _ t i f
2005-04-17 02:20:36 +04:00
jl 0 f
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e + 2 4 ) # s y s c _ r e s t o r e
2010-05-17 12:00:02 +04:00
jl c l e a n u p _ s y s c _ t i f
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e + 3 2 ) # s y s c _ d o n e
2010-05-17 12:00:02 +04:00
jl c l e a n u p _ s y s c _ r e s t o r e
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e + 4 0 ) # i o _ t i f
2006-06-29 16:58:05 +04:00
jl 0 f
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e + 4 8 ) # i o _ r e s t o r e
2010-05-17 12:00:02 +04:00
jl c l e a n u p _ i o _ t i f
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ t a b l e + 5 6 ) # i o _ d o n e
2010-05-17 12:00:02 +04:00
jl c l e a n u p _ i o _ r e s t o r e
2011-12-27 14:27:15 +04:00
0 : br % r14
2005-04-17 02:20:36 +04:00
cleanup_system_call :
2011-12-27 14:27:15 +04:00
# check i f s t p t h a s b e e n e x e c u t e d
clg % r9 ,B A S E D ( c l e a n u p _ s y s t e m _ c a l l _ i n s n )
2005-04-17 02:20:36 +04:00
jh 0 f
mvc _ _ L C _ S Y N C _ E N T E R _ T I M E R ( 8 ) ,_ _ L C _ A S Y N C _ E N T E R _ T I M E R
2011-12-27 14:27:15 +04:00
cghi % r11 ,_ _ L C _ S A V E _ A R E A _ A S Y N C
2010-05-17 12:00:03 +04:00
je 0 f
2011-12-27 14:27:15 +04:00
mvc _ _ L C _ S Y N C _ E N T E R _ T I M E R ( 8 ) ,_ _ L C _ M C C K _ E N T E R _ T I M E R
0 : # check i f s t m g h a s b e e n e x e c u t e d
clg % r9 ,B A S E D ( c l e a n u p _ s y s t e m _ c a l l _ i n s n + 8 )
2005-04-17 02:20:36 +04:00
jh 0 f
2011-12-27 14:27:15 +04:00
mvc _ _ L C _ S A V E _ A R E A _ S Y N C ( 6 4 ) ,0 ( % r11 )
0 : # check i f b a s e r e g i s t e r s e t u p + T I F b i t l o a d h a s b e e n d o n e
clg % r9 ,B A S E D ( c l e a n u p _ s y s t e m _ c a l l _ i n s n + 1 6 )
jhe 0 f
# set u p s a v e d r e g i s t e r s r10 a n d r12
stg % r10 ,1 6 ( % r11 ) # r 10 l a s t b r e a k
stg % r12 ,3 2 ( % r11 ) # r 12 t h r e a d - i n f o p o i n t e r
0 : # check i f t h e u s e r t i m e u p d a t e h a s b e e n d o n e
clg % r9 ,B A S E D ( c l e a n u p _ s y s t e m _ c a l l _ i n s n + 2 4 )
jh 0 f
lg % r15 ,_ _ L C _ E X I T _ T I M E R
slg % r15 ,_ _ L C _ S Y N C _ E N T E R _ T I M E R
alg % r15 ,_ _ L C _ U S E R _ T I M E R
stg % r15 ,_ _ L C _ U S E R _ T I M E R
0 : # check i f t h e s y s t e m t i m e u p d a t e h a s b e e n d o n e
clg % r9 ,B A S E D ( c l e a n u p _ s y s t e m _ c a l l _ i n s n + 3 2 )
jh 0 f
lg % r15 ,_ _ L C _ L A S T _ U P D A T E _ T I M E R
slg % r15 ,_ _ L C _ E X I T _ T I M E R
alg % r15 ,_ _ L C _ S Y S T E M _ T I M E R
stg % r15 ,_ _ L C _ S Y S T E M _ T I M E R
0 : # update a c c o u n t i n g t i m e s t a m p
2005-04-17 02:20:36 +04:00
mvc _ _ L C _ L A S T _ U P D A T E _ T I M E R ( 8 ) ,_ _ L C _ S Y N C _ E N T E R _ T I M E R
2011-12-27 14:27:15 +04:00
# do L A S T _ B R E A K
lg % r9 ,1 6 ( % r11 )
srag % r9 ,% r9 ,2 3
2010-05-17 12:00:05 +04:00
jz 0 f
2011-12-27 14:27:15 +04:00
mvc _ _ T I _ l a s t _ b r e a k ( 8 ,% r12 ) ,1 6 ( % r11 )
0 : # set u p s a v e d r e g i s t e r r11
lg % r15 ,_ _ L C _ K E R N E L _ S T A C K
aghi % r15 ,- _ _ P T _ S I Z E
stg % r15 ,2 4 ( % r11 ) # r 11 p t _ r e g s p o i n t e r
# fill p t _ r e g s
mvc _ _ P T _ R 8 ( 6 4 ,% r15 ) ,_ _ L C _ S A V E _ A R E A _ S Y N C
stmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r15 )
mvc _ _ P T _ P S W ( 1 6 ,% r15 ) ,_ _ L C _ S V C _ O L D _ P S W
2011-12-27 14:27:18 +04:00
mvc _ _ P T _ I N T _ C O D E ( 4 ,% r15 ) ,_ _ L C _ S V C _ I L C
2011-12-27 14:27:15 +04:00
# setup s a v e d r e g i s t e r r15
aghi % r15 ,- S T A C K _ F R A M E _ O V E R H E A D
stg % r15 ,5 6 ( % r11 ) # r 15 s t a c k p o i n t e r
# set n e w p s w a d d r e s s a n d e x i t
larl % r9 ,s y s c _ d o _ s v c
2005-04-17 02:20:36 +04:00
br % r14
cleanup_system_call_insn :
2006-09-28 18:56:37 +04:00
.quad system_call
2011-12-27 14:27:15 +04:00
.quad sysc_stmg
.quad sysc_per
.quad sysc_ v t i m e + 1 8
.quad sysc_ v t i m e + 4 2
2005-04-17 02:20:36 +04:00
2010-05-17 12:00:02 +04:00
cleanup_sysc_tif :
2011-12-27 14:27:15 +04:00
larl % r9 ,s y s c _ t i f
2005-04-17 02:20:36 +04:00
br % r14
2010-05-17 12:00:02 +04:00
cleanup_sysc_restore :
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ s y s c _ r e s t o r e _ i n s n )
2010-05-17 12:00:03 +04:00
je 0 f
2011-12-27 14:27:15 +04:00
lg % r9 ,2 4 ( % r11 ) # g e t s a v e d p o i n t e r t o p t _ r e g s
mvc _ _ L C _ R E T U R N _ P S W ( 1 6 ) ,_ _ P T _ P S W ( % r9 )
mvc 0 ( 6 4 ,% r11 ) ,_ _ P T _ R 8 ( % r9 )
lmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r9 )
0 : lmg % r8 ,% r9 ,_ _ L C _ R E T U R N _ P S W
2005-04-17 02:20:36 +04:00
br % r14
2010-05-17 12:00:02 +04:00
cleanup_sysc_restore_insn :
2007-11-20 13:13:32 +03:00
.quad sysc_done - 4
2005-04-17 02:20:36 +04:00
2010-05-17 12:00:02 +04:00
cleanup_io_tif :
2011-12-27 14:27:15 +04:00
larl % r9 ,i o _ t i f
2010-04-09 15:43:00 +04:00
br % r14
2010-05-17 12:00:02 +04:00
cleanup_io_restore :
2011-12-27 14:27:15 +04:00
clg % r9 ,B A S E D ( c l e a n u p _ i o _ r e s t o r e _ i n s n )
je 0 f
lg % r9 ,2 4 ( % r11 ) # g e t s a v e d r 11 p o i n t e r t o p t _ r e g s
mvc _ _ L C _ R E T U R N _ P S W ( 1 6 ) ,_ _ P T _ P S W ( % r9 )
ni _ _ L C _ R E T U R N _ P S W + 1 ,0 x f d # c l e a r w a i t s t a t e b i t
mvc 0 ( 6 4 ,% r11 ) ,_ _ P T _ R 8 ( % r9 )
lmg % r0 ,% r7 ,_ _ P T _ R 0 ( % r9 )
0 : lmg % r8 ,% r9 ,_ _ L C _ R E T U R N _ P S W
2005-09-04 02:57:56 +04:00
br % r14
2010-05-17 12:00:02 +04:00
cleanup_io_restore_insn :
2007-11-20 13:13:32 +03:00
.quad io_done - 4
2005-09-04 02:57:56 +04:00
2005-04-17 02:20:36 +04:00
/ *
* Integer c o n s t a n t s
* /
2011-12-27 14:27:15 +04:00
.align 8
2005-04-17 02:20:36 +04:00
.Lcritical_start :
2011-12-27 14:27:15 +04:00
.quad __critical_start
.Lcritical_length :
.quad __critical_end - _ _ critical_ s t a r t
2005-04-17 02:20:36 +04:00
2011-07-24 12:48:18 +04:00
# if d e f i n e d ( C O N F I G _ K V M ) | | d e f i n e d ( C O N F I G _ K V M _ M O D U L E )
/ *
* sie6 4 a c a l l i n g c o n v e n t i o n :
* % r2 p o i n t e r t o s i e c o n t r o l b l o c k
* % r3 g u e s t r e g i s t e r s a v e a r e a
* /
2011-07-24 12:48:19 +04:00
ENTRY( s i e 6 4 a )
2011-07-24 12:48:18 +04:00
stmg % r6 ,% r14 ,_ _ S F _ G P R S ( % r15 ) # s a v e k e r n e l r e g i s t e r s
stg % r2 ,_ _ S F _ E M P T Y ( % r15 ) # s a v e c o n t r o l b l o c k p o i n t e r
stg % r3 ,_ _ S F _ E M P T Y + 8 ( % r15 ) # s a v e g u e s t r e g i s t e r s a v e a r e a
2011-12-27 14:27:13 +04:00
xc _ _ S F _ E M P T Y + 1 6 ( 8 ,% r15 ) ,_ _ S F _ E M P T Y + 1 6 ( % r15 ) # h o s t i d = = 0
2011-07-24 12:48:18 +04:00
lmg % r0 ,% r13 ,0 ( % r3 ) # l o a d g u e s t g p r s 0 - 1 3
lg % r14 ,_ _ L C _ T H R E A D _ I N F O # p o i n t e r t h r e a d _ i n f o s t r u c t
oi _ _ T I _ f l a g s + 6 ( % r14 ) ,_ T I F _ S I E > > 8
sie_loop :
lg % r14 ,_ _ L C _ T H R E A D _ I N F O # p o i n t e r t h r e a d _ i n f o s t r u c t
tm _ _ T I _ f l a g s + 7 ( % r14 ) ,_ T I F _ E X I T _ S I E
jnz s i e _ e x i t
2011-09-20 19:07:28 +04:00
lg % r14 ,_ _ L C _ G M A P # g e t g m a p p o i n t e r
ltgr % r14 ,% r14
jz s i e _ g m a p
lctlg % c1 ,% c1 ,_ _ G M A P _ A S C E ( % r14 ) # l o a d p r i m a r y a s c e
sie_gmap :
2011-07-24 12:48:18 +04:00
lg % r14 ,_ _ S F _ E M P T Y ( % r15 ) # g e t c o n t r o l b l o c k p o i n t e r
SPP _ _ S F _ E M P T Y ( % r15 ) # s e t g u e s t i d
sie 0 ( % r14 )
sie_done :
2011-12-27 14:27:13 +04:00
SPP _ _ S F _ E M P T Y + 1 6 ( % r15 ) # s e t h o s t i d
2011-07-24 12:48:18 +04:00
lg % r14 ,_ _ L C _ T H R E A D _ I N F O # p o i n t e r t h r e a d _ i n f o s t r u c t
sie_exit :
2011-09-20 19:07:28 +04:00
lctlg % c1 ,% c1 ,_ _ L C _ U S E R _ A S C E # l o a d p r i m a r y a s c e
2011-07-24 12:48:18 +04:00
ni _ _ T I _ f l a g s + 6 ( % r14 ) ,2 5 5 - ( _ T I F _ S I E > > 8 )
lg % r14 ,_ _ S F _ E M P T Y + 8 ( % r15 ) # l o a d g u e s t r e g i s t e r s a v e a r e a
stmg % r0 ,% r13 ,0 ( % r14 ) # s a v e g u e s t g p r s 0 - 1 3
lmg % r6 ,% r14 ,_ _ S F _ G P R S ( % r15 ) # r e s t o r e k e r n e l r e g i s t e r s
lghi % r2 ,0
br % r14
sie_fault :
2011-10-30 18:16:59 +04:00
lctlg % c1 ,% c1 ,_ _ L C _ U S E R _ A S C E # l o a d p r i m a r y a s c e
2011-07-24 12:48:18 +04:00
lg % r14 ,_ _ L C _ T H R E A D _ I N F O # p o i n t e r t h r e a d _ i n f o s t r u c t
ni _ _ T I _ f l a g s + 6 ( % r14 ) ,2 5 5 - ( _ T I F _ S I E > > 8 )
lg % r14 ,_ _ S F _ E M P T Y + 8 ( % r15 ) # l o a d g u e s t r e g i s t e r s a v e a r e a
stmg % r0 ,% r13 ,0 ( % r14 ) # s a v e g u e s t g p r s 0 - 1 3
lmg % r6 ,% r14 ,_ _ S F _ G P R S ( % r15 ) # r e s t o r e k e r n e l r e g i s t e r s
lghi % r2 ,- E F A U L T
br % r14
.align 8
.Lsie_loop :
.quad sie_loop
2011-12-27 14:27:15 +04:00
.Lsie_length :
.quad sie_done - sie_ l o o p
2011-12-27 14:27:13 +04:00
.Lhost_id :
.quad 0
2011-07-24 12:48:18 +04:00
.section _ _ ex_ t a b l e ," a "
.quad sie_ l o o p ,s i e _ f a u l t
.previous
# endif
2006-09-28 18:56:37 +04:00
.section .rodata , " a"
2005-04-17 02:20:36 +04:00
# define S Y S C A L L ( e s a ,e s a m e ,e m u ) . l o n g e s a m e
2009-06-12 12:26:47 +04:00
.globl sys_call_table
2005-04-17 02:20:36 +04:00
sys_call_table :
# include " s y s c a l l s . S "
# undef S Y S C A L L
2006-01-06 11:19:28 +03:00
# ifdef C O N F I G _ C O M P A T
2005-04-17 02:20:36 +04:00
# define S Y S C A L L ( e s a ,e s a m e ,e m u ) . l o n g e m u
sys_call_table_emu :
# include " s y s c a l l s . S "
# undef S Y S C A L L
# endif