2005-04-16 15:20:36 -07:00
/ *
2012-07-20 11:15:04 +02:00
* Copyright I B M C o r p 2 0 0 0 , 2 0 1 1
2009-03-26 15:24:57 +01:00
* Author( s ) : H o l g e r S m o l i n s k i < H o l g e r . S m o l i n s k i @de.ibm.com>,
* Denis J o s e p h B a r r o w ,
2005-04-16 15:20:36 -07:00
* /
2011-07-24 10:48:19 +02:00
# include < l i n u x / l i n k a g e . h >
2010-02-26 22:37:43 +01:00
# include < a s m / a s m - o f f s e t s . h >
2012-06-04 15:05:43 +02:00
# include < a s m / s i g p . h >
2007-03-05 23:35:43 +01:00
2011-08-03 16:44:21 +02:00
#
# store_ s t a t u s
#
# Prerequisites t o r u n t h i s f u n c t i o n :
# - Prefix r e g i s t e r i s s e t t o z e r o
# - Original p r e f i x r e g i s t e r i s s t o r e d i n " d u m p _ p r e f i x _ p a g e "
# - Lowcore p r o t e c t i o n i s o f f
#
ENTRY( s t o r e _ s t a t u s )
/* Save register one and load save area base */
2011-12-27 11:27:15 +01:00
stg % r1 ,_ _ L C _ S A V E _ A R E A _ R E S T A R T
2011-08-03 16:44:21 +02:00
lghi % r1 ,S A V E _ A R E A _ B A S E
/* General purpose registers */
stmg % r0 ,% r15 ,_ _ L C _ G P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
2011-12-27 11:27:15 +01:00
lg % r2 ,_ _ L C _ S A V E _ A R E A _ R E S T A R T
2011-08-03 16:44:21 +02:00
stg % r2 ,_ _ L C _ G P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E + 8 ( % r1 )
/* Control registers */
stctg % c0 ,% c15 ,_ _ L C _ C R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
/* Access registers */
stam % a0 ,% a15 ,_ _ L C _ A R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
/* Floating point registers */
std % f0 , 0 x00 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f1 , 0 x08 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f2 , 0 x10 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f3 , 0 x18 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f4 , 0 x20 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f5 , 0 x28 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f6 , 0 x30 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f7 , 0 x38 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f8 , 0 x40 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f9 , 0 x48 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f10 ,0 x50 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f11 ,0 x58 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f12 ,0 x60 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f13 ,0 x68 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f14 ,0 x70 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
std % f15 ,0 x78 + _ _ L C _ F P R E G S _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
/* Floating point control register */
stfpc _ _ L C _ F P _ C R E G _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
/* CPU timer */
stpt _ _ L C _ C P U _ T I M E R _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( % r1 )
/* Saved prefix register */
larl % r2 ,d u m p _ p r e f i x _ p a g e
mvc _ _ L C _ P R E F I X _ S A V E _ A R E A - S A V E _ A R E A _ B A S E ( 4 ,% r1 ) ,0 ( % r2 )
/* Clock comparator - seven bytes */
larl % r2 ,. L c l k c m p
stckc 0 ( % r2 )
mvc _ _ L C _ C L O C K _ C O M P _ S A V E _ A R E A - S A V E _ A R E A _ B A S E + 1 ( 7 ,% r1 ) ,1 ( % r2 )
/* Program status word */
epsw % r2 ,% r3
st % r2 ,_ _ L C _ P S W _ S A V E _ A R E A - S A V E _ A R E A _ B A S E + 0 ( % r1 )
st % r3 ,_ _ L C _ P S W _ S A V E _ A R E A - S A V E _ A R E A _ B A S E + 4 ( % r1 )
larl % r2 ,s t o r e _ s t a t u s
stg % r2 ,_ _ L C _ P S W _ S A V E _ A R E A - S A V E _ A R E A _ B A S E + 8 ( % r1 )
br % r14
2011-10-30 15:16:40 +01:00
.section .bss
.align 8
2011-08-03 16:44:21 +02:00
.Lclkcmp : .quad 0x0000000000000000
2011-10-30 15:16:40 +01:00
.previous
2011-08-03 16:44:21 +02:00
2007-03-05 23:35:43 +01:00
#
# do_ r e i p l _ a s m
# Parameter : r2 = s c h i d o f r e i p l d e v i c e
#
2011-07-24 10:48:19 +02:00
ENTRY( d o _ r e i p l _ a s m )
basr % r13 ,0
2006-12-04 15:40:26 +01:00
.Lpg0 : lpswe . L n e w p s w - . L p g 0 ( % r13 )
2011-08-03 16:44:21 +02:00
.Lpg1 : brasl % r14 ,s t o r e _ s t a t u s
2006-09-20 15:58:49 +02:00
2006-12-04 15:40:26 +01:00
lctlg % c6 ,% c6 ,. L a l l - . L p g 0 ( % r13 )
2006-09-28 16:56:37 +02:00
lgr % r1 ,% r2
mvc _ _ L C _ P G M _ N E W _ P S W ( 1 6 ) ,. L p c n e w - . L p g 0 ( % r13 )
stsch . L s c h i b - . L p g 0 ( % r13 )
oi . L s c h i b + 5 - . L p g 0 ( % r13 ) ,0 x84
.Lecs : xi . L s c h i b + 2 7 - . L p g 0 ( % r13 ) ,0 x01
msch . L s c h i b - . L p g 0 ( % r13 )
lghi % r0 ,5
.Lssch : ssch . L i p l o r b - . L p g 0 ( % r13 )
2005-04-16 15:20:36 -07:00
jz . L 0 0 1
2006-09-28 16:56:37 +02:00
brct % r0 ,. L s s c h
2005-04-16 15:20:36 -07:00
bas % r14 ,. L d i s a b - . L p g 0 ( % r13 )
2006-09-28 16:56:37 +02:00
.L001 : mvc _ _ L C _ I O _ N E W _ P S W ( 1 6 ) ,. L i o n e w - . L p g 0 ( % r13 )
.Ltpi : lpswe . L w a i t p s w - . L p g 0 ( % r13 )
2005-04-16 15:20:36 -07:00
.Lcont : c % r1 ,_ _ L C _ S U B C H A N N E L _ I D
jnz . L t p i
clc _ _ L C _ I O _ I N T _ P A R M ( 4 ) ,. L i p l o r b - . L p g 0 ( % r13 )
jnz . L t p i
2006-09-28 16:56:37 +02:00
tsch . L i p l i r b - . L p g 0 ( % r13 )
2005-04-16 15:20:36 -07:00
tm . L i p l i r b + 9 - . L p g 0 ( % r13 ) ,0 x b f
2006-09-28 16:56:37 +02:00
jz . L 0 0 2
bas % r14 ,. L d i s a b - . L p g 0 ( % r13 )
.L002 : tm . L i p l i r b + 8 - . L p g 0 ( % r13 ) ,0 x f3
jz . L 0 0 3
bas % r14 ,. L d i s a b - . L p g 0 ( % r13 )
2006-12-04 15:40:26 +01:00
.L003 : st % r1 ,_ _ L C _ S U B C H A N N E L _ I D
2006-09-28 16:56:37 +02:00
lhi % r1 ,0 # m o d e 0 = e s a
slr % r0 ,% r0 # s e t c p u i d t o z e r o
2012-06-04 15:05:43 +02:00
sigp % r1 ,% r0 ,S I G P _ S E T _ A R C H I T E C T U R E # s w i t c h t o e s a m o d e
2006-09-28 16:56:37 +02:00
lpsw 0
.Ldisab : sll % r14 ,1
srl % r14 ,1 # n e e d t o k i l l h i b i t t o a v o i d s p e c i f i c a t i o n e x c e p t i o n s .
st % r14 ,. L d i s p s w + 1 2 - . L p g 0 ( % r13 )
2005-04-16 15:20:36 -07:00
lpswe . L d i s p s w - . L p g 0 ( % r13 )
2006-09-28 16:56:37 +02:00
.align 8
2005-04-16 15:20:36 -07:00
.Lall : .quad 0x00000000ff000000
2006-09-28 16:56:37 +02:00
.align 16
2005-04-16 15:20:36 -07:00
/ *
* These a d d r e s s e s h a v e t o b e 3 1 b i t o t h e r w i s e
* the s i g p w i l l t h r o w a s p e c i f c a t i o n e x c e p t i o n
* when s w i t c h i n g t o E S A m o d e a s b i t 3 1 b e s e t
* in t h e E S A p s w .
* Bit 3 1 o f t h e a d d r e s s e s h a s t o b e 0 f o r t h e
* 3 1 bit l p s w e i n s t r u c t i o n a f a c t t h e y a p p e a r t o h a v e
2011-03-30 22:57:33 -03:00
* omitted f r o m t h e p o p .
2005-04-16 15:20:36 -07:00
* /
2006-09-28 16:56:37 +02:00
.Lnewpsw : .quad 0x0000000080000000
.quad .Lpg1
.Lpcnew : .quad 0x0000000080000000
.quad .Lecs
.Lionew : .quad 0x0000000080000000
.quad .Lcont
2005-04-16 15:20:36 -07:00
.Lwaitpsw : .quad 0x0202000080000000
2006-09-28 16:56:37 +02:00
.quad .Ltpi
.Ldispsw : .quad 0x0002000080000000
.quad 0x0000000000000000
.Liplccws : .long 0 x0 2 0 0 0 0 0 0 ,0 x60 0 0 0 0 1 8
.long 0 x0 8 0 0 0 0 0 8 ,0 x20 0 0 0 0 0 1
2005-04-16 15:20:36 -07:00
.Liplorb : .long 0 x0 0 4 9 5 0 4 c ,0 x00 4 0 f f80
.long 0 x0 0 0 0 0 0 0 0 + . L i p l c c w s
2006-09-28 16:56:37 +02:00
.Lschib : .long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
2005-04-16 15:20:36 -07:00
.Liplirb : .long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0