2019-02-03 23:37:20 +03:00
/* SPDX-License-Identifier: GPL-2.0 */
/ *
* Code t h a t n e e d s t o r u n b e l o w 2 G B .
*
* Copyright I B M C o r p . 2 0 1 9
* /
# include < l i n u x / l i n k a g e . h >
2022-02-28 13:22:12 +03:00
# include < a s m / a s m - e x t a b l e . h >
2019-02-03 23:37:20 +03:00
# include < a s m / e r r n o . h >
# include < a s m / s i g p . h >
2021-08-04 14:40:31 +03:00
.section .amode31 .text , " ax"
2019-02-03 23:37:20 +03:00
/ *
* Simplified v e r s i o n o f e x p o l i n e t h u n k . T h e n o r m a l t h u n k s c a n n o t b e u s e d h e r e ,
* because t h e y m i g h t b e m o r e t h a n 2 G B a w a y , a n d n o t r e a c h a b l e b y t h e r e l a t i v e
* branch. N o c o m d a t , e x r l , e t c . o p t i m i z a t i o n s u s e d h e r e , b e c a u s e i t o n l y
* affects a f e w f u n c t i o n s t h a t a r e n o t p e r f o r m a n c e - r e l e v a n t .
* /
2021-08-04 14:40:31 +03:00
.macro BR_EX_AMODE31_r14
2021-07-16 23:00:22 +03:00
larl % r1 ,0 f
ex 0 ,0 ( % r1 )
j .
0 : br % r14
2019-02-03 23:37:20 +03:00
.endm
/ *
2021-08-04 14:40:31 +03:00
* int _ d i a g 1 4 _ a m o d e 3 1 ( u n s i g n e d l o n g r x , u n s i g n e d l o n g r y 1 , u n s i g n e d l o n g s u b c o d e )
2019-02-03 23:37:20 +03:00
* /
2021-08-04 14:40:31 +03:00
ENTRY( _ d i a g 1 4 _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
lgr % r1 ,% r2
lgr % r2 ,% r3
lgr % r3 ,% r4
lhi % r5 ,- E I O
sam3 1
diag % r1 ,% r2 ,0 x14
.Ldiag14_ex :
ipm % r5
srl % r5 ,2 8
.Ldiag14_fault :
sam6 4
lgfr % r2 ,% r5
2021-08-04 14:40:31 +03:00
BR_ E X _ A M O D E 3 1 _ r14
EX_ T A B L E _ A M O D E 3 1 ( . L d i a g 1 4 _ e x , . L d i a g 1 4 _ f a u l t )
ENDPROC( _ d i a g 1 4 _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
/ *
2021-08-04 14:40:31 +03:00
* int _ d i a g 2 1 0 _ a m o d e 3 1 ( s t r u c t d i a g 2 1 0 * a d d r )
2019-02-03 23:37:20 +03:00
* /
2021-08-04 14:40:31 +03:00
ENTRY( _ d i a g 2 1 0 _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
lgr % r1 ,% r2
lhi % r2 ,- 1
sam3 1
diag % r1 ,% r0 ,0 x21 0
.Ldiag210_ex :
ipm % r2
srl % r2 ,2 8
.Ldiag210_fault :
sam6 4
lgfr % r2 ,% r2
2021-08-04 14:40:31 +03:00
BR_ E X _ A M O D E 3 1 _ r14
EX_ T A B L E _ A M O D E 3 1 ( . L d i a g 2 1 0 _ e x , . L d i a g 2 1 0 _ f a u l t )
ENDPROC( _ d i a g 2 1 0 _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
/ *
2021-08-04 14:40:31 +03:00
* int _ d i a g 2 6 c _ a m o d e 3 1 ( v o i d * r e q , v o i d * r e s p , e n u m d i a g 2 6 c _ s c s u b c o d e )
2019-02-03 23:37:20 +03:00
* /
2021-08-04 14:40:31 +03:00
ENTRY( _ d i a g 2 6 c _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
lghi % r5 ,- E O P N O T S U P P
sam3 1
diag % r2 ,% r4 ,0 x26 c
.Ldiag26c_ex :
sam6 4
lgfr % r2 ,% r5
2021-08-04 14:40:31 +03:00
BR_ E X _ A M O D E 3 1 _ r14
EX_ T A B L E _ A M O D E 3 1 ( . L d i a g 2 6 c _ e x , . L d i a g 2 6 c _ e x )
ENDPROC( _ d i a g 2 6 c _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
/ *
2021-08-04 14:40:31 +03:00
* void _ d i a g 0 c _ a m o d e 3 1 ( s t r u c t h y p f s _ d i a g 0 c _ e n t r y * e n t r y )
2019-02-03 23:37:20 +03:00
* /
2021-08-04 14:40:31 +03:00
ENTRY( _ d i a g 0 c _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
sam3 1
diag % r2 ,% r2 ,0 x0 c
sam6 4
2021-08-04 14:40:31 +03:00
BR_ E X _ A M O D E 3 1 _ r14
ENDPROC( _ d i a g 0 c _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
/ *
2021-08-04 14:40:31 +03:00
* void _ d i a g 3 0 8 _ r e s e t _ a m o d e 3 1 ( v o i d )
2019-02-03 23:37:20 +03:00
*
* Calls d i a g 3 0 8 s u b c o d e 1 a n d c o n t i n u e s e x e c u t i o n
* /
2021-08-04 14:40:31 +03:00
ENTRY( _ d i a g 3 0 8 _ r e s e t _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
larl % r4 ,. L c t l r e g s # S a v e c o n t r o l r e g i s t e r s
stctg % c0 ,% c15 ,0 ( % r4 )
lg % r2 ,0 ( % r4 ) # D i s a b l e l o w c o r e p r o t e c t i o n
nilh % r2 ,0 x e f f f
larl % r4 ,. L c t l r e g 0
stg % r2 ,0 ( % r4 )
lctlg % c0 ,% c0 ,0 ( % r4 )
larl % r4 ,. L f p c t l # F l o a t i n g p o i n t c o n t r o l r e g i s t e r
stfpc 0 ( % r4 )
larl % r4 ,. L p r e f i x # S a v e p r e f i x r e g i s t e r
stpx 0 ( % r4 )
larl % r4 ,. L p r e f i x _ z e r o # S e t p r e f i x r e g i s t e r t o 0
spx 0 ( % r4 )
larl % r4 ,. L c o n t i n u e _ p s w # S a v e P S W f l a g s
epsw % r2 ,% r3
stm % r2 ,% r3 ,0 ( % r4 )
2021-08-24 18:21:12 +03:00
larl % r4 ,. L r e s t a r t _ p a r t 2 # S e t u p r e s t a r t P S W a t a b s o l u t e 0
2019-02-03 23:37:20 +03:00
larl % r3 ,. L r e s t a r t _ d i a g 3 0 8 _ p s w
og % r4 ,0 ( % r3 ) # S a v e P S W
lghi % r3 ,0
sturg % r4 ,% r3 # U s e s t u r g , b e c a u s e o f l a r g e p a g e s
lghi % r1 ,1
lghi % r0 ,0
diag % r0 ,% r1 ,0 x30 8
2021-08-24 18:21:12 +03:00
.Lrestart_part2 :
2019-02-03 23:37:20 +03:00
lhi % r0 ,0 # L o a d r 0 w i t h z e r o
lhi % r1 ,2 # U s e m o d e 2 = E S A M E ( d u m p )
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 E m o d e
sam6 4 # S w i t c h t o 64 b i t a d d r e s s i n g m o d e
larl % r4 ,. L c t l r e g s # R e s t o r e c o n t r o l r e g i s t e r s
lctlg % c0 ,% c15 ,0 ( % r4 )
larl % r4 ,. L f p c t l # R e s t o r e f l o a t i n g p o i n t c t l r e g i s t e r
lfpc 0 ( % r4 )
larl % r4 ,. L p r e f i x # R e s t o r e p r e f i x r e g i s t e r
spx 0 ( % r4 )
larl % r4 ,. L c o n t i n u e _ p s w # R e s t o r e P S W f l a g s
2021-06-15 17:05:09 +03:00
larl % r2 ,. L c o n t i n u e
stg % r2 ,8 ( % r4 )
2019-02-03 23:37:20 +03:00
lpswe 0 ( % r4 )
.Lcontinue :
2021-08-04 14:40:31 +03:00
BR_ E X _ A M O D E 3 1 _ r14
ENDPROC( _ d i a g 3 0 8 _ r e s e t _ a m o d e 3 1 )
2019-02-03 23:37:20 +03:00
2021-08-04 14:40:31 +03:00
.section .amode31 .data , " aw" ,@progbits
2019-02-03 23:37:20 +03:00
.align 8
.Lrestart_diag308_psw :
.long 0 x0 0 0 8 0 0 0 0 ,0 x80 0 0 0 0 0 0
.align 8
.Lcontinue_psw :
2021-06-15 17:05:09 +03:00
.quad 0 , 0
2019-02-03 23:37:20 +03:00
.align 8
.Lctlreg0 :
.quad 0
.Lctlregs :
.rept 16
.quad 0
.endr
.Lfpctl :
.long 0
.Lprefix :
.long 0
.Lprefix_zero :
.long 0