2019-05-27 09:55:02 +03:00
/* SPDX-License-Identifier: GPL-2.0-or-later */
2005-04-17 02:20:36 +04:00
/ *
* Linux/ P A - R I S C P r o j e c t ( h t t p : / / w w w . p a r i s c - l i n u x . o r g / )
*
* kernel e n t r y p o i n t s ( i n t e r r u p t i o n s , s y s t e m c a l l w r a p p e r s )
* Copyright ( C ) 1 9 9 9 ,2 0 0 0 P h i l i p p R u m p f
* Copyright ( C ) 1 9 9 9 S u S E G m b H N u e r n b e r g
* Copyright ( C ) 2 0 0 0 H e w l e t t - P a c k a r d ( J o h n M a r v i n )
* Copyright ( C ) 1 9 9 9 H e w l e t t - P a c k a r d ( F r a n k R o w a n d )
* /
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
/ * we h a v e t h e f o l l o w i n g p o s s i b i l i t i e s t o a c t o n a n i n t e r r u p t i o n :
* - handle i n a s s e m b l y a n d u s e s h a d o w e d r e g i s t e r s o n l y
* - save r e g i s t e r s t o k e r n e l s t a c k a n d h a n d l e i n a s s e m b l y o r C * /
2005-10-22 06:40:07 +04:00
# include < a s m / p s w . h >
2006-08-14 06:17:19 +04:00
# include < a s m / c a c h e . h > / * f o r L 1 _ C A C H E _ S H I F T * /
2005-04-17 02:20:36 +04:00
# include < a s m / a s s e m b l y . h > / * f o r L D R E G / S T R E G d e f i n e s * /
# include < a s m / s i g n a l . h >
# include < a s m / u n i s t d . h >
2018-01-02 22:36:44 +03:00
# include < a s m / l d c w . h >
2018-08-16 23:39:50 +03:00
# include < a s m / t r a p s . h >
2005-04-17 02:20:36 +04:00
# include < a s m / t h r e a d _ i n f o . h >
2018-10-16 23:38:22 +03:00
# include < a s m / a l t e r n a t i v e . h >
2005-04-17 02:20:36 +04:00
2007-01-23 22:50:59 +03:00
# include < l i n u x / l i n k a g e . h >
2020-06-09 07:32:42 +03:00
# include < l i n u x / p g t a b l e . h >
2007-01-23 22:50:59 +03:00
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
.level 2 .0w
# else
.level 2 .0
# endif
2021-02-12 18:38:52 +03:00
/* Get aligned page_table_lock address for this mm from cr28/tr4 */
.macro get_ptl reg
mfctl % c r28 ,\ r e g
2018-01-02 22:36:44 +03:00
.endm
2005-04-17 02:20:36 +04:00
/* space_to_prot macro creates a prot id from a space id */
# if ( S P A C E I D _ S H I F T ) = = 0
.macro space_to_prot spc p r o t
depd,z \ s p c ,6 2 ,3 1 ,\ p r o t
.endm
# else
.macro space_to_prot spc p r o t
extrd,u \ s p c ,( 6 4 - ( S P A C E I D _ S H I F T ) ) ,3 2 ,\ p r o t
.endm
# endif
/* Switch to virtual mapping, trashing only %r1 */
.macro virt_map
2005-10-22 06:40:07 +04:00
/* pcxt_ssm_bug */
rsm P S W _ S M _ I , % r0 / * b a r r i e r f o r " R e l i e d u p o n T r a n s l a t i o n * /
2005-04-17 02:20:36 +04:00
mtsp % r0 , % s r4
mtsp % r0 , % s r5
2013-05-20 20:42:53 +04:00
mtsp % r0 , % s r6
2005-10-22 06:40:07 +04:00
tovirt_ r1 % r29
load3 2 K E R N E L _ P S W , % r1
rsm P S W _ S M _ Q U I E T ,% r0 / * s e c o n d " h e a v y w e i g h t " c t l o p * /
2005-04-17 02:20:36 +04:00
mtctl % r0 , % c r17 / * C l e a r I I A S Q t a i l * /
mtctl % r0 , % c r17 / * C l e a r I I A S Q h e a d * /
2005-10-22 06:40:07 +04:00
mtctl % r1 , % i p s w
2005-04-17 02:20:36 +04:00
load3 2 4 f , % r1
mtctl % r1 , % c r18 / * S e t I I A O Q t a i l * /
ldo 4 ( % r1 ) , % r1
mtctl % r1 , % c r18 / * S e t I I A O Q h e a d * /
rfir
nop
4 :
.endm
/ *
* The " g e t _ s t a c k " m a c r o s a r e r e s p o n s i b l e f o r d e t e r m i n i n g t h e
* kernel s t a c k v a l u e .
*
* If s r7 = = 0
* Already u s i n g a k e r n e l s t a c k , s o c a l l t h e
* get_ s t a c k _ u s e _ r30 m a c r o t o p u s h a p t _ r e g s s t r u c t u r e
* on t h e s t a c k , a n d s t o r e r e g i s t e r s t h e r e .
* else
* Need t o s e t u p a k e r n e l s t a c k , s o c a l l t h e
* get_ s t a c k _ u s e _ c r30 m a c r o t o s e t u p a p o i n t e r
* to t h e p t _ r e g s s t r u c t u r e c o n t a i n e d w i t h i n t h e
* task p o i n t e r p o i n t e d t o b y c r30 . S e t t h e s t a c k
* pointer t o p o i n t t o t h e e n d o f t h e t a s k s t r u c t u r e .
*
* Note t h a t w e u s e s h a d o w e d r e g i s t e r s f o r t e m p s u n t i l
* we c a n s a v e % r26 a n d % r29 . % r26 i s u s e d t o p r e s e r v e
* % r8 ( a s h a d o w e d r e g i s t e r ) w h i c h t e m p o r a r i l y c o n t a i n e d
* either t h e f a u l t t y p e ( " c o d e " ) o r t h e e i r r . W e n e e d
* to u s e a n o n - s h a d o w e d r e g i s t e r t o c a r r y t h e v a l u e o v e r
* the r f i r i n v i r t _ m a p . W e u s e % r26 s i n c e t h i s v a l u e w i n d s
* up b e i n g p a s s e d a s t h e a r g u m e n t t o e i t h e r d o _ c p u _ i r q _ m a s k
* or h a n d l e _ i n t e r r u p t i o n . % r29 i s u s e d t o h o l d a p o i n t e r
* the r e g i s t e r s a v e a r e a , a n d o n c e a g a i n , i t n e e d s t o
* be a n o n - s h a d o w e d r e g i s t e r s o t h a t i t s u r v i v e s t h e r f i r .
*
* N. B . T A S K _ S Z _ A L G N a n d P T _ S Z _ A L G N i n c l u d e s p a c e f o r a s t a c k f r a m e .
* /
.macro get_stack_use_cr30
/* we save the registers in the task struct */
2013-05-20 20:42:53 +04:00
copy % r30 , % r17
2005-04-17 02:20:36 +04:00
mfctl % c r30 , % r1
2013-05-20 20:42:53 +04:00
ldo T H R E A D _ S Z _ A L G N ( % r1 ) , % r30
mtsp % r0 ,% s r7
mtsp % r16 ,% s r3
2005-04-17 02:20:36 +04:00
tophys % r1 ,% r9
LDREG T I _ T A S K ( % r9 ) , % r1 / * t h r e a d _ i n f o - > t a s k _ s t r u c t * /
tophys % r1 ,% r9
ldo T A S K _ R E G S ( % r9 ) ,% r9
2013-05-20 20:42:53 +04:00
STREG % r17 ,P T _ G R 3 0 ( % r9 )
2005-04-17 02:20:36 +04:00
STREG % r29 ,P T _ G R 2 9 ( % r9 )
STREG % r26 ,P T _ G R 2 6 ( % r9 )
2013-05-20 20:42:53 +04:00
STREG % r16 ,P T _ S R 7 ( % r9 )
2005-04-17 02:20:36 +04:00
copy % r9 ,% r29
.endm
.macro get_stack_use_r30
/* we put a struct pt_regs on the stack and save the registers there */
tophys % r30 ,% r9
2013-05-20 20:42:53 +04:00
copy % r30 ,% r1
2005-04-17 02:20:36 +04:00
ldo P T _ S Z _ A L G N ( % r30 ) ,% r30
2013-05-20 20:42:53 +04:00
STREG % r1 ,P T _ G R 3 0 ( % r9 )
2005-04-17 02:20:36 +04:00
STREG % r29 ,P T _ G R 2 9 ( % r9 )
STREG % r26 ,P T _ G R 2 6 ( % r9 )
2013-05-20 20:42:53 +04:00
STREG % r16 ,P T _ S R 7 ( % r9 )
2005-04-17 02:20:36 +04:00
copy % r9 ,% r29
.endm
.macro rest_stack
LDREG P T _ G R 1 ( % r29 ) , % r1
LDREG P T _ G R 3 0 ( % r29 ) ,% r30
LDREG P T _ G R 2 9 ( % r29 ) ,% r29
.endm
/ * default i n t e r r u p t i o n h a n d l e r
* ( calls t r a p s . c : h a n d l e _ i n t e r r u p t i o n ) * /
.macro def code
b i n t r _ s a v e
ldi \ c o d e , % r8
.align 32
.endm
/ * Interrupt i n t e r r u p t i o n h a n d l e r
* ( calls i r q . c : d o _ c p u _ i r q _ m a s k ) * /
.macro extint code
b i n t r _ e x t i n t
mfsp % s r7 ,% r16
.align 32
.endm
.import os_ h p m c , c o d e
/* HPMC handler */
.macro hpmc code
nop / * m u s t b e a N O P , w i l l b e p a t c h e d l a t e r * /
load3 2 P A ( o s _ h p m c ) , % r3
bv,n 0 ( % r3 )
nop
.word 0 /* checksum (will be patched) */
parisc: Fix address in HPMC IVA
Helge noticed that the address of the os_hpmc handler was not being
correctly calculated in the hpmc macro. As a result, PDCE_CHECK would
fail to call os_hpmc:
<Cpu2> e800009802e00000 0000000000000000 CC_ERR_CHECK_HPMC
<Cpu2> 37000f7302e00000 8040004000000000 CC_ERR_CPU_CHECK_SUMMARY
<Cpu2> f600105e02e00000 fffffff0f0c00000 CC_MC_HPMC_MONARCH_SELECTED
<Cpu2> 140003b202e00000 000000000000000b CC_ERR_HPMC_STATE_ENTRY
<Cpu2> 5600100b02e00000 00000000000001a0 CC_MC_OS_HPMC_LEN_ERR
<Cpu2> 5600106402e00000 fffffff0f0438e70 CC_MC_BR_TO_OS_HPMC_FAILED
<Cpu2> e800009802e00000 0000000000000000 CC_ERR_CHECK_HPMC
<Cpu2> 37000f7302e00000 8040004000000000 CC_ERR_CPU_CHECK_SUMMARY
<Cpu2> 4000109f02e00000 0000000000000000 CC_MC_HPMC_INITIATED
<Cpu2> 4000101902e00000 0000000000000000 CC_MC_MULTIPLE_HPMCS
<Cpu2> 030010d502e00000 0000000000000000 CC_CPU_STOP
The address problem can be seen by dumping the fault vector:
0000000040159000 <fault_vector_20>:
40159000: 63 6f 77 73 stb r15,-2447(dp)
40159004: 20 63 61 6e ldil L%b747000,r3
40159008: 20 66 6c 79 ldil L%-1c3b3000,r3
...
40159020: 08 00 02 40 nop
40159024: 20 6e 60 02 ldil L%15d000,r3
40159028: 34 63 00 00 ldo 0(r3),r3
4015902c: e8 60 c0 02 bv,n r0(r3)
40159030: 08 00 02 40 nop
40159034: 00 00 00 00 break 0,0
40159038: c0 00 70 00 bb,*< r0,sar,40159840 <fault_vector_20+0x840>
4015903c: 00 00 00 00 break 0,0
Location 40159038 should contain the physical address of os_hpmc:
000000004015d000 <os_hpmc>:
4015d000: 08 1a 02 43 copy r26,r3
4015d004: 01 c0 08 a4 mfctl iva,r4
4015d008: 48 85 00 68 ldw 34(r4),r5
This patch moves the address setup into initialize_ivt to resolve the
above problem. I tested the change by dumping the HPMC entry after setup:
0000000040209020: 8000240
0000000040209024: 206a2004
0000000040209028: 34630ac0
000000004020902c: e860c002
0000000040209030: 8000240
0000000040209034: 1bdddce6
0000000040209038: 15d000
000000004020903c: 1a0
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2018-10-06 20:11:30 +03:00
.word 0 /* address of handler */
2005-04-17 02:20:36 +04:00
.word 0 /* length of handler */
.endm
/ *
* Performance N o t e : I n s t r u c t i o n s w i l l b e m o v e d u p i n t o
* this p a r t o f t h e c o d e l a t e r o n , o n c e w e a r e s u r e
* that t h e t l b m i s s h a n d l e r s a r e c l o s e t o f i n a l f o r m .
* /
/* Register definitions for tlb miss handler macros */
2011-03-31 05:57:33 +04:00
va = r8 / * v i r t u a l a d d r e s s f o r w h i c h t h e t r a p o c c u r r e d * /
spc = r24 / * s p a c e f o r w h i c h t h e t r a p o c c u r r e d * /
2005-04-17 02:20:36 +04:00
2005-10-22 06:46:48 +04:00
# ifndef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
/ *
* itlb m i s s i n t e r r u p t i o n h a n d l e r ( p a r i s c 1 . 1 - 3 2 b i t )
* /
.macro itlb_11 code
mfctl % p c s q , s p c
b i t l b _ m i s s _ 1 1
mfctl % p c o q , v a
.align 32
.endm
# endif
/ *
* itlb m i s s i n t e r r u p t i o n h a n d l e r ( p a r i s c 2 . 0 )
* /
.macro itlb_20 code
mfctl % p c s q , s p c
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
b i t l b _ m i s s _ 2 0 w
# else
b i t l b _ m i s s _ 2 0
# endif
mfctl % p c o q , v a
.align 32
.endm
2005-10-22 06:46:48 +04:00
# ifndef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
/ *
* naitlb m i s s i n t e r r u p t i o n h a n d l e r ( p a r i s c 1 . 1 - 3 2 b i t )
* /
.macro naitlb_11 code
mfctl % i s r ,s p c
2010-12-22 19:22:11 +03:00
b n a i t l b _ m i s s _ 1 1
2005-04-17 02:20:36 +04:00
mfctl % i o r ,v a
.align 32
.endm
# endif
/ *
* naitlb m i s s i n t e r r u p t i o n h a n d l e r ( p a r i s c 2 . 0 )
* /
.macro naitlb_20 code
mfctl % i s r ,s p c
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2010-12-22 19:22:11 +03:00
b n a i t l b _ m i s s _ 2 0 w
2005-04-17 02:20:36 +04:00
# else
2010-12-22 19:22:11 +03:00
b n a i t l b _ m i s s _ 2 0
2005-04-17 02:20:36 +04:00
# endif
mfctl % i o r ,v a
.align 32
.endm
2005-10-22 06:46:48 +04:00
# ifndef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
/ *
* dtlb m i s s i n t e r r u p t i o n h a n d l e r ( p a r i s c 1 . 1 - 3 2 b i t )
* /
.macro dtlb_11 code
mfctl % i s r , s p c
b d t l b _ m i s s _ 1 1
mfctl % i o r , v a
.align 32
.endm
# endif
/ *
* dtlb m i s s i n t e r r u p t i o n h a n d l e r ( p a r i s c 2 . 0 )
* /
.macro dtlb_20 code
mfctl % i s r , s p c
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
b d t l b _ m i s s _ 2 0 w
# else
b d t l b _ m i s s _ 2 0
# endif
mfctl % i o r , v a
.align 32
.endm
2005-10-22 06:46:48 +04:00
# ifndef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
/* nadtlb miss interruption handler (parisc 1.1 - 32 bit) */
.macro nadtlb_11 code
mfctl % i s r ,s p c
b n a d t l b _ m i s s _ 1 1
mfctl % i o r ,v a
.align 32
.endm
# endif
/* nadtlb miss interruption handler (parisc 2.0) */
.macro nadtlb_20 code
mfctl % i s r ,s p c
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
b n a d t l b _ m i s s _ 2 0 w
# else
b n a d t l b _ m i s s _ 2 0
# endif
mfctl % i o r ,v a
.align 32
.endm
2005-10-22 06:46:48 +04:00
# ifndef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
/ *
* dirty b i t t r a p i n t e r r u p t i o n h a n d l e r ( p a r i s c 1 . 1 - 3 2 b i t )
* /
.macro dbit_11 code
mfctl % i s r ,s p c
b d b i t _ t r a p _ 1 1
mfctl % i o r ,v a
.align 32
.endm
# endif
/ *
* dirty b i t t r a p i n t e r r u p t i o n h a n d l e r ( p a r i s c 2 . 0 )
* /
.macro dbit_20 code
mfctl % i s r ,s p c
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
b d b i t _ t r a p _ 2 0 w
# else
b d b i t _ t r a p _ 2 0
# endif
mfctl % i o r ,v a
.align 32
.endm
/ * In L P 6 4 , t h e s p a c e c o n t a i n s p a r t o f t h e u p p e r 3 2 b i t s o f t h e
* fault. W e h a v e t o e x t r a c t t h i s a n d p l a c e i t i n t h e v a ,
* zeroing t h e c o r r e s p o n d i n g b i t s i n t h e s p a c e r e g i s t e r * /
.macro space_adjust spc,v a ,t m p
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
extrd,u \ s p c ,6 3 ,S P A C E I D _ S H I F T ,\ t m p
depd % r0 ,6 3 ,S P A C E I D _ S H I F T ,\ s p c
depd \ t m p ,3 1 ,S P A C E I D _ S H I F T ,\ v a
# endif
.endm
.import swapper_ p g _ d i r ,c o d e
/ * Get t h e p g d . F o r f a u l t s o n s p a c e z e r o ( k e r n e l s p a c e ) , t h i s
* is s i m p l y s w a p p e r _ p g _ d i r . F o r u s e r s p a c e f a u l t s , t h e
* pgd i s s t o r e d i n % c r25 * /
.macro get_pgd spc,r e g
ldil L % P A ( s w a p p e r _ p g _ d i r ) ,\ r e g
ldo R % P A ( s w a p p e r _ p g _ d i r ) ( \ r e g ) ,\ r e g
or,C O N D ( = ) % r0 ,\ s p c ,% r0
mfctl % c r25 ,\ r e g
.endm
/ *
space_ c h e c k ( s p c ,t m p ,f a u l t )
spc - T h e s p a c e w e s a w t h e f a u l t w i t h .
tmp - T h e p l a c e t o s t o r e t h e c u r r e n t s p a c e .
fault - F u n c t i o n t o c a l l o n f a i l u r e .
Only a l l o w f a u l t s o n d i f f e r e n t s p a c e s f r o m t h e
currently a c t i v e o n e i f w e ' r e t h e k e r n e l
* /
.macro space_check spc,t m p ,f a u l t
mfsp % s r7 ,\ t m p
2018-10-25 09:31:16 +03:00
/* check against %r0 which is same value as LINUX_GATEWAY_SPACE */
2005-04-17 02:20:36 +04:00
or,C O N D ( < > ) % r0 ,\ s p c ,% r0 / * u s e r m a y e x e c u t e g a t e w a y p a g e
* as k e r n e l , s o d e f e a t t h e s p a c e
* check i f i t i s * /
copy \ s p c ,\ t m p
or,C O N D ( = ) % r0 ,\ t m p ,% r0 / * n u l l i f y i f e x e c u t i n g a s k e r n e l * /
cmpb,C O N D ( < > ) ,n \ t m p ,\ s p c ,\ f a u l t
.endm
/ * Look u p a P T E i n a 2 - L e v e l s c h e m e ( f a u l t i n g a t e a c h
* level i f t h e e n t r y i s n ' t p r e s e n t
*
* NOTE : we u s e l d w e v e n f o r L P 6 4 , s i n c e t h e s h o r t p o i n t e r s
* can a d d r e s s u p t o 1 T B
* /
.macro L2_ptep pmd,p t e ,i n d e x ,v a ,f a u l t
2015-04-15 01:45:54 +03:00
# if C O N F I G _ P G T A B L E _ L E V E L S = = 3
2010-04-11 21:03:54 +04:00
extru \ v a ,3 1 - A S M _ P M D _ S H I F T ,A S M _ B I T S _ P E R _ P M D ,\ i n d e x
2005-04-17 02:20:36 +04:00
# else
2013-05-03 00:41:45 +04:00
# if d e f i n e d ( C O N F I G _ 6 4 B I T )
extrd,u \ v a ,6 3 - A S M _ P G D I R _ S H I F T ,A S M _ B I T S _ P E R _ P G D ,\ i n d e x
# else
# if P A G E _ S I Z E > 4 0 9 6
extru \ v a ,3 1 - A S M _ P G D I R _ S H I F T ,3 2 - A S M _ P G D I R _ S H I F T ,\ i n d e x
# else
2010-04-11 21:03:54 +04:00
extru \ v a ,3 1 - A S M _ P G D I R _ S H I F T ,A S M _ B I T S _ P E R _ P G D ,\ i n d e x
2013-05-03 00:41:45 +04:00
# endif
# endif
2005-04-17 02:20:36 +04:00
# endif
2010-04-11 21:03:54 +04:00
dep % r0 ,3 1 ,P A G E _ S H I F T ,\ p m d / * c l e a r o f f s e t * /
2021-02-12 18:38:52 +03:00
# if C O N F I G _ P G T A B L E _ L E V E L S < 3
2005-04-17 02:20:36 +04:00
copy % r0 ,\ p t e
2021-02-12 18:38:52 +03:00
# endif
2005-04-17 02:20:36 +04:00
ldw,s \ i n d e x ( \ p m d ) ,\ p m d
bb,> = ,n \ p m d ,_ P x D _ P R E S E N T _ B I T ,\ f a u l t
2010-04-11 21:03:54 +04:00
dep % r0 ,3 1 ,P x D _ F L A G _ S H I F T ,\ p m d / * c l e a r f l a g s * /
2018-10-19 21:36:15 +03:00
SHLREG \ p m d ,P x D _ V A L U E _ S H I F T ,\ p m d
2010-04-11 21:03:54 +04:00
extru \ v a ,3 1 - P A G E _ S H I F T ,A S M _ B I T S _ P E R _ P T E ,\ i n d e x
dep % r0 ,3 1 ,P A G E _ S H I F T ,\ p m d / * c l e a r o f f s e t * /
2015-07-02 00:18:37 +03:00
shladd \ i n d e x ,B I T S _ P E R _ P T E _ E N T R Y ,\ p m d ,\ p m d / * p m d i s n o w p t e * /
2005-04-17 02:20:36 +04:00
.endm
2021-02-12 18:38:52 +03:00
/* Look up PTE in a 3-Level scheme. */
2005-04-17 02:20:36 +04:00
.macro L3_ptep pgd,p t e ,i n d e x ,v a ,f a u l t
2021-02-12 18:38:52 +03:00
# if C O N F I G _ P G T A B L E _ L E V E L S = = 3
copy % r0 ,\ p t e
2005-04-17 02:20:36 +04:00
extrd,u \ v a ,6 3 - A S M _ P G D I R _ S H I F T ,A S M _ B I T S _ P E R _ P G D ,\ i n d e x
ldw,s \ i n d e x ( \ p g d ) ,\ p g d
bb,> = ,n \ p g d ,_ P x D _ P R E S E N T _ B I T ,\ f a u l t
2021-02-12 18:38:52 +03:00
shld \ p g d ,P x D _ V A L U E _ S H I F T ,\ p g d
2006-04-21 00:40:23 +04:00
# endif
2005-04-17 02:20:36 +04:00
L2 _ p t e p \ p g d ,\ p t e ,\ i n d e x ,\ v a ,\ f a u l t
.endm
2021-02-12 18:38:52 +03:00
/* Acquire page_table_lock and check page is present. */
.macro ptl_lock spc,p t p ,p t e ,t m p ,t m p1 ,f a u l t
# ifdef C O N F I G _ T L B _ P T L O C K
2018-10-16 23:38:22 +03:00
98 : cmpib,C O N D ( = ) ,n 0 ,\ s p c ,2 f
2021-02-12 18:38:52 +03:00
get_ p t l \ t m p
2013-05-11 03:21:38 +04:00
1 : LDCW 0 ( \ t m p ) ,\ t m p1
cmpib,C O N D ( = ) 0 ,\ t m p1 ,1 b
nop
2015-07-02 00:18:37 +03:00
LDREG 0 ( \ p t p ) ,\ p t e
2018-09-29 23:34:59 +03:00
bb,< ,n \ p t e ,_ P A G E _ P R E S E N T _ B I T ,3 f
2015-07-02 00:18:37 +03:00
b \ f a u l t
2020-07-28 20:13:20 +03:00
stw \ s p c ,0 ( \ t m p )
2018-10-16 23:38:22 +03:00
99 : ALTERNATIVE( 9 8 b , 9 9 b , A L T _ C O N D _ N O _ S M P , I N S N _ N O P )
2013-05-11 03:21:38 +04:00
# endif
2018-09-29 23:34:59 +03:00
2 : LDREG 0 ( \ p t p ) ,\ p t e
bb,> = ,n \ p t e ,_ P A G E _ P R E S E N T _ B I T ,\ f a u l t
3 :
2013-05-11 03:21:38 +04:00
.endm
2021-02-12 18:38:52 +03:00
/ * Release p a g e _ t a b l e _ l o c k w i t h o u t r e l o a d i n g l o c k a d d r e s s .
2020-07-28 20:13:20 +03:00
Note t h a t t h e v a l u e s i n t h e r e g i s t e r s p c a r e l i m i t e d t o
NR_ S P A C E _ I D S ( 2 6 2 1 4 4 ) . T h u s , t h e s t w i n s t r u c t i o n a l w a y s
stores a n o n z e r o v a l u e e v e n w h e n r e g i s t e r s p c i s 6 4 b i t s .
We u s e a n o r d e r e d s t o r e t o e n s u r e a l l p r i o r a c c e s s e s a r e
performed p r i o r t o r e l e a s i n g t h e l o c k . * /
2021-02-12 18:38:52 +03:00
.macro ptl_unlock0 spc,t m p
# ifdef C O N F I G _ T L B _ P T L O C K
2018-10-16 23:38:22 +03:00
98 : or,C O N D ( = ) % r0 ,\ s p c ,% r0
2020-07-28 19:54:40 +03:00
stw,m a \ s p c ,0 ( \ t m p )
2018-10-16 23:38:22 +03:00
99 : ALTERNATIVE( 9 8 b , 9 9 b , A L T _ C O N D _ N O _ S M P , I N S N _ N O P )
2013-05-11 03:21:38 +04:00
# endif
.endm
2021-02-12 18:38:52 +03:00
/* Release page_table_lock. */
.macro ptl_unlock1 spc,t m p
# ifdef C O N F I G _ T L B _ P T L O C K
98 : get_ p t l \ t m p
ptl_ u n l o c k 0 \ s p c ,\ t m p
2018-10-16 23:38:22 +03:00
99 : ALTERNATIVE( 9 8 b , 9 9 b , A L T _ C O N D _ N O _ S M P , I N S N _ N O P )
2013-05-11 03:21:38 +04:00
# endif
.endm
2005-04-17 02:20:36 +04:00
/ * Set t h e _ P A G E _ A C C E S S E D b i t o f t h e P T E . B e c l e v e r a n d
* don' t n e e d l e s s l y d i r t y t h e c a c h e l i n e i f i t w a s a l r e a d y s e t * /
2015-07-02 00:18:37 +03:00
.macro update_accessed ptp,p t e ,t m p ,t m p1
2005-04-17 02:20:36 +04:00
ldi _ P A G E _ A C C E S S E D ,\ t m p1
or \ t m p1 ,\ p t e ,\ t m p
and,C O N D ( < > ) \ t m p1 ,\ p t e ,% r0
2015-07-02 00:18:37 +03:00
STREG \ t m p ,0 ( \ p t p )
2005-04-17 02:20:36 +04:00
.endm
/ * Set t h e d i r t y b i t ( a n d a c c e s s e d b i t ) . N o n e e d t o b e
* clever, t h i s i s o n l y u s e d f r o m t h e d i r t y f a u l t * /
2015-07-02 00:18:37 +03:00
.macro update_dirty ptp,p t e ,t m p
2005-04-17 02:20:36 +04:00
ldi _ P A G E _ A C C E S S E D | _ P A G E _ D I R T Y ,\ t m p
or \ t m p ,\ p t e ,\ p t e
2015-07-02 00:18:37 +03:00
STREG \ p t e ,0 ( \ p t p )
2005-04-17 02:20:36 +04:00
.endm
2015-11-22 02:07:06 +03:00
/ * We h a v e ( d e p e n d i n g o n t h e p a g e s i z e ) :
* - 3 8 to 5 2 - b i t P h y s i c a l P a g e N u m b e r
* - 1 2 to 2 6 - b i t p a g e o f f s e t
* /
2009-02-05 02:06:00 +03:00
/ * bitshift d i f f e r e n c e b e t w e e n a P F N ( b a s e d o n k e r n e l ' s P A G E _ S I Z E )
* to a C P U T L B 4 k P F N ( 4 k = > 1 2 b i t s t o s h i f t ) * /
2015-11-22 02:07:06 +03:00
# define P A G E _ A D D _ S H I F T ( P A G E _ S H I F T - 1 2 )
# define P A G E _ A D D _ H U G E _ S H I F T ( R E A L _ H P A G E _ S H I F T - 1 2 )
2009-02-05 02:06:00 +03:00
/* Drop prot bits and convert to page addr for iitlbt and idtlbt */
2015-11-22 02:07:06 +03:00
.macro convert_for_tlb_insert20 pte,t m p
# ifdef C O N F I G _ H U G E T L B _ P A G E
copy \ p t e ,\ t m p
extrd,u \ t m p ,( 6 3 - A S M _ P F N _ P T E _ S H I F T ) + ( 6 3 - 5 8 ) + P A G E _ A D D _ S H I F T ,\
6 4 - PAGE_ S H I F T - P A G E _ A D D _ S H I F T ,\ p t e
depdi _ P A G E _ S I Z E _ E N C O D I N G _ D E F A U L T ,6 3 ,\
( 6 3 - 5 8 ) + PAGE_ A D D _ S H I F T ,\ p t e
extrd,u ,* = \ t m p ,_ P A G E _ H P A G E _ B I T + 3 2 ,1 ,% r0
depdi _ H U G E _ P A G E _ S I Z E _ E N C O D I N G _ D E F A U L T ,6 3 ,\
( 6 3 - 5 8 ) + PAGE_ A D D _ H U G E _ S H I F T ,\ p t e
# else / * H u g e p a g e s d i s a b l e d * /
2009-02-05 02:06:00 +03:00
extrd,u \ p t e ,( 6 3 - A S M _ P F N _ P T E _ S H I F T ) + ( 6 3 - 5 8 ) + P A G E _ A D D _ S H I F T ,\
6 4 - PAGE_ S H I F T - P A G E _ A D D _ S H I F T ,\ p t e
depdi _ P A G E _ S I Z E _ E N C O D I N G _ D E F A U L T ,6 3 ,\
( 6 3 - 5 8 ) + PAGE_ A D D _ S H I F T ,\ p t e
2015-11-22 02:07:06 +03:00
# endif
2009-02-05 02:06:00 +03:00
.endm
2005-04-17 02:20:36 +04:00
/ * Convert t h e p t e a n d p r o t t o t l b i n s e r t i o n v a l u e s . H o w
* this h a p p e n s i s q u i t e s u b t l e , r e a d b e l o w * /
2015-11-22 02:07:06 +03:00
.macro make_insert_tlb spc,p t e ,p r o t ,t m p
2005-04-17 02:20:36 +04:00
space_ t o _ p r o t \ s p c \ p r o t / * c r e a t e p r o t i d f r o m s p a c e * /
/ * The f o l l o w i n g i s t h e r e a l s u b t l e t y . T h i s i s d e p o s i t i n g
* T < - > _ P A G E _ R E F T R A P
* D < - > _ P A G E _ D I R T Y
* B < - > _ P A G E _ D M B ( m e m o r y b r e a k )
*
* Then i n c r e d i b l e s u b t l e t y : T h e a c c e s s r i g h t s a r e
2013-01-14 02:04:18 +04:00
* _ PAGE_ G A T E W A Y , _ P A G E _ E X E C a n d _ P A G E _ W R I T E
2005-04-17 02:20:36 +04:00
* See 3 - 1 4 o f t h e p a r i s c 2 . 0 m a n u a l
*
* Finally, _ P A G E _ R E A D g o e s i n t h e t o p b i t o f P L 1 ( s o w e
* trigger a n a c c e s s r i g h t s t r a p i n u s e r s p a c e i f t h e u s e r
* tries t o r e a d a n u n r e a d a b l e p a g e * /
depd \ p t e ,8 ,7 ,\ p r o t
/ * PAGE_ U S E R i n d i c a t e s t h e p a g e c a n b e r e a d w i t h u s e r p r i v i l e g e s ,
* so d e p o s i t X 1 | 1 1 t o P L 1 | P L 2 ( r e m e m b e r t h e u p p e r b i t o f P L 1
2013-01-14 02:04:18 +04:00
* contains _ P A G E _ R E A D ) * /
2005-04-17 02:20:36 +04:00
extrd,u ,* = \ p t e ,_ P A G E _ U S E R _ B I T + 3 2 ,1 ,% r0
depdi 7 ,1 1 ,3 ,\ p r o t
/ * If w e ' r e a g a t e w a y p a g e , d r o p P L 2 b a c k t o z e r o f o r p r o m o t i o n
* to k e r n e l p r i v i l e g e ( s o w e c a n e x e c u t e t h e p a g e a s k e r n e l ) .
* Any p r i v i l e g e p r o m o t i o n p a g e a l w a y s d e n y s r e a d a n d w r i t e * /
extrd,u ,* = \ p t e ,_ P A G E _ G A T E W A Y _ B I T + 3 2 ,1 ,% r0
depd % r0 ,1 1 ,2 ,\ p r o t / * I f G a t e w a y , S e t P L 2 t o 0 * /
2006-04-21 00:40:23 +04:00
/ * Enforce u n c a c h e a b l e p a g e s .
* This s h o u l d O N L Y b e u s e f o r M M I O o n P A 2 . 0 m a c h i n e s .
* Memory/ D M A i s c a c h e c o h e r e n t o n a l l P A 2 . 0 m a c h i n e s w e s u p p o r t
* ( that m e a n s T - c l a s s i s N O T s u p p o r t e d ) a n d t h e m e m o r y c o n t r o l l e r s
* on m o s t o f t h o s e m a c h i n e s o n l y h a n d l e s c a c h e t r a n s a c t i o n s .
* /
extrd,u ,* = \ p t e ,_ P A G E _ N O _ C A C H E _ B I T + 3 2 ,1 ,% r0
2009-07-13 05:44:37 +04:00
depdi 1 ,1 2 ,1 ,\ p r o t
2005-04-17 02:20:36 +04:00
2006-04-21 00:40:23 +04:00
/* Drop prot bits and convert to page addr for iitlbt and idtlbt */
2015-11-22 02:07:06 +03:00
convert_ f o r _ t l b _ i n s e r t 2 0 \ p t e \ t m p
2005-04-17 02:20:36 +04:00
.endm
/ * Identical m a c r o t o m a k e _ i n s e r t _ t l b a b o v e , e x c e p t i t
* makes t h e t l b e n t r y f o r t h e d i f f e r e n t l y f o r m a t t e d p a11
* insertion i n s t r u c t i o n s * /
.macro make_insert_tlb_11 spc,p t e ,p r o t
zdep \ s p c ,3 0 ,1 5 ,\ p r o t
dep \ p t e ,8 ,7 ,\ p r o t
extru,= \ p t e ,_ P A G E _ N O _ C A C H E _ B I T ,1 ,% r0
depi 1 ,1 2 ,1 ,\ p r o t
extru,= \ p t e ,_ P A G E _ U S E R _ B I T ,1 ,% r0
depi 7 ,1 1 ,3 ,\ p r o t / * S e t f o r u s e r s p a c e ( 1 r s v d f o r r e a d ) * /
extru,= \ p t e ,_ P A G E _ G A T E W A Y _ B I T ,1 ,% r0
depi 0 ,1 1 ,2 ,\ p r o t / * I f G a t e w a y , S e t P L 2 t o 0 * /
/* Get rid of prot bits and convert to page addr for iitlba */
2009-01-18 21:30:18 +03:00
depi 0 ,3 1 ,A S M _ P F N _ P T E _ S H I F T ,\ p t e
SHRREG \ p t e ,( A S M _ P F N _ P T E _ S H I F T - ( 3 1 - 2 6 ) ) ,\ p t e
2005-04-17 02:20:36 +04:00
.endm
/ * This i s f o r I L P 3 2 P A 2 . 0 o n l y . T h e T L B i n s e r t i o n n e e d s
* to e x t e n d i n t o I / O s p a c e i f t h e a d d r e s s i s 0 x f X X X X X X X
* so w e e x t e n d t h e f ' s i n t o t h e t o p w o r d o f t h e p t e i n
* this c a s e * /
.macro f_extend pte,t m p
extrd,s \ p t e ,4 2 ,4 ,\ t m p
addi,< > 1 ,\ t m p ,% r0
extrd,s \ p t e ,6 3 ,2 5 ,\ p t e
.endm
/ * The a l i a s r e g i o n i s a n 8 M B a l i g n e d 1 6 M B t o d o c l e a r a n d
* copy u s e r p a g e s a t a d d r e s s e s c o n g r u e n t w i t h t h e u s e r
* virtual a d d r e s s .
*
* To u s e t h e a l i a s p a g e , y o u s e t % r26 u p w i t h t h e t o T L B
* entry ( i d e n t i f y i n g t h e p h y s i c a l p a g e ) a n d % r23 u p w i t h
* the f r o m t l b e n t r y ( o r n o t h i n g i f o n l y a t o e n t r y - - - f o r
* clear_ u s e r _ p a g e _ a s m ) * /
2012-05-21 10:49:01 +04:00
.macro do_alias spc,t m p ,t m p1 ,v a ,p t e ,p r o t ,f a u l t ,p a t y p e
2005-04-17 02:20:36 +04:00
cmpib,C O N D ( < > ) ,n 0 ,\ s p c ,\ f a u l t
ldil L % ( T M P A L I A S _ M A P _ S T A R T ) ,\ t m p
2005-10-22 06:46:48 +04:00
# if d e f i n e d ( C O N F I G _ 6 4 B I T ) & & ( T M P A L I A S _ M A P _ S T A R T > = 0 x80 0 0 0 0 0 0 )
2005-04-17 02:20:36 +04:00
/ * on L P 6 4 , l d i w i l l s i g n e x t e n d i n t o t h e u p p e r 3 2 b i t s ,
* which i s b e h a v i o u r w e d o n ' t w a n t * /
depdi 0 ,3 1 ,3 2 ,\ t m p
# endif
copy \ v a ,\ t m p1
2010-04-11 21:03:54 +04:00
depi 0 ,3 1 ,2 3 ,\ t m p1
2005-04-17 02:20:36 +04:00
cmpb,C O N D ( < > ) ,n \ t m p ,\ t m p1 ,\ f a u l t
2010-12-22 19:22:11 +03:00
mfctl % c r19 ,\ t m p / * i i r * /
/* get the opcode (first six bits) into \tmp */
extrw,u \ t m p ,5 ,6 ,\ t m p
/ *
* Only s e t t i n g t h e T b i t p r e v e n t s d a t a c a c h e m o v e i n
* Setting a c c e s s r i g h t s t o z e r o p r e v e n t s i n s t r u c t i o n c a c h e m o v e i n
*
* Note s u b t l e t y h e r e : _ P A G E _ G A T E W A Y , _ P A G E _ E X E C a n d _ P A G E _ W R I T E g o
* to t y p e f i e l d a n d _ P A G E _ R E A D g o e s t o t o p b i t o f P L 1
* /
ldi ( _ P A G E _ R E F T R A P | _ P A G E _ R E A D | _ P A G E _ W R I T E ) ,\ p r o t
/ *
* so i f t h e o p c o d e i s o n e ( i . e . t h i s i s a m e m o r y m a n a g e m e n t
* instruction) n u l l i f y t h e n e x t l o a d s o \ p r o t i s o n l y T .
* Otherwise t h i s i s a n o r m a l d a t a o p e r a t i o n
* /
cmpiclr,= 0 x01 ,\ t m p ,% r0
ldi ( _ P A G E _ D I R T Y | _ P A G E _ R E A D | _ P A G E _ W R I T E ) ,\ p r o t
2012-05-21 10:49:01 +04:00
.ifc \ patype,2 0
2005-04-17 02:20:36 +04:00
depd,z \ p r o t ,8 ,7 ,\ p r o t
2012-05-21 10:49:01 +04:00
.else
.ifc \ patype,1 1
2012-05-15 14:04:19 +04:00
depw,z \ p r o t ,8 ,7 ,\ p r o t
2012-05-21 10:49:01 +04:00
.else
.error " undefined P A t y p e t o d o _ a l i a s "
.endif
.endif
2005-04-17 02:20:36 +04:00
/ *
* OK, i t i s i n t h e t e m p a l i a s r e g i o n , c h e c k w h e t h e r " f r o m " o r " t o " .
* Check " s u b t l e " n o t e i n p a c a c h e . S r e : r23 / r26 .
* /
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
extrd,u ,* = \ v a ,4 1 ,1 ,% r0
# else
extrw,u ,= \ v a ,9 ,1 ,% r0
# endif
or,C O N D ( t r ) % r23 ,% r0 ,\ p t e
or % r26 ,% r0 ,\ p t e
.endm
/ *
2015-11-20 12:50:01 +03:00
* Fault_ v e c t o r s a r e a r c h i t e c t u r a l l y r e q u i r e d t o b e a l i g n e d o n a 2 K
* boundary
2005-04-17 02:20:36 +04:00
* /
2016-04-29 23:07:31 +03:00
.section .text .hot
2015-11-20 12:50:01 +03:00
.align 2048
2005-04-17 02:20:36 +04:00
2007-01-23 22:50:59 +03:00
ENTRY( f a u l t _ v e c t o r _ 2 0 )
2005-04-17 02:20:36 +04:00
/* First vector is invalid (0) */
.ascii " cows c a n f l y "
.byte 0
.align 32
hpmc 1
def 2
def 3
extint 4
def 5
2018-08-16 23:39:50 +03:00
itlb_ 2 0 P A R I S C _ I T L B _ T R A P
2005-04-17 02:20:36 +04:00
def 7
def 8
def 9
def 1 0
def 1 1
def 1 2
def 1 3
def 1 4
dtlb_ 2 0 1 5
naitlb_ 2 0 1 6
nadtlb_ 2 0 1 7
def 1 8
def 1 9
dbit_ 2 0 2 0
def 2 1
def 2 2
def 2 3
def 2 4
def 2 5
def 2 6
def 2 7
def 2 8
def 2 9
def 3 0
def 3 1
2007-01-23 22:50:59 +03:00
END( f a u l t _ v e c t o r _ 2 0 )
2005-04-17 02:20:36 +04:00
2005-10-22 06:46:48 +04:00
# ifndef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
.align 2048
2007-01-23 22:50:59 +03:00
ENTRY( f a u l t _ v e c t o r _ 1 1 )
2005-04-17 02:20:36 +04:00
/* First vector is invalid (0) */
.ascii " cows c a n f l y "
.byte 0
.align 32
hpmc 1
def 2
def 3
extint 4
def 5
2018-08-16 23:39:50 +03:00
itlb_ 1 1 P A R I S C _ I T L B _ T R A P
2005-04-17 02:20:36 +04:00
def 7
def 8
def 9
def 1 0
def 1 1
def 1 2
def 1 3
def 1 4
dtlb_ 1 1 1 5
naitlb_ 1 1 1 6
nadtlb_ 1 1 1 7
def 1 8
def 1 9
dbit_ 1 1 2 0
def 2 1
def 2 2
def 2 3
def 2 4
def 2 5
def 2 6
def 2 7
def 2 8
def 2 9
def 3 0
def 3 1
2007-01-23 22:50:59 +03:00
END( f a u l t _ v e c t o r _ 1 1 )
2005-04-17 02:20:36 +04:00
# endif
2011-04-15 03:25:21 +04:00
/* Fault vector is separately protected and *must* be on its own page */
.align PAGE_SIZE
2005-04-17 02:20:36 +04:00
.import handle_ i n t e r r u p t i o n ,c o d e
.import do_ c p u _ i r q _ m a s k ,c o d e
/ *
* Child R e t u r n s h e r e
*
2012-10-04 07:28:08 +04:00
* copy_ t h r e a d m o v e d a r g s i n t o t a s k s a v e a r e a .
2005-04-17 02:20:36 +04:00
* /
2018-08-21 15:31:32 +03:00
ENTRY( r e t _ f r o m _ k e r n e l _ t h r e a d )
2005-04-17 02:20:36 +04:00
/* Call schedule_tail first though */
BL s c h e d u l e _ t a i l , % r2
nop
2012-10-06 02:55:57 +04:00
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) , % r1
2005-04-17 02:20:36 +04:00
LDREG T A S K _ P T _ G R 2 5 ( % r1 ) , % r26
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
LDREG T A S K _ P T _ G R 2 7 ( % r1 ) , % r27
# endif
LDREG T A S K _ P T _ G R 2 6 ( % r1 ) , % r1
ble 0 ( % s r7 , % r1 )
copy % r31 , % r2
2012-10-12 01:22:16 +04:00
b f i n i s h _ c h i l d _ r e t u r n
nop
2018-08-21 15:31:32 +03:00
END( r e t _ f r o m _ k e r n e l _ t h r e a d )
2005-04-17 02:20:36 +04:00
/ *
* struct t a s k _ s t r u c t * _ s w i t c h _ t o ( s t r u c t t a s k _ s t r u c t * p r e v ,
* struct t a s k _ s t r u c t * n e x t )
*
* switch k e r n e l s t a c k s a n d r e t u r n p r e v * /
2016-10-05 23:28:46 +03:00
ENTRY_ C F I ( _ s w i t c h _ t o )
2005-04-17 02:20:36 +04:00
STREG % r2 , - R P _ O F F S E T ( % r30 )
2005-10-22 06:53:26 +04:00
callee_ s a v e _ f l o a t
2005-04-17 02:20:36 +04:00
callee_ s a v e
load3 2 _ s w i t c h _ t o _ r e t , % r2
STREG % r2 , T A S K _ P T _ K P C ( % r26 )
LDREG T A S K _ P T _ K P C ( % r25 ) , % r2
STREG % r30 , T A S K _ P T _ K S P ( % r26 )
LDREG T A S K _ P T _ K S P ( % r25 ) , % r30
LDREG T A S K _ T H R E A D _ I N F O ( % r25 ) , % r25
bv % r0 ( % r2 )
mtctl % r25 ,% c r30
2018-08-21 15:31:32 +03:00
ENTRY( _ s w i t c h _ t o _ r e t )
2005-04-17 02:20:36 +04:00
mtctl % r0 , % c r0 / * N e e d e d f o r s i n g l e s t e p p i n g * /
callee_ r e s t
2005-10-22 06:53:26 +04:00
callee_ r e s t _ f l o a t
2005-04-17 02:20:36 +04:00
LDREG - R P _ O F F S E T ( % r30 ) , % r2
bv % r0 ( % r2 )
copy % r26 , % r28
2018-08-21 15:31:32 +03:00
ENDPROC_ C F I ( _ s w i t c h _ t o )
2005-04-17 02:20:36 +04:00
/ *
* Common r f i r e t u r n p a t h f o r i n t e r r u p t i o n s , k e r n e l e x e c v e , a n d
* sys_ r t _ s i g r e t u r n ( s o m e t i m e s ) . T h e s y s _ r t _ s i g r e t u r n s y s c a l l w i l l
* return v i a t h i s p a t h i f t h e s i g n a l w a s r e c e i v e d w h e n t h e p r o c e s s
* was r u n n i n g ; if the process was blocked on a syscall then the
* normal s y s c a l l _ e x i t p a t h i s u s e d . A l l s y s c a l l s f o r t r a c e d
* proceses e x i t v i a i n t r _ r e s t o r e .
*
* XXX I f a n y s y s c a l l s t h a t c h a n g e a p r o c e s s e s s p a c e i d e v e r e x i t
* this w a y , t h e n w e w i l l n e e d t o c o p y % s r3 i n t o P T _ S R [ 3 . . 7 ] , a n d
* adjust I A S Q [ 0 . . 1 ] .
*
* /
2007-10-18 11:04:53 +04:00
.align PAGE_SIZE
2005-04-17 02:20:36 +04:00
2016-10-05 23:28:46 +03:00
ENTRY_ C F I ( s y s c a l l _ e x i t _ r f i )
2005-04-17 02:20:36 +04:00
mfctl % c r30 ,% r16
LDREG T I _ T A S K ( % r16 ) , % r16 / * t h r e a d _ i n f o - > t a s k _ s t r u c t * /
ldo T A S K _ R E G S ( % r16 ) ,% r16
/ * Force i a o q t o u s e r s p a c e , a s t h e u s e r h a s h a d a c c e s s t o o u r c u r r e n t
* context v i a s i g c o n t e x t . A l s o F i l t e r t h e P S W f o r t h e s a m e r e a s o n .
* /
LDREG P T _ I A O Q 0 ( % r16 ) ,% r19
depi 3 ,3 1 ,2 ,% r19
STREG % r19 ,P T _ I A O Q 0 ( % r16 )
LDREG P T _ I A O Q 1 ( % r16 ) ,% r19
depi 3 ,3 1 ,2 ,% r19
STREG % r19 ,P T _ I A O Q 1 ( % r16 )
LDREG P T _ P S W ( % r16 ) ,% r19
load3 2 U S E R _ P S W _ M A S K ,% r1
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
load3 2 U S E R _ P S W _ H I _ M A S K ,% r20
depd % r20 ,3 1 ,3 2 ,% r1
# endif
and % r19 ,% r1 ,% r19 / * M a s k o u t b i t s t h a t u s e r s h o u l d n ' t p l a y w i t h * /
load3 2 U S E R _ P S W ,% r1
or % r19 ,% r1 ,% r19 / * M a k e s u r e d e f a u l t U S E R _ P S W b i t s a r e s e t * /
STREG % r19 ,P T _ P S W ( % r16 )
/ *
* If w e a r e n ' t b e i n g t r a c e d , w e n e v e r s a v e d s p a c e r e g i s t e r s
* ( we d o n ' t s t o r e t h e m i n t h e s i g c o n t e x t ) , s o s e t t h e m
* to " p r o p e r " v a l u e s n o w ( o t h e r w i s e w e ' l l w i n d u p r e s t o r i n g
* whatever w a s l a s t s t o r e d i n t h e t a s k s t r u c t u r e , w h i c h m i g h t
2011-03-31 05:57:33 +04:00
* be i n c o n s i s t e n t i f a n i n t e r r u p t o c c u r r e d w h i l e o n t h e g a t e w a y
2006-10-04 00:21:02 +04:00
* page) . N o t e t h a t w e m a y b e " t r a s h i n g " v a l u e s t h e u s e r p u t i n
* them, b u t w e d o n ' t s u p p o r t t h e u s e r c h a n g i n g t h e m .
2005-04-17 02:20:36 +04:00
* /
STREG % r0 ,P T _ S R 2 ( % r16 )
mfsp % s r3 ,% r19
STREG % r19 ,P T _ S R 0 ( % r16 )
STREG % r19 ,P T _ S R 1 ( % r16 )
STREG % r19 ,P T _ S R 3 ( % r16 )
STREG % r19 ,P T _ S R 4 ( % r16 )
STREG % r19 ,P T _ S R 5 ( % r16 )
STREG % r19 ,P T _ S R 6 ( % r16 )
STREG % r19 ,P T _ S R 7 ( % r16 )
2018-08-21 15:31:32 +03:00
ENTRY( i n t r _ r e t u r n )
2005-04-17 02:20:36 +04:00
/* check for reschedule */
mfctl % c r30 ,% r1
LDREG T I _ F L A G S ( % r1 ) ,% r19 / * s c h e d . h : T I F _ N E E D _ R E S C H E D * /
bb,< ,n % r19 ,3 1 - T I F _ N E E D _ R E S C H E D ,i n t r _ d o _ r e s c h e d / * f o r w a r d * /
2007-01-09 00:28:06 +03:00
.import do_ n o t i f y _ r e s u m e ,c o d e
2005-04-17 02:20:36 +04:00
intr_check_sig :
/* As above */
mfctl % c r30 ,% r1
2007-01-09 00:28:06 +03:00
LDREG T I _ F L A G S ( % r1 ) ,% r19
2020-10-30 00:01:06 +03:00
ldi ( _ T I F _ U S E R _ W O R K _ M A S K & ~ _ T I F _ N E E D _ R E S C H E D ) , % r20
2007-01-09 00:28:06 +03:00
and,C O N D ( < > ) % r19 , % r20 , % r0
b,n i n t r _ r e s t o r e / * s k i p p a s t i f w e ' v e n o t h i n g t o d o * /
/ * This c h e c k i s c r i t i c a l t o h a v i n g L W S
* working. T h e I A S Q i s z e r o o n t h e g a t e w a y
* page a n d w e c a n n o t d e l i v e r a n y s i g n a l s u n t i l
* we g e t o f f t h e g a t e w a y p a g e .
*
* Only d o s i g n a l s i f w e a r e r e t u r n i n g t o u s e r s p a c e
* /
LDREG P T _ I A S Q 0 ( % r16 ) , % r20
2020-10-02 21:03:27 +03:00
cmpib,C O N D ( = ) ,n L I N U X _ G A T E W A Y _ S P A C E , % r20 , i n t r _ r e s t o r e / * f o r w a r d * /
2007-01-09 00:28:06 +03:00
LDREG P T _ I A S Q 1 ( % r16 ) , % r20
2020-10-02 21:03:27 +03:00
cmpib,C O N D ( = ) ,n L I N U X _ G A T E W A Y _ S P A C E , % r20 , i n t r _ r e s t o r e / * f o r w a r d * /
2017-11-14 03:35:33 +03:00
2007-01-09 00:28:06 +03:00
copy % r0 , % r25 / * l o n g i n _ s y s c a l l = 0 * /
# ifdef C O N F I G _ 6 4 B I T
ldo - 1 6 ( % r30 ) ,% r29 / * R e f e r e n c e p a r a m s a v e a r e a * /
# endif
2020-10-02 21:03:27 +03:00
/ * NOTE : We n e e d t o e n a b l e i n t e r r u p t s i f w e h a v e t o d e l i v e r
* signals. W e u s e d t o d o t h i s e a r l i e r b u t i t c a u s e d k e r n e l
* stack o v e r f l o w s . * /
ssm P S W _ S M _ I , % r0
2007-01-09 00:28:06 +03:00
BL d o _ n o t i f y _ r e s u m e ,% r2
copy % r16 , % r26 / * s t r u c t p t _ r e g s * r e g s * /
2007-01-09 21:57:38 +03:00
b,n i n t r _ c h e c k _ s i g
2005-04-17 02:20:36 +04:00
intr_restore :
copy % r16 ,% r29
ldo P T _ F R 3 1 ( % r29 ) ,% r1
rest_ f p % r1
rest_ g e n e r a l % r29
2005-10-22 06:40:07 +04:00
/* inverse of virt_map */
pcxt_ s s m _ b u g
rsm P S W _ S M _ Q U I E T ,% r0 / * p r e p a r e f o r r f i * /
2005-04-17 02:20:36 +04:00
tophys_ r1 % r29
/ * Restore s p a c e i d ' s a n d s p e c i a l c r ' s f r o m P T _ R E G S
2005-10-22 06:40:07 +04:00
* structure p o i n t e d t o b y r29
* /
2005-04-17 02:20:36 +04:00
rest_ s p e c i a l s % r29
2005-10-22 06:40:07 +04:00
/ * IMPORTANT : rest_ s t a c k r e s t o r e s r29 l a s t ( w e a r e u s i n g i t ) !
* It a l s o r e s t o r e s r1 a n d r30 .
* /
2005-04-17 02:20:36 +04:00
rest_ s t a c k
rfi
nop
2019-10-15 22:18:02 +03:00
# ifndef C O N F I G _ P R E E M P T I O N
2006-03-25 07:24:21 +03:00
# define i n t r _ d o _ p r e e m p t i n t r _ r e s t o r e
2019-10-15 22:18:02 +03:00
# endif / * ! C O N F I G _ P R E E M P T I O N * /
2006-03-25 07:24:21 +03:00
2005-04-17 02:20:36 +04:00
.import schedule,c o d e
intr_do_resched :
2006-03-25 07:24:21 +03:00
/ * Only c a l l s c h e d u l e o n r e t u r n t o u s e r s p a c e . I f w e ' r e r e t u r n i n g
2019-10-15 22:18:02 +03:00
* to k e r n e l s p a c e , w e m a y s c h e d u l e i f C O N F I G _ P R E E M P T I O N , o t h e r w i s e
2006-03-25 07:24:21 +03:00
* we j u m p b a c k t o i n t r _ r e s t o r e .
* /
2005-04-17 02:20:36 +04:00
LDREG P T _ I A S Q 0 ( % r16 ) , % r20
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( = ) 0 , % r20 , i n t r _ d o _ p r e e m p t
2005-04-17 02:20:36 +04:00
nop
LDREG P T _ I A S Q 1 ( % r16 ) , % r20
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( = ) 0 , % r20 , i n t r _ d o _ p r e e m p t
2005-04-17 02:20:36 +04:00
nop
2017-11-14 03:35:33 +03:00
/ * NOTE : We n e e d t o e n a b l e i n t e r r u p t s i f w e s c h e d u l e . W e u s e d
* to d o t h i s e a r l i e r b u t i t c a u s e d k e r n e l s t a c k o v e r f l o w s . * /
ssm P S W _ S M _ I , % r0
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
ldo - 1 6 ( % r30 ) ,% r29 / * R e f e r e n c e p a r a m s a v e a r e a * /
# endif
ldil L % i n t r _ c h e c k _ s i g , % r2
2005-10-22 06:42:57 +04:00
# ifndef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
b s c h e d u l e
2005-10-22 06:42:57 +04:00
# else
load3 2 s c h e d u l e , % r20
bv % r0 ( % r20 )
# endif
2005-04-17 02:20:36 +04:00
ldo R % i n t r _ c h e c k _ s i g ( % r2 ) , % r2
2006-03-25 07:24:21 +03:00
/ * preempt t h e c u r r e n t t a s k o n r e t u r n i n g t o k e r n e l
* mode f r o m a n i n t e r r u p t , i f f n e e d _ r e s c h e d i s s e t ,
* and p r e e m p t _ c o u n t i s 0 . o t h e r w i s e , w e c o n t i n u e o n
* our m e r r y w a y b a c k t o t h e c u r r e n t r u n n i n g t a s k .
* /
2019-10-15 22:18:02 +03:00
# ifdef C O N F I G _ P R E E M P T I O N
2006-03-25 07:24:21 +03:00
.import preempt_ s c h e d u l e _ i r q ,c o d e
intr_do_preempt :
rsm P S W _ S M _ I , % r0 / * d i s a b l e i n t e r r u p t s * /
/* current_thread_info()->preempt_count */
mfctl % c r30 , % r1
LDREG T I _ P R E _ C O U N T ( % r1 ) , % r19
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( < > ) 0 , % r19 , i n t r _ r e s t o r e / * i f p r e e m p t _ c o u n t > 0 * /
2006-03-25 07:24:21 +03:00
nop / * p r e v i n s n b r a n c h e d b a c k w a r d s * /
/* check if we interrupted a critical path */
LDREG P T _ P S W ( % r16 ) , % r20
bb,< ,n % r20 , 3 1 - P S W _ S M _ I , i n t r _ r e s t o r e
nop
2021-01-26 22:16:21 +03:00
/* ssm PSW_SM_I done later in intr_restore */
# ifdef C O N F I G _ M L O N G C A L L S
ldil L % i n t r _ r e s t o r e , % r2
load3 2 p r e e m p t _ s c h e d u l e _ i r q , % r1
bv % r0 ( % r1 )
ldo R % i n t r _ r e s t o r e ( % r2 ) , % r2
# else
ldil L % i n t r _ r e s t o r e , % r1
2006-03-25 07:24:21 +03:00
BL p r e e m p t _ s c h e d u l e _ i r q , % r2
2021-01-26 22:16:21 +03:00
ldo R % i n t r _ r e s t o r e ( % r1 ) , % r2
# endif
2019-10-15 22:18:02 +03:00
# endif / * C O N F I G _ P R E E M P T I O N * /
2005-04-17 02:20:36 +04:00
/ *
* External i n t e r r u p t s .
* /
intr_extint :
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( = ) ,n 0 ,% r16 ,1 f
2007-10-18 11:04:56 +04:00
2005-04-17 02:20:36 +04:00
get_ s t a c k _ u s e _ c r30
2007-10-18 11:04:56 +04:00
b,n 2 f
2005-04-17 02:20:36 +04:00
1 :
get_ s t a c k _ u s e _ r30
2007-10-18 11:04:56 +04:00
2 :
2005-04-17 02:20:36 +04:00
save_ s p e c i a l s % r29
virt_ m a p
save_ g e n e r a l % r29
ldo P T _ F R 0 ( % r29 ) , % r24
save_ f p % r24
loadgp
copy % r29 , % r26 / * a r g 0 i s p t _ r e g s * /
copy % r29 , % r16 / * s a v e p t _ r e g s * /
ldil L % i n t r _ r e t u r n , % r2
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
ldo - 1 6 ( % r30 ) ,% r29 / * R e f e r e n c e p a r a m s a v e a r e a * /
# endif
b d o _ c p u _ i r q _ m a s k
ldo R % i n t r _ r e t u r n ( % r2 ) , % r2 / * r e t u r n t o i n t r _ r e t u r n , n o t h e r e * /
2018-08-21 15:31:32 +03:00
ENDPROC_ C F I ( s y s c a l l _ e x i t _ r f i )
2005-04-17 02:20:36 +04:00
/* Generic interruptions (illegal insn, unaligned, page fault, etc) */
2016-10-05 23:28:46 +03:00
ENTRY_ C F I ( i n t r _ s a v e ) / * f o r o s _ h p m c * /
2005-04-17 02:20:36 +04:00
mfsp % s r7 ,% r16
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( = ) ,n 0 ,% r16 ,1 f
2005-04-17 02:20:36 +04:00
get_ s t a c k _ u s e _ c r30
b 2 f
copy % r8 ,% r26
1 :
get_ s t a c k _ u s e _ r30
copy % r8 ,% r26
2 :
save_ s p e c i a l s % r29
/* If this trap is a itlb miss, skip saving/adjusting isr/ior */
2018-08-16 23:39:50 +03:00
cmpib,C O N D ( = ) ,n P A R I S C _ I T L B _ T R A P ,% r26 ,s k i p _ s a v e _ i o r
2005-04-17 02:20:36 +04:00
2018-08-16 23:39:50 +03:00
mfctl % i s r , % r16
2005-10-22 06:40:07 +04:00
nop / * s e r i a l i z e m f c t l o n P A 2 . 0 t o a v o i d 4 c y c l e p e n a l t y * /
2018-08-16 23:39:50 +03:00
mfctl % i o r , % r17
2005-04-17 02:20:36 +04:00
2005-10-22 06:40:07 +04:00
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
/ *
* If t h e i n t e r r u p t e d c o d e w a s r u n n i n g w i t h W b i t o f f ( 3 2 b i t ) ,
* clear t h e b b i t s ( b i t s 0 & 1 ) i n t h e i o r .
2005-10-22 06:40:07 +04:00
* save_ s p e c i a l s l e f t i p s w v a l u e i n r8 f o r u s t o t e s t .
2005-04-17 02:20:36 +04:00
* /
extrd,u ,* < > % r8 ,P S W _ W _ B I T ,1 ,% r0
depdi 0 ,1 ,2 ,% r17
2018-08-16 23:39:50 +03:00
/* adjust isr/ior: get high bits from isr and deposit in ior */
space_ a d j u s t % r16 ,% r17 ,% r1
2005-04-17 02:20:36 +04:00
# endif
STREG % r16 , P T _ I S R ( % r29 )
STREG % r17 , P T _ I O R ( % r29 )
2018-08-16 23:39:50 +03:00
# if 0 & & d e f i n e d ( C O N F I G _ 6 4 B I T )
/* Revisit when we have 64-bit code above 4Gb */
b,n i n t r _ s a v e 2
2005-04-17 02:20:36 +04:00
skip_save_ior :
2018-08-16 23:39:50 +03:00
/ * We h a v e a i t l b m i s s , a n d w h e n e x e c u t i n g c o d e a b o v e 4 G b o n I L P 6 4 , w e
* need t o a d j u s t i a s q / i a o q h e r e i n t h e s a m e w a y w e a d j u s t e d i s r / i o r
* above.
* /
extrd,u ,* % r8 ,P S W _ W _ B I T ,1 ,% r1
cmpib,C O N D ( = ) ,n 1 ,% r1 ,i n t r _ s a v e 2
LDREG P T _ I A S Q 0 ( % r29 ) , % r16
LDREG P T _ I A O Q 0 ( % r29 ) , % r17
/* adjust iasq/iaoq */
space_ a d j u s t % r16 ,% r17 ,% r1
STREG % r16 , P T _ I A S Q 0 ( % r29 )
STREG % r17 , P T _ I A O Q 0 ( % r29 )
# else
skip_save_ior :
# endif
intr_save2 :
2005-04-17 02:20:36 +04:00
virt_ m a p
save_ g e n e r a l % r29
ldo P T _ F R 0 ( % r29 ) , % r25
save_ f p % r25
loadgp
copy % r29 , % r25 / * a r g 1 i s p t _ r e g s * /
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
ldo - 1 6 ( % r30 ) ,% r29 / * R e f e r e n c e p a r a m s a v e a r e a * /
# endif
ldil L % i n t r _ c h e c k _ s i g , % r2
copy % r25 , % r16 / * s a v e p t _ r e g s * /
b h a n d l e _ i n t e r r u p t i o n
ldo R % i n t r _ c h e c k _ s i g ( % r2 ) , % r2
2016-10-05 23:28:46 +03:00
ENDPROC_ C F I ( i n t r _ s a v e )
2005-04-17 02:20:36 +04:00
/ *
* Note f o r a l l t l b m i s s h a n d l e r s :
*
* cr2 4 c o n t a i n s a p o i n t e r t o t h e k e r n e l a d d r e s s s p a c e
* page d i r e c t o r y .
*
* cr2 5 c o n t a i n s a p o i n t e r t o t h e c u r r e n t u s e r a d d r e s s
* space p a g e d i r e c t o r y .
*
* sr3 w i l l c o n t a i n t h e s p a c e i d o f t h e u s e r a d d r e s s s p a c e
* of t h e c u r r e n t r u n n i n g t h r e a d w h i l e t h a t t h r e a d i s
* running i n t h e k e r n e l .
* /
/ *
* register n u m b e r a l l o c a t i o n s . N o t e t h a t t h e s e a r e a l l
* in t h e s h a d o w e d r e g i s t e r s
* /
t0 = r1 / * t e m p o r a r y r e g i s t e r 0 * /
2011-03-31 05:57:33 +04:00
va = r8 / * v i r t u a l a d d r e s s f o r w h i c h t h e t r a p o c c u r r e d * /
2005-04-17 02:20:36 +04:00
t1 = r9 / * t e m p o r a r y r e g i s t e r 1 * /
pte = r16 / * p t e / p h y s p a g e # * /
prot = r17 / * p r o t b i t s * /
2011-03-31 05:57:33 +04:00
spc = r24 / * s p a c e f o r w h i c h t h e t r a p o c c u r r e d * /
2005-04-17 02:20:36 +04:00
ptp = r25 / * p a g e d i r e c t o r y / p a g e t a b l e p o i n t e r * /
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
dtlb_miss_20w :
space_ a d j u s t s p c ,v a ,t 0
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,d t l b _ f a u l t
L3 _ p t e p p t p ,p t e ,t 0 ,v a ,d t l b _ c h e c k _ a l i a s _ 2 0 w
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,d t l b _ c h e c k _ a l i a s _ 2 0 w
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
idtlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
dtlb_check_alias_20w :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,d t l b _ f a u l t ,2 0
2005-04-17 02:20:36 +04:00
idtlbt p t e ,p r o t
rfir
nop
nadtlb_miss_20w :
space_ a d j u s t s p c ,v a ,t 0
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,n a d t l b _ f a u l t
2010-12-22 19:22:11 +03:00
L3 _ p t e p p t p ,p t e ,t 0 ,v a ,n a d t l b _ c h e c k _ a l i a s _ 2 0 w
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,n a d t l b _ c h e c k _ a l i a s _ 2 0 w
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
idtlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
2010-12-22 19:22:11 +03:00
nadtlb_check_alias_20w :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,n a d t l b _ e m u l a t e ,2 0
2005-04-17 02:20:36 +04:00
idtlbt p t e ,p r o t
rfir
nop
# else
dtlb_miss_11 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,d t l b _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,d t l b _ c h e c k _ a l i a s _ 1 1
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,d t l b _ c h e c k _ a l i a s _ 1 1
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
make_ i n s e r t _ t l b _ 1 1 s p c ,p t e ,p r o t
2015-07-02 00:18:37 +03:00
mfsp % s r1 ,t 1 / * S a v e s r1 s o w e c a n u s e i t i n t l b i n s e r t s * /
2005-04-17 02:20:36 +04:00
mtsp s p c ,% s r1
idtlba p t e ,( % s r1 ,v a )
idtlbp p r o t ,( % s r1 ,v a )
2015-07-02 00:18:37 +03:00
mtsp t 1 , % s r1 / * R e s t o r e s r1 * /
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
dtlb_check_alias_11 :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,d t l b _ f a u l t ,1 1
2005-04-17 02:20:36 +04:00
idtlba p t e ,( v a )
idtlbp p r o t ,( v a )
rfir
nop
nadtlb_miss_11 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,n a d t l b _ f a u l t
2010-12-22 19:22:11 +03:00
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,n a d t l b _ c h e c k _ a l i a s _ 1 1
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,n a d t l b _ c h e c k _ a l i a s _ 1 1
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
make_ i n s e r t _ t l b _ 1 1 s p c ,p t e ,p r o t
2015-07-02 00:18:37 +03:00
mfsp % s r1 ,t 1 / * S a v e s r1 s o w e c a n u s e i t i n t l b i n s e r t s * /
2005-04-17 02:20:36 +04:00
mtsp s p c ,% s r1
idtlba p t e ,( % s r1 ,v a )
idtlbp p r o t ,( % s r1 ,v a )
2015-07-02 00:18:37 +03:00
mtsp t 1 , % s r1 / * R e s t o r e s r1 * /
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
2010-12-22 19:22:11 +03:00
nadtlb_check_alias_11 :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,n a d t l b _ e m u l a t e ,1 1
2010-12-22 19:22:11 +03:00
idtlba p t e ,( v a )
idtlbp p r o t ,( v a )
rfir
nop
2005-04-17 02:20:36 +04:00
dtlb_miss_20 :
space_ a d j u s t s p c ,v a ,t 0
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,d t l b _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,d t l b _ c h e c k _ a l i a s _ 2 0
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,d t l b _ c h e c k _ a l i a s _ 2 0
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
2015-07-02 00:18:37 +03:00
f_ e x t e n d p t e ,t 1
2005-04-17 02:20:36 +04:00
idtlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
dtlb_check_alias_20 :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,d t l b _ f a u l t ,2 0
2005-04-17 02:20:36 +04:00
idtlbt p t e ,p r o t
rfir
nop
nadtlb_miss_20 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,n a d t l b _ f a u l t
2010-12-22 19:22:11 +03:00
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,n a d t l b _ c h e c k _ a l i a s _ 2 0
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,n a d t l b _ c h e c k _ a l i a s _ 2 0
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
2015-07-02 00:18:37 +03:00
f_ e x t e n d p t e ,t 1
2005-04-17 02:20:36 +04:00
2015-07-02 00:18:37 +03:00
idtlbt p t e ,p r o t
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
2010-12-22 19:22:11 +03:00
nadtlb_check_alias_20 :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,n a d t l b _ e m u l a t e ,2 0
2010-12-22 19:22:11 +03:00
idtlbt p t e ,p r o t
rfir
nop
2005-04-17 02:20:36 +04:00
# endif
nadtlb_emulate :
/ *
* Non a c c e s s m i s s e s c a n b e c a u s e d b y f d c ,f i c ,p d c ,l p a ,p r o b e a n d
* probei i n s t r u c t i o n s . W e d o n ' t w a n t t o f a u l t f o r t h e s e
* instructions ( n o t o n l y d o e s i t n o t m a k e s e n s e , i t c a n c a u s e
* deadlocks, s i n c e s o m e f l u s h e s a r e d o n e w i t h t h e m m a p
* semaphore h e l d ) . I f t h e t r a n s l a t i o n d o e s n ' t e x i s t , w e c a n ' t
* insert a t r a n s l a t i o n , s o h a v e t o e m u l a t e t h e s i d e e f f e c t s
* of t h e i n s t r u c t i o n . S i n c e w e d o n ' t i n s e r t a t r a n s l a t i o n
* we c a n g e t a l o t o f f a u l t s d u r i n g a f l u s h l o o p , s o i t m a k e s
* sense t o t r y t o d o i t h e r e w i t h m i n i m u m o v e r h e a d . W e o n l y
* emulate f d c ,f i c ,p d c ,p r o b e w ,p r o b e r i n s t r u c t i o n s w h o s e b a s e
* and i n d e x r e g i s t e r s a r e n o t s h a d o w e d . W e d e f e r e v e r y t h i n g
* else t o t h e " s l o w " p a t h .
* /
mfctl % c r19 ,% r9 / * G e t i i r * /
/ * PA 2 . 0 A r c h R e f . B o o k p g 3 8 2 h a s a g o o d d e s c r i p t i o n o f t h e i n s n b i t s .
Checks f o r f d c ,f d c e ,p d c ," f i c ,4 f " ,p r o b e r ,p r o b e i r ,p r o b e w , p r o b e i w * /
/* Checks for fdc,fdce,pdc,"fic,4f" only */
ldi 0 x28 0 ,% r16
and % r9 ,% r16 ,% r17
cmpb,< > ,n % r16 ,% r17 ,n a d t l b _ p r o b e _ c h e c k
bb,> = ,n % r9 ,2 6 ,n a d t l b _ n u l l i f y / * m b i t n o t s e t , j u s t n u l l i f y * /
BL g e t _ r e g i s t e r ,% r25
extrw,u % r9 ,1 5 ,5 ,% r8 / * G e t i n d e x r e g i s t e r # * /
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( = ) ,n - 1 ,% r1 ,n a d t l b _ f a u l t / * h a v e t o u s e s l o w p a t h * /
2005-04-17 02:20:36 +04:00
copy % r1 ,% r24
BL g e t _ r e g i s t e r ,% r25
extrw,u % r9 ,1 0 ,5 ,% r8 / * G e t b a s e r e g i s t e r # * /
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( = ) ,n - 1 ,% r1 ,n a d t l b _ f a u l t / * h a v e t o u s e s l o w p a t h * /
2005-04-17 02:20:36 +04:00
BL s e t _ r e g i s t e r ,% r25
add,l % r1 ,% r24 ,% r1 / * d o e s n ' t a f f e c t c / b b i t s * /
nadtlb_nullify :
2005-10-22 06:40:07 +04:00
mfctl % i p s w ,% r8
2005-04-17 02:20:36 +04:00
ldil L % P S W _ N ,% r9
or % r8 ,% r9 ,% r8 / * S e t P S W _ N * /
2005-10-22 06:40:07 +04:00
mtctl % r8 ,% i p s w
2005-04-17 02:20:36 +04:00
rfir
nop
/ *
When t h e r e i s n o t r a n s l a t i o n f o r t h e p r o b e a d d r e s s t h e n w e
2017-05-09 01:57:50 +03:00
must n u l l i f y t h e i n s n a n d r e t u r n z e r o i n t h e t a r g e t r e g i s t e r .
2005-04-17 02:20:36 +04:00
This w i l l i n d i c a t e t o t h e c a l l i n g c o d e t h a t i t d o e s n o t h a v e
write/ r e a d p r i v i l e g e s t o t h i s a d d r e s s .
This s h o u l d t e c h n i c a l l y w o r k f o r p r o b e r a n d p r o b e w i n P A 1 . 1 ,
and a l s o p r o b e ,r a n d p r o b e ,w i n P A 2 . 0
WARNING : USE O N L Y N O N - S H A D O W R E G I S T E R S W I T H P R O B E I N S N !
THE S L O W - P A T H E M U L A T I O N H A S N O T B E E N W R I T T E N Y E T .
* /
nadtlb_probe_check :
ldi 0 x80 ,% r16
and % r9 ,% r16 ,% r17
cmpb,< > ,n % r16 ,% r17 ,n a d t l b _ f a u l t / * M u s t b e p r o b e ,[ r w ] * /
BL g e t _ r e g i s t e r ,% r25 / * F i n d t h e t a r g e t r e g i s t e r * /
extrw,u % r9 ,3 1 ,5 ,% r8 / * G e t t a r g e t r e g i s t e r * /
2008-05-15 18:53:57 +04:00
cmpib,C O N D ( = ) ,n - 1 ,% r1 ,n a d t l b _ f a u l t / * h a v e t o u s e s l o w p a t h * /
2005-04-17 02:20:36 +04:00
BL s e t _ r e g i s t e r ,% r25
copy % r0 ,% r1 / * W r i t e z e r o t o t a r g e t r e g i s t e r * /
b n a d t l b _ n u l l i f y / * N u l l i f y r e t u r n i n s n * /
nop
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
itlb_miss_20w :
/ *
* I m i s s i s a l i t t l e d i f f e r e n t , s i n c e w e a l l o w u s e r s t o f a u l t
* on t h e g a t e w a y p a g e w h i c h i s i n t h e k e r n e l a d d r e s s s p a c e .
* /
space_ a d j u s t s p c ,v a ,t 0
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,i t l b _ f a u l t
L3 _ p t e p p t p ,p t e ,t 0 ,v a ,i t l b _ f a u l t
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,i t l b _ f a u l t
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
iitlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
2010-12-22 19:22:11 +03:00
naitlb_miss_20w :
/ *
* I m i s s i s a l i t t l e d i f f e r e n t , s i n c e w e a l l o w u s e r s t o f a u l t
* on t h e g a t e w a y p a g e w h i c h i s i n t h e k e r n e l a d d r e s s s p a c e .
* /
space_ a d j u s t s p c ,v a ,t 0
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,n a i t l b _ f a u l t
L3 _ p t e p p t p ,p t e ,t 0 ,v a ,n a i t l b _ c h e c k _ a l i a s _ 2 0 w
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,n a i t l b _ c h e c k _ a l i a s _ 2 0 w
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2010-12-22 19:22:11 +03:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2010-12-22 19:22:11 +03:00
iitlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2010-12-22 19:22:11 +03:00
rfir
nop
naitlb_check_alias_20w :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,n a i t l b _ f a u l t ,2 0
2010-12-22 19:22:11 +03:00
iitlbt p t e ,p r o t
rfir
nop
2005-04-17 02:20:36 +04:00
# else
itlb_miss_11 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,i t l b _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,i t l b _ f a u l t
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,i t l b _ f a u l t
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
make_ i n s e r t _ t l b _ 1 1 s p c ,p t e ,p r o t
2015-07-02 00:18:37 +03:00
mfsp % s r1 ,t 1 / * S a v e s r1 s o w e c a n u s e i t i n t l b i n s e r t s * /
2005-04-17 02:20:36 +04:00
mtsp s p c ,% s r1
iitlba p t e ,( % s r1 ,v a )
iitlbp p r o t ,( % s r1 ,v a )
2015-07-02 00:18:37 +03:00
mtsp t 1 , % s r1 / * R e s t o r e s r1 * /
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
2010-12-22 19:22:11 +03:00
naitlb_miss_11 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,n a i t l b _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,n a i t l b _ c h e c k _ a l i a s _ 1 1
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,n a i t l b _ c h e c k _ a l i a s _ 1 1
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2010-12-22 19:22:11 +03:00
make_ i n s e r t _ t l b _ 1 1 s p c ,p t e ,p r o t
2015-07-02 00:18:37 +03:00
mfsp % s r1 ,t 1 / * S a v e s r1 s o w e c a n u s e i t i n t l b i n s e r t s * /
2010-12-22 19:22:11 +03:00
mtsp s p c ,% s r1
iitlba p t e ,( % s r1 ,v a )
iitlbp p r o t ,( % s r1 ,v a )
2015-07-02 00:18:37 +03:00
mtsp t 1 , % s r1 / * R e s t o r e s r1 * /
2010-12-22 19:22:11 +03:00
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2010-12-22 19:22:11 +03:00
rfir
nop
naitlb_check_alias_11 :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,i t l b _ f a u l t ,1 1
2010-12-22 19:22:11 +03:00
iitlba p t e ,( % s r0 , v a )
iitlbp p r o t ,( % s r0 , v a )
rfir
nop
2005-04-17 02:20:36 +04:00
itlb_miss_20 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,i t l b _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,i t l b _ f a u l t
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,i t l b _ f a u l t
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
2015-07-02 00:18:37 +03:00
f_ e x t e n d p t e ,t 1
2005-04-17 02:20:36 +04:00
iitlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
2010-12-22 19:22:11 +03:00
naitlb_miss_20 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,n a i t l b _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,n a i t l b _ c h e c k _ a l i a s _ 2 0
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,n a i t l b _ c h e c k _ a l i a s _ 2 0
2015-07-02 00:18:37 +03:00
update_ a c c e s s e d p t p ,p t e ,t 0 ,t 1
2010-12-22 19:22:11 +03:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2010-12-22 19:22:11 +03:00
2015-07-02 00:18:37 +03:00
f_ e x t e n d p t e ,t 1
2010-12-22 19:22:11 +03:00
iitlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 1 s p c ,t 0
2010-12-22 19:22:11 +03:00
rfir
nop
naitlb_check_alias_20 :
2012-05-21 10:49:01 +04:00
do_ a l i a s s p c ,t 0 ,t 1 ,v a ,p t e ,p r o t ,n a i t l b _ f a u l t ,2 0
2010-12-22 19:22:11 +03:00
iitlbt p t e ,p r o t
rfir
nop
2005-04-17 02:20:36 +04:00
# endif
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
dbit_trap_20w :
space_ a d j u s t s p c ,v a ,t 0
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,d b i t _ f a u l t
L3 _ p t e p p t p ,p t e ,t 0 ,v a ,d b i t _ f a u l t
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,d b i t _ f a u l t
2015-07-02 00:18:37 +03:00
update_ d i r t y p t p ,p t e ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
idtlbt p t e ,p r o t
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 0 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
# else
dbit_trap_11 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,d b i t _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,d b i t _ f a u l t
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,d b i t _ f a u l t
2015-07-02 00:18:37 +03:00
update_ d i r t y p t p ,p t e ,t 1
2005-04-17 02:20:36 +04:00
make_ i n s e r t _ t l b _ 1 1 s p c ,p t e ,p r o t
mfsp % s r1 ,t 1 / * S a v e s r1 s o w e c a n u s e i t i n t l b i n s e r t s * /
mtsp s p c ,% s r1
idtlba p t e ,( % s r1 ,v a )
idtlbp p r o t ,( % s r1 ,v a )
mtsp t 1 , % s r1 / * R e s t o r e s r1 * /
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 0 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
dbit_trap_20 :
get_ p g d s p c ,p t p
space_ c h e c k s p c ,t 0 ,d b i t _ f a u l t
L2 _ p t e p p t p ,p t e ,t 0 ,v a ,d b i t _ f a u l t
2021-02-12 18:38:52 +03:00
ptl_ l o c k s p c ,p t p ,p t e ,t 0 ,t 1 ,d b i t _ f a u l t
2015-07-02 00:18:37 +03:00
update_ d i r t y p t p ,p t e ,t 1
2005-04-17 02:20:36 +04:00
2015-11-22 02:07:06 +03:00
make_ i n s e r t _ t l b s p c ,p t e ,p r o t ,t 1
2005-04-17 02:20:36 +04:00
f_ e x t e n d p t e ,t 1
2015-07-02 00:18:37 +03:00
idtlbt p t e ,p r o t
2005-04-17 02:20:36 +04:00
2021-02-12 18:38:52 +03:00
ptl_ u n l o c k 0 s p c ,t 0
2005-04-17 02:20:36 +04:00
rfir
nop
# endif
.import handle_ i n t e r r u p t i o n ,c o d e
kernel_bad_space :
b i n t r _ s a v e
ldi 3 1 ,% r8 / * U s e a n u n u s e d c o d e * /
dbit_fault :
b i n t r _ s a v e
ldi 2 0 ,% r8
itlb_fault :
b i n t r _ s a v e
2018-08-24 00:06:25 +03:00
ldi P A R I S C _ I T L B _ T R A P ,% r8
2005-04-17 02:20:36 +04:00
nadtlb_fault :
b i n t r _ s a v e
ldi 1 7 ,% r8
2010-12-22 19:22:11 +03:00
naitlb_fault :
b i n t r _ s a v e
ldi 1 6 ,% r8
2005-04-17 02:20:36 +04:00
dtlb_fault :
b i n t r _ s a v e
ldi 1 5 ,% r8
/ * Register s a v i n g s e m a n t i c s f o r s y s t e m c a l l s :
% r1 c l o b b e r e d b y s y s t e m c a l l m a c r o i n u s e r s p a c e
% r2 s a v e d i n P T _ R E G S b y g a t e w a y p a g e
% r3 - % r18 p r e s e r v e d b y C c o d e ( s a v e d b y s i g n a l c o d e )
% r1 9 - % r20 s a v e d i n P T _ R E G S b y g a t e w a y p a g e
% r2 1 - % r22 n o n - s t a n d a r d s y s c a l l a r g s
stored i n k e r n e l s t a c k b y g a t e w a y p a g e
% r2 3 - % r26 a r g 3 - a r g 0 , s a v e d i n P T _ R E G S b y g a t e w a y p a g e
% r2 7 - % r30 s a v e d i n P T _ R E G S b y g a t e w a y p a g e
% r3 1 s y s c a l l r e t u r n p o i n t e r
* /
/ * Floating p o i n t r e g i s t e r s ( F I X M E : w h a t d o w e d o w i t h t h e s e ? )
% fr0 - % f r3 s t a t u s / e x c e p t i o n , n o t p r e s e r v e d
% fr4 - % f r7 a r g u m e n t s
% fr8 - % f r11 n o t p r e s e r v e d b y C c o d e
% fr1 2 - % f r21 p r e s e r v e d b y C c o d e
% fr2 2 - % f r31 n o t p r e s e r v e d b y C c o d e
* /
.macro reg_save regs
STREG % r3 , P T _ G R 3 ( \ r e g s )
STREG % r4 , P T _ G R 4 ( \ r e g s )
STREG % r5 , P T _ G R 5 ( \ r e g s )
STREG % r6 , P T _ G R 6 ( \ r e g s )
STREG % r7 , P T _ G R 7 ( \ r e g s )
STREG % r8 , P T _ G R 8 ( \ r e g s )
STREG % r9 , P T _ G R 9 ( \ r e g s )
STREG % r10 ,P T _ G R 1 0 ( \ r e g s )
STREG % r11 ,P T _ G R 1 1 ( \ r e g s )
STREG % r12 ,P T _ G R 1 2 ( \ r e g s )
STREG % r13 ,P T _ G R 1 3 ( \ r e g s )
STREG % r14 ,P T _ G R 1 4 ( \ r e g s )
STREG % r15 ,P T _ G R 1 5 ( \ r e g s )
STREG % r16 ,P T _ G R 1 6 ( \ r e g s )
STREG % r17 ,P T _ G R 1 7 ( \ r e g s )
STREG % r18 ,P T _ G R 1 8 ( \ r e g s )
.endm
.macro reg_restore regs
LDREG P T _ G R 3 ( \ r e g s ) , % r3
LDREG P T _ G R 4 ( \ r e g s ) , % r4
LDREG P T _ G R 5 ( \ r e g s ) , % r5
LDREG P T _ G R 6 ( \ r e g s ) , % r6
LDREG P T _ G R 7 ( \ r e g s ) , % r7
LDREG P T _ G R 8 ( \ r e g s ) , % r8
LDREG P T _ G R 9 ( \ r e g s ) , % r9
LDREG P T _ G R 1 0 ( \ r e g s ) ,% r10
LDREG P T _ G R 1 1 ( \ r e g s ) ,% r11
LDREG P T _ G R 1 2 ( \ r e g s ) ,% r12
LDREG P T _ G R 1 3 ( \ r e g s ) ,% r13
LDREG P T _ G R 1 4 ( \ r e g s ) ,% r14
LDREG P T _ G R 1 5 ( \ r e g s ) ,% r15
LDREG P T _ G R 1 6 ( \ r e g s ) ,% r16
LDREG P T _ G R 1 7 ( \ r e g s ) ,% r17
LDREG P T _ G R 1 8 ( \ r e g s ) ,% r18
.endm
2012-10-27 03:59:16 +04:00
.macro fork_like name
2016-10-05 23:28:46 +03:00
ENTRY_ C F I ( s y s _ \ n a m e \ ( ) _ w r a p p e r )
2005-04-17 02:20:36 +04:00
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) , % r1
ldo T A S K _ R E G S ( % r1 ) ,% r1
reg_ s a v e % r1
2012-10-06 02:55:57 +04:00
mfctl % c r27 , % r28
2013-05-04 23:16:41 +04:00
ldil L % s y s _ \ n a m e , % r31
be R % s y s _ \ n a m e ( % s r4 ,% r31 )
2012-10-06 02:55:57 +04:00
STREG % r28 , P T _ C R 2 7 ( % r1 )
2016-10-05 23:28:46 +03:00
ENDPROC_ C F I ( s y s _ \ n a m e \ ( ) _ w r a p p e r )
2012-10-27 03:59:16 +04:00
.endm
2005-04-17 02:20:36 +04:00
2012-10-27 03:59:16 +04:00
fork_ l i k e c l o n e
2019-07-15 23:33:26 +03:00
fork_ l i k e c l o n e 3
2012-10-27 03:59:16 +04:00
fork_ l i k e f o r k
fork_ l i k e v f o r k
2005-04-17 02:20:36 +04:00
/* Set the return value for the child */
2018-08-21 15:31:32 +03:00
ENTRY( c h i l d _ r e t u r n )
2005-04-17 02:20:36 +04:00
BL s c h e d u l e _ t a i l , % r2
nop
2012-10-12 01:22:16 +04:00
finish_child_return :
2012-10-06 02:55:57 +04:00
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) , % r1
ldo T A S K _ R E G S ( % r1 ) ,% r1 / * g e t p t r e g s * /
LDREG P T _ C R 2 7 ( % r1 ) , % r3
mtctl % r3 , % c r27
reg_ r e s t o r e % r1
b s y s c a l l _ e x i t
2005-04-17 02:20:36 +04:00
copy % r0 ,% r28
2018-08-21 15:31:32 +03:00
END( c h i l d _ r e t u r n )
2005-04-17 02:20:36 +04:00
2016-10-05 23:28:46 +03:00
ENTRY_ C F I ( s y s _ r t _ s i g r e t u r n _ w r a p p e r )
2005-04-17 02:20:36 +04:00
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) ,% r26
ldo T A S K _ R E G S ( % r26 ) ,% r26 / * g e t p t r e g s * /
/* Don't save regs, we are going to restore them from sigcontext. */
STREG % r2 , - R P _ O F F S E T ( % r30 )
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
ldo F R A M E _ S I Z E ( % r30 ) , % r30
BL s y s _ r t _ s i g r e t u r n ,% r2
ldo - 1 6 ( % r30 ) ,% r29 / * R e f e r e n c e p a r a m s a v e a r e a * /
# else
BL s y s _ r t _ s i g r e t u r n ,% r2
ldo F R A M E _ S I Z E ( % r30 ) , % r30
# endif
ldo - F R A M E _ S I Z E ( % r30 ) , % r30
LDREG - R P _ O F F S E T ( % r30 ) , % r2
/* FIXME: I think we need to restore a few more things here. */
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) ,% r1
ldo T A S K _ R E G S ( % r1 ) ,% r1 / * g e t p t r e g s * /
reg_ r e s t o r e % r1
/ * If t h e s i g n a l w a s r e c e i v e d w h i l e t h e p r o c e s s w a s b l o c k e d o n a
* syscall, t h e n r2 w i l l t a k e u s t o s y s c a l l _ e x i t ; otherwise r2 will
* take u s t o s y s c a l l _ e x i t _ r f i a n d o n t o i n t r _ r e t u r n .
* /
bv % r0 ( % r2 )
LDREG P T _ G R 2 8 ( % r1 ) ,% r28 / * r e l o a d o r i g i n a l r28 f o r s y s c a l l _ e x i t * /
2016-10-05 23:28:46 +03:00
ENDPROC_ C F I ( s y s _ r t _ s i g r e t u r n _ w r a p p e r )
2005-04-17 02:20:36 +04:00
2018-08-21 15:31:32 +03:00
ENTRY( s y s c a l l _ e x i t )
2005-04-17 02:20:36 +04:00
/ * NOTE : Not a l l s y s c a l l s e x i t t h i s w a y . r t _ s i g r e t u r n w i l l e x i t
* via s y s c a l l _ e x i t _ r f i i f t h e s i g n a l w a s r e c e i v e d w h i l e t h e p r o c e s s
* was r u n n i n g .
* /
/* save return value now */
mfctl % c r30 , % r1
LDREG T I _ T A S K ( % r1 ) ,% r1
STREG % r28 ,T A S K _ P T _ G R 2 8 ( % r1 )
/ * Seems t o m e t h a t d p c o u l d b e w r o n g h e r e , i f t h e s y s c a l l i n v o l v e d
* calling a m o d u l e , a n d n o t h i n g g o t r o u n d t o r e s t o r i n g d p o n r e t u r n .
* /
loadgp
syscall_check_resched :
/* check for reschedule */
LDREG T I _ F L A G S - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) ,% r19 / * l o n g * /
bb,< ,n % r19 , 3 1 - T I F _ N E E D _ R E S C H E D , s y s c a l l _ d o _ r e s c h e d / * f o r w a r d * /
2007-01-09 00:28:06 +03:00
.import do_ s i g n a l ,c o d e
2005-04-17 02:20:36 +04:00
syscall_check_sig :
2007-01-09 00:28:06 +03:00
LDREG T I _ F L A G S - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) ,% r19
2020-10-30 00:01:06 +03:00
ldi ( _ T I F _ U S E R _ W O R K _ M A S K & ~ _ T I F _ N E E D _ R E S C H E D ) , % r26
2007-01-09 00:28:06 +03:00
and,C O N D ( < > ) % r19 , % r26 , % r0
b,n s y s c a l l _ r e s t o r e / * s k i p p a s t i f w e ' v e n o t h i n g t o d o * /
syscall_do_signal :
/ * Save c a l l e e - s a v e r e g i s t e r s ( f o r s i g c o n t e x t ) .
* FIXME : After t h i s p o i n t t h e p r o c e s s s t r u c t u r e s h o u l d b e
* consistent w i t h a l l t h e r e l e v a n t s t a t e o f t h e p r o c e s s
* before t h e s y s c a l l . W e n e e d t o v e r i f y t h i s .
* /
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) ,% r1
ldo T A S K _ R E G S ( % r1 ) , % r26 / * s t r u c t p t _ r e g s * r e g s * /
reg_ s a v e % r26
# ifdef C O N F I G _ 6 4 B I T
ldo - 1 6 ( % r30 ) ,% r29 / * R e f e r e n c e p a r a m s a v e a r e a * /
# endif
BL d o _ n o t i f y _ r e s u m e ,% r2
ldi 1 , % r25 / * l o n g i n _ s y s c a l l = 1 * /
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) ,% r1
ldo T A S K _ R E G S ( % r1 ) , % r20 / * r e l o a d p t _ r e g s * /
reg_ r e s t o r e % r20
b,n s y s c a l l _ c h e c k _ s i g
2005-04-17 02:20:36 +04:00
syscall_restore :
LDREG T I _ T A S K - T H R E A D _ S Z _ A L G N - F R A M E _ S I Z E ( % r30 ) ,% r1
2009-09-28 07:03:02 +04:00
/* Are we being ptraced? */
ldw T A S K _ F L A G S ( % r1 ) ,% r19
2012-12-29 03:18:01 +04:00
ldi _ T I F _ S Y S C A L L _ T R A C E _ M A S K ,% r2
2009-09-28 07:03:02 +04:00
and,C O N D ( = ) % r19 ,% r2 ,% r0
b,n s y s c a l l _ r e s t o r e _ r f i
2005-04-17 02:20:36 +04:00
ldo T A S K _ P T _ F R 3 1 ( % r1 ) ,% r19 / * r e l o a d f p r e g s * /
rest_ f p % r19
LDREG T A S K _ P T _ S A R ( % r1 ) ,% r19 / * r e s t o r e S A R * /
mtsar % r19
LDREG T A S K _ P T _ G R 2 ( % r1 ) ,% r2 / * r e s t o r e u s e r r p * /
LDREG T A S K _ P T _ G R 1 9 ( % r1 ) ,% r19
LDREG T A S K _ P T _ G R 2 0 ( % r1 ) ,% r20
LDREG T A S K _ P T _ G R 2 1 ( % r1 ) ,% r21
LDREG T A S K _ P T _ G R 2 2 ( % r1 ) ,% r22
LDREG T A S K _ P T _ G R 2 3 ( % r1 ) ,% r23
LDREG T A S K _ P T _ G R 2 4 ( % r1 ) ,% r24
LDREG T A S K _ P T _ G R 2 5 ( % r1 ) ,% r25
LDREG T A S K _ P T _ G R 2 6 ( % r1 ) ,% r26
LDREG T A S K _ P T _ G R 2 7 ( % r1 ) ,% r27 / * r e s t o r e u s e r d p * /
LDREG T A S K _ P T _ G R 2 8 ( % r1 ) ,% r28 / * s y s c a l l r e t u r n v a l u e * /
LDREG T A S K _ P T _ G R 2 9 ( % r1 ) ,% r29
LDREG T A S K _ P T _ G R 3 1 ( % r1 ) ,% r31 / * r e s t o r e s y s c a l l r p * /
/* NOTE: We use rsm/ssm pair to make this operation atomic */
2010-04-11 21:12:56 +04:00
LDREG T A S K _ P T _ G R 3 0 ( % r1 ) ,% r1 / * G e t u s e r s p * /
2005-04-17 02:20:36 +04:00
rsm P S W _ S M _ I , % r0
2010-04-11 21:12:56 +04:00
copy % r1 ,% r30 / * R e s t o r e u s e r s p * /
mfsp % s r3 ,% r1 / * G e t u s e r s p a c e i d * /
2005-04-17 02:20:36 +04:00
mtsp % r1 ,% s r7 / * R e s t o r e s r7 * /
ssm P S W _ S M _ I , % r0
/* Set sr2 to zero for userspace syscalls to work. */
mtsp % r0 ,% s r2
mtsp % r1 ,% s r4 / * R e s t o r e s r4 * /
mtsp % r1 ,% s r5 / * R e s t o r e s r5 * /
mtsp % r1 ,% s r6 / * R e s t o r e s r6 * /
depi 3 ,3 1 ,2 ,% r31 / * e n s u r e r e t u r n t o u s e r m o d e . * /
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
/ * decide w h e t h e r t o r e s e t t h e w i d e m o d e b i t
*
* For a s y s c a l l , t h e W b i t i s s t o r e d i n t h e l o w e s t b i t
* of s p . E x t r a c t i t a n d r e s e t W i f i t i s z e r o * /
extrd,u ,* < > % r30 ,6 3 ,1 ,% r1
rsm P S W _ S M _ W , % r0
/* now reset the lowest bit of sp if it was set */
xor % r30 ,% r1 ,% r30
# endif
be,n 0 ( % s r3 ,% r31 ) / * r e t u r n t o u s e r s p a c e * /
/ * We h a v e t o r e t u r n v i a a n R F I , s o t h a t P S W T a n d R b i t s c a n b e s e t
* appropriately.
* This s e t s u p p t _ r e g s s o w e c a n r e t u r n v i a i n t r _ r e s t o r e , w h i c h i s n o t
* the m o s t e f f i c i e n t w a y o f d o i n g t h i n g s , b u t i t w o r k s .
* /
syscall_restore_rfi :
ldo - 1 ( % r0 ) ,% r2 / * S e t r e c o v e r y c n t r t o - 1 * /
mtctl % r2 ,% c r0 / * f o r i m m e d i a t e t r a p * /
LDREG T A S K _ P T _ P S W ( % r1 ) ,% r2 / * G e t o l d P S W * /
ldi 0 x0 b ,% r20 / * C r e a t e n e w P S W * /
depi - 1 ,1 3 ,1 ,% r20 / * C , Q , D , a n d I b i t s * /
2009-09-28 07:03:02 +04:00
/ * The v a l u e s o f S I N G L E S T E P _ B I T a n d B L O C K S T E P _ B I T a r e
* set i n t h r e a d _ i n f o . h a n d c o n v e r t e d t o P A b i t m a p
2005-04-17 02:20:36 +04:00
* numbers i n a s m - o f f s e t s . c * /
2009-09-28 07:03:02 +04:00
/* if ((%r19.SINGLESTEP_BIT)) { %r20.27=1} */
extru,= % r19 ,T I F _ S I N G L E S T E P _ P A _ B I T ,1 ,% r0
2005-04-17 02:20:36 +04:00
depi - 1 ,2 7 ,1 ,% r20 / * R b i t * /
2009-09-28 07:03:02 +04:00
/* if ((%r19.BLOCKSTEP_BIT)) { %r20.7=1} */
extru,= % r19 ,T I F _ B L O C K S T E P _ P A _ B I T ,1 ,% r0
2005-04-17 02:20:36 +04:00
depi - 1 ,7 ,1 ,% r20 / * T b i t * /
STREG % r20 ,T A S K _ P T _ P S W ( % r1 )
/* Always store space registers, since sr3 can be changed (e.g. fork) */
mfsp % s r3 ,% r25
STREG % r25 ,T A S K _ P T _ S R 3 ( % r1 )
STREG % r25 ,T A S K _ P T _ S R 4 ( % r1 )
STREG % r25 ,T A S K _ P T _ S R 5 ( % r1 )
STREG % r25 ,T A S K _ P T _ S R 6 ( % r1 )
STREG % r25 ,T A S K _ P T _ S R 7 ( % r1 )
STREG % r25 ,T A S K _ P T _ I A S Q 0 ( % r1 )
STREG % r25 ,T A S K _ P T _ I A S Q 1 ( % r1 )
/* XXX W bit??? */
/ * Now i f o l d D b i t i s c l e a r , i t m e a n s w e d i d n ' t s a v e a l l r e g i s t e r s
* on s y s c a l l e n t r y , s o d o t h a t n o w . T h i s o n l y h a p p e n s o n T R A C E M E
* calls, o r i f s o m e o n e a t t a c h e d t o u s w h i l e w e w e r e o n a s y s c a l l .
* We c o u l d m a k e t h i s m o r e e f f i c i e n t b y n o t s a v i n g r3 - r18 , b u t
* then w e w o u l d n ' t b e a b l e t o u s e t h e c o m m o n i n t r _ r e s t o r e p a t h .
* It i s o n l y f o r t r a c e d p r o c e s s e s a n y w a y , s o p e r f o r m a n c e i s n o t
* an i s s u e .
* /
bb,< % r2 ,3 0 ,p t _ r e g s _ o k / * B r a n c h i f D s e t * /
ldo T A S K _ R E G S ( % r1 ) ,% r25
reg_ s a v e % r25 / * S a v e r3 t o r18 * /
/* Save the current sr */
mfsp % s r0 ,% r2
STREG % r2 ,T A S K _ P T _ S R 0 ( % r1 )
/* Save the scratch sr */
mfsp % s r1 ,% r2
STREG % r2 ,T A S K _ P T _ S R 1 ( % r1 )
/* sr2 should be set to zero for userspace syscalls */
STREG % r0 ,T A S K _ P T _ S R 2 ( % r1 )
LDREG T A S K _ P T _ G R 3 1 ( % r1 ) ,% r2
2012-12-29 03:18:01 +04:00
depi 3 ,3 1 ,2 ,% r2 / * e n s u r e r e t u r n t o u s e r m o d e . * /
STREG % r2 ,T A S K _ P T _ I A O Q 0 ( % r1 )
2005-04-17 02:20:36 +04:00
ldo 4 ( % r2 ) ,% r2
STREG % r2 ,T A S K _ P T _ I A O Q 1 ( % r1 )
2012-12-29 03:18:01 +04:00
b i n t r _ r e s t o r e
2005-04-17 02:20:36 +04:00
copy % r25 ,% r16
2012-12-29 03:18:01 +04:00
pt_regs_ok :
LDREG T A S K _ P T _ I A O Q 0 ( % r1 ) ,% r2
depi 3 ,3 1 ,2 ,% r2 / * e n s u r e r e t u r n t o u s e r m o d e . * /
STREG % r2 ,T A S K _ P T _ I A O Q 0 ( % r1 )
LDREG T A S K _ P T _ I A O Q 1 ( % r1 ) ,% r2
depi 3 ,3 1 ,2 ,% r2
STREG % r2 ,T A S K _ P T _ I A O Q 1 ( % r1 )
2005-04-17 02:20:36 +04:00
b i n t r _ r e s t o r e
2012-12-29 03:18:01 +04:00
copy % r25 ,% r16
2005-04-17 02:20:36 +04:00
syscall_do_resched :
2016-04-13 23:27:22 +03:00
load3 2 s y s c a l l _ c h e c k _ r e s c h e d ,% r2 / * i f r e s c h e d , w e s t a r t o v e r a g a i n * /
load3 2 s c h e d u l e ,% r19
bv % r0 ( % r19 ) / * j u m p s t o s c h e d u l e ( ) * /
2005-10-22 06:46:48 +04:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-17 02:20:36 +04:00
ldo - 1 6 ( % r30 ) ,% r29 / * R e f e r e n c e p a r a m s a v e a r e a * /
# else
nop
# endif
2018-08-21 15:31:32 +03:00
END( s y s c a l l _ e x i t )
2005-04-17 02:20:36 +04:00
2007-01-23 22:50:59 +03:00
2009-02-09 02:43:36 +03:00
# ifdef C O N F I G _ F U N C T I O N _ T R A C E R
2016-04-13 23:27:22 +03:00
2009-02-09 02:43:36 +03:00
.import ftrace_ f u n c t i o n _ t r a m p o l i n e ,c o d e
2016-04-13 23:27:22 +03:00
.align L1_CACHE_BYTES
2018-08-05 01:03:29 +03:00
ENTRY_ C F I ( m c o u n t , c a l l e r )
2016-04-13 23:27:22 +03:00
_mcount :
.export _ mcount,d a t a
/ *
* The 6 4 b i t m c o u n t ( ) f u n c t i o n p o i n t e r n e e d s 4 d w o r d s , o f w h i c h t h e
* first t w o a r e f r e e . W e o p t i m i z e i t h e r e a n d p u t 2 i n s t r u c t i o n s f o r
* calling m c o u n t ( ) , a n d 2 i n s t r u c t i o n s f o r f t r a c e _ s t u b ( ) . T h a t w a y w e
* have a l l o n o n e L 1 c a c h e l i n e .
* /
2019-07-23 23:37:52 +03:00
ldi 0 , % a r g 3
2009-02-09 02:43:36 +03:00
b f t r a c e _ f u n c t i o n _ t r a m p o l i n e
2016-04-13 23:27:22 +03:00
copy % r3 , % a r g 2 / * c a l l e r o r i g i n a l % s p * /
ftrace_stub :
.globl ftrace_stub
.type ftrace_ s t u b , @function
# ifdef C O N F I G _ 6 4 B I T
bve ( % r p )
# else
bv % r0 ( % r p )
# endif
2009-02-09 02:43:36 +03:00
nop
2016-04-13 23:27:22 +03:00
# ifdef C O N F I G _ 6 4 B I T
.dword mcount
.dword 0 /* code in head.S puts value of global gp here */
# endif
2018-08-05 01:03:29 +03:00
ENDPROC_ C F I ( m c o u n t )
2009-02-09 02:43:36 +03:00
parisc: add dynamic ftrace
This patch implements dynamic ftrace for PA-RISC. The required mcount
call sequences can get pretty long, so instead of patching the
whole call sequence out of the functions, we are using
-fpatchable-function-entry from gcc. This puts a configurable amount of
NOPS before/at the start of the function. Taking do_sys_open() as example,
which would look like this when the call is patched out:
1036b248: 08 00 02 40 nop
1036b24c: 08 00 02 40 nop
1036b250: 08 00 02 40 nop
1036b254: 08 00 02 40 nop
1036b258 <do_sys_open>:
1036b258: 08 00 02 40 nop
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
When ftrace gets enabled for this function the kernel will patch these
NOPs to:
1036b248: 10 19 57 20 <address of ftrace>
1036b24c: 6f c1 00 80 stw,ma r1,40(sp)
1036b250: 48 21 3f d1 ldw -18(r1),r1
1036b254: e8 20 c0 02 bv,n r0(r1)
1036b258 <do_sys_open>:
1036b258: e8 3f 1f df b,l,n .-c,r1
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
So the first NOP in do_sys_open() will be patched to jump backwards into
some minimal trampoline code which pushes a stackframe, saves r1 which
holds the return address, loads the address of the real ftrace function,
and branches to that location. For 64 Bit things are getting a bit more
complicated (and longer) because we must make sure that the address of
ftrace location is 8 byte aligned, and the offset passed to ldd for
fetching the address is 8 byte aligned as well.
Note that gcc has a bug which misplaces the function label, and needs a
patch to make dynamic ftrace work. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90751 for details.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2019-06-05 23:32:22 +03:00
# ifdef C O N F I G _ D Y N A M I C _ F T R A C E
# ifdef C O N F I G _ 6 4 B I T
# define F T R A C E _ F R A M E _ S I Z E ( 2 * F R A M E _ S I Z E )
# else
# define F T R A C E _ F R A M E _ S I Z E F R A M E _ S I Z E
# endif
ENTRY_ C F I ( f t r a c e _ c a l l e r , c a l l e r ,f r a m e =FTRACE_FRAME_SIZE ,C A L L S ,S A V E _ R P ,S A V E _ S P )
ftrace_caller :
.global ftrace_caller
STREG % r3 , - F T R A C E _ F R A M E _ S I Z E + 1 * R E G _ S Z ( % s p )
ldo - F T R A C E _ F R A M E _ S I Z E ( % s p ) , % r3
STREG % r p , - R P _ O F F S E T ( % r3 )
/* Offset 0 is already allocated for %r1 */
STREG % r23 , 2 * R E G _ S Z ( % r3 )
STREG % r24 , 3 * R E G _ S Z ( % r3 )
STREG % r25 , 4 * R E G _ S Z ( % r3 )
STREG % r26 , 5 * R E G _ S Z ( % r3 )
STREG % r28 , 6 * R E G _ S Z ( % r3 )
STREG % r29 , 7 * R E G _ S Z ( % r3 )
# ifdef C O N F I G _ 6 4 B I T
STREG % r19 , 8 * R E G _ S Z ( % r3 )
STREG % r20 , 9 * R E G _ S Z ( % r3 )
STREG % r21 , 1 0 * R E G _ S Z ( % r3 )
STREG % r22 , 1 1 * R E G _ S Z ( % r3 )
STREG % r27 , 1 2 * R E G _ S Z ( % r3 )
STREG % r31 , 1 3 * R E G _ S Z ( % r3 )
loadgp
ldo - 1 6 ( % s p ) ,% r29
# endif
LDREG 0 ( % r3 ) , % r25
copy % r p , % r26
ldo - 8 ( % r25 ) , % r25
2019-07-23 23:37:52 +03:00
ldi 0 , % r23 / * n o p t _ r e g s * /
parisc: add dynamic ftrace
This patch implements dynamic ftrace for PA-RISC. The required mcount
call sequences can get pretty long, so instead of patching the
whole call sequence out of the functions, we are using
-fpatchable-function-entry from gcc. This puts a configurable amount of
NOPS before/at the start of the function. Taking do_sys_open() as example,
which would look like this when the call is patched out:
1036b248: 08 00 02 40 nop
1036b24c: 08 00 02 40 nop
1036b250: 08 00 02 40 nop
1036b254: 08 00 02 40 nop
1036b258 <do_sys_open>:
1036b258: 08 00 02 40 nop
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
When ftrace gets enabled for this function the kernel will patch these
NOPs to:
1036b248: 10 19 57 20 <address of ftrace>
1036b24c: 6f c1 00 80 stw,ma r1,40(sp)
1036b250: 48 21 3f d1 ldw -18(r1),r1
1036b254: e8 20 c0 02 bv,n r0(r1)
1036b258 <do_sys_open>:
1036b258: e8 3f 1f df b,l,n .-c,r1
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
So the first NOP in do_sys_open() will be patched to jump backwards into
some minimal trampoline code which pushes a stackframe, saves r1 which
holds the return address, loads the address of the real ftrace function,
and branches to that location. For 64 Bit things are getting a bit more
complicated (and longer) because we must make sure that the address of
ftrace location is 8 byte aligned, and the offset passed to ldd for
fetching the address is 8 byte aligned as well.
Note that gcc has a bug which misplaces the function label, and needs a
patch to make dynamic ftrace work. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90751 for details.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2019-06-05 23:32:22 +03:00
b,l f t r a c e _ f u n c t i o n _ t r a m p o l i n e , % r p
copy % r3 , % r24
LDREG - R P _ O F F S E T ( % r3 ) , % r p
LDREG 2 * R E G _ S Z ( % r3 ) , % r23
LDREG 3 * R E G _ S Z ( % r3 ) , % r24
LDREG 4 * R E G _ S Z ( % r3 ) , % r25
LDREG 5 * R E G _ S Z ( % r3 ) , % r26
LDREG 6 * R E G _ S Z ( % r3 ) , % r28
LDREG 7 * R E G _ S Z ( % r3 ) , % r29
# ifdef C O N F I G _ 6 4 B I T
LDREG 8 * R E G _ S Z ( % r3 ) , % r19
LDREG 9 * R E G _ S Z ( % r3 ) , % r20
LDREG 1 0 * R E G _ S Z ( % r3 ) , % r21
LDREG 1 1 * R E G _ S Z ( % r3 ) , % r22
LDREG 1 2 * R E G _ S Z ( % r3 ) , % r27
LDREG 1 3 * R E G _ S Z ( % r3 ) , % r31
# endif
LDREG 1 * R E G _ S Z ( % r3 ) , % r3
LDREGM - F T R A C E _ F R A M E _ S I Z E ( % s p ) , % r1
/* Adjust return point to jump back to beginning of traced function */
ldo - 4 ( % r1 ) , % r1
bv,n ( % r1 )
ENDPROC_ C F I ( f t r a c e _ c a l l e r )
2019-07-23 23:37:52 +03:00
# ifdef C O N F I G _ H A V E _ D Y N A M I C _ F T R A C E _ W I T H _ R E G S
ENTRY_ C F I ( f t r a c e _ r e g s _ c a l l e r ,c a l l e r ,f r a m e =FTRACE_FRAME_SIZE + P T _ S Z _ A L G N ,
CALLS,S A V E _ R P ,S A V E _ S P )
ftrace_regs_caller :
.global ftrace_regs_caller
ldo - F T R A C E _ F R A M E _ S I Z E ( % s p ) , % r1
STREG % r p , - R P _ O F F S E T ( % r1 )
copy % s p , % r1
ldo P T _ S Z _ A L G N ( % s p ) , % s p
STREG % r p , P T _ G R 2 ( % r1 )
STREG % r3 , P T _ G R 3 ( % r1 )
STREG % r4 , P T _ G R 4 ( % r1 )
STREG % r5 , P T _ G R 5 ( % r1 )
STREG % r6 , P T _ G R 6 ( % r1 )
STREG % r7 , P T _ G R 7 ( % r1 )
STREG % r8 , P T _ G R 8 ( % r1 )
STREG % r9 , P T _ G R 9 ( % r1 )
STREG % r10 , P T _ G R 1 0 ( % r1 )
STREG % r11 , P T _ G R 1 1 ( % r1 )
STREG % r12 , P T _ G R 1 2 ( % r1 )
STREG % r13 , P T _ G R 1 3 ( % r1 )
STREG % r14 , P T _ G R 1 4 ( % r1 )
STREG % r15 , P T _ G R 1 5 ( % r1 )
STREG % r16 , P T _ G R 1 6 ( % r1 )
STREG % r17 , P T _ G R 1 7 ( % r1 )
STREG % r18 , P T _ G R 1 8 ( % r1 )
STREG % r19 , P T _ G R 1 9 ( % r1 )
STREG % r20 , P T _ G R 2 0 ( % r1 )
STREG % r21 , P T _ G R 2 1 ( % r1 )
STREG % r22 , P T _ G R 2 2 ( % r1 )
STREG % r23 , P T _ G R 2 3 ( % r1 )
STREG % r24 , P T _ G R 2 4 ( % r1 )
STREG % r25 , P T _ G R 2 5 ( % r1 )
STREG % r26 , P T _ G R 2 6 ( % r1 )
STREG % r27 , P T _ G R 2 7 ( % r1 )
STREG % r28 , P T _ G R 2 8 ( % r1 )
STREG % r29 , P T _ G R 2 9 ( % r1 )
STREG % r30 , P T _ G R 3 0 ( % r1 )
STREG % r31 , P T _ G R 3 1 ( % r1 )
mfctl % c r11 , % r26
STREG % r26 , P T _ S A R ( % r1 )
copy % r p , % r26
LDREG - F T R A C E _ F R A M E _ S I Z E - P T _ S Z _ A L G N ( % s p ) , % r25
ldo - 8 ( % r25 ) , % r25
2019-10-30 11:17:18 +03:00
ldo - F T R A C E _ F R A M E _ S I Z E ( % r1 ) , % a r g 2
2019-07-23 23:37:52 +03:00
b,l f t r a c e _ f u n c t i o n _ t r a m p o l i n e , % r p
copy % r1 , % a r g 3 / * s t r u c t p t _ r e g s * /
ldo - P T _ S Z _ A L G N ( % s p ) , % r1
LDREG P T _ S A R ( % r1 ) , % r p
mtctl % r p , % c r11
LDREG P T _ G R 2 ( % r1 ) , % r p
LDREG P T _ G R 3 ( % r1 ) , % r3
LDREG P T _ G R 4 ( % r1 ) , % r4
LDREG P T _ G R 5 ( % r1 ) , % r5
LDREG P T _ G R 6 ( % r1 ) , % r6
LDREG P T _ G R 7 ( % r1 ) , % r7
LDREG P T _ G R 8 ( % r1 ) , % r8
LDREG P T _ G R 9 ( % r1 ) , % r9
LDREG P T _ G R 1 0 ( % r1 ) ,% r10
LDREG P T _ G R 1 1 ( % r1 ) ,% r11
LDREG P T _ G R 1 2 ( % r1 ) ,% r12
LDREG P T _ G R 1 3 ( % r1 ) ,% r13
LDREG P T _ G R 1 4 ( % r1 ) ,% r14
LDREG P T _ G R 1 5 ( % r1 ) ,% r15
LDREG P T _ G R 1 6 ( % r1 ) ,% r16
LDREG P T _ G R 1 7 ( % r1 ) ,% r17
LDREG P T _ G R 1 8 ( % r1 ) ,% r18
LDREG P T _ G R 1 9 ( % r1 ) ,% r19
LDREG P T _ G R 2 0 ( % r1 ) ,% r20
LDREG P T _ G R 2 1 ( % r1 ) ,% r21
LDREG P T _ G R 2 2 ( % r1 ) ,% r22
LDREG P T _ G R 2 3 ( % r1 ) ,% r23
LDREG P T _ G R 2 4 ( % r1 ) ,% r24
LDREG P T _ G R 2 5 ( % r1 ) ,% r25
LDREG P T _ G R 2 6 ( % r1 ) ,% r26
LDREG P T _ G R 2 7 ( % r1 ) ,% r27
LDREG P T _ G R 2 8 ( % r1 ) ,% r28
LDREG P T _ G R 2 9 ( % r1 ) ,% r29
LDREG P T _ G R 3 0 ( % r1 ) ,% r30
LDREG P T _ G R 3 1 ( % r1 ) ,% r31
ldo - P T _ S Z _ A L G N ( % s p ) , % s p
LDREGM - F T R A C E _ F R A M E _ S I Z E ( % s p ) , % r1
/* Adjust return point to jump back to beginning of traced function */
ldo - 4 ( % r1 ) , % r1
bv,n ( % r1 )
ENDPROC_ C F I ( f t r a c e _ r e g s _ c a l l e r )
# endif
parisc: add dynamic ftrace
This patch implements dynamic ftrace for PA-RISC. The required mcount
call sequences can get pretty long, so instead of patching the
whole call sequence out of the functions, we are using
-fpatchable-function-entry from gcc. This puts a configurable amount of
NOPS before/at the start of the function. Taking do_sys_open() as example,
which would look like this when the call is patched out:
1036b248: 08 00 02 40 nop
1036b24c: 08 00 02 40 nop
1036b250: 08 00 02 40 nop
1036b254: 08 00 02 40 nop
1036b258 <do_sys_open>:
1036b258: 08 00 02 40 nop
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
When ftrace gets enabled for this function the kernel will patch these
NOPs to:
1036b248: 10 19 57 20 <address of ftrace>
1036b24c: 6f c1 00 80 stw,ma r1,40(sp)
1036b250: 48 21 3f d1 ldw -18(r1),r1
1036b254: e8 20 c0 02 bv,n r0(r1)
1036b258 <do_sys_open>:
1036b258: e8 3f 1f df b,l,n .-c,r1
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
So the first NOP in do_sys_open() will be patched to jump backwards into
some minimal trampoline code which pushes a stackframe, saves r1 which
holds the return address, loads the address of the real ftrace function,
and branches to that location. For 64 Bit things are getting a bit more
complicated (and longer) because we must make sure that the address of
ftrace location is 8 byte aligned, and the offset passed to ldd for
fetching the address is 8 byte aligned as well.
Note that gcc has a bug which misplaces the function label, and needs a
patch to make dynamic ftrace work. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90751 for details.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2019-06-05 23:32:22 +03:00
# endif
2016-05-24 00:23:26 +03:00
# ifdef C O N F I G _ F U N C T I O N _ G R A P H _ T R A C E R
2016-04-13 23:27:22 +03:00
.align 8
2018-08-05 01:03:29 +03:00
ENTRY_ C F I ( r e t u r n _ t o _ h a n d l e r , c a l l e r ,f r a m e =FRAME_SIZE )
2016-04-13 23:27:22 +03:00
.export parisc_ r e t u r n _ t o _ h a n d l e r ,d a t a
parisc_return_to_handler :
copy % r3 ,% r1
STREG % r0 ,- R P _ O F F S E T ( % s p ) / * s t o r e 0 a s % r p * /
copy % s p ,% r3
STREGM % r1 ,F R A M E _ S I Z E ( % s p )
STREG % r e t 0 ,8 ( % r3 )
STREG % r e t 1 ,1 6 ( % r3 )
2009-02-09 02:43:36 +03:00
2016-04-13 23:27:22 +03:00
# ifdef C O N F I G _ 6 4 B I T
loadgp
# endif
/* call ftrace_return_to_handler(0) */
2016-05-24 00:23:26 +03:00
.import ftrace_ r e t u r n _ t o _ h a n d l e r ,c o d e
load3 2 f t r a c e _ r e t u r n _ t o _ h a n d l e r ,% r e t 0
load3 2 . L f t r a c e _ r e t ,% r2
2016-04-13 23:27:22 +03:00
# ifdef C O N F I G _ 6 4 B I T
ldo - 1 6 ( % s p ) ,% r e t 1 / * R e f e r e n c e p a r a m s a v e a r e a * /
2016-05-24 00:23:26 +03:00
bve ( % r e t 0 )
# else
bv % r0 ( % r e t 0 )
2016-04-13 23:27:22 +03:00
# endif
ldi 0 ,% r26
2016-05-24 00:23:26 +03:00
.Lftrace_ret :
2016-04-13 23:27:22 +03:00
copy % r e t 0 ,% r p
/* restore original return values */
LDREG 8 ( % r3 ) ,% r e t 0
LDREG 1 6 ( % r3 ) ,% r e t 1
/* return from function */
# ifdef C O N F I G _ 6 4 B I T
bve ( % r p )
# else
2009-02-09 02:43:36 +03:00
bv % r0 ( % r p )
2016-04-13 23:27:22 +03:00
# endif
LDREGM - F R A M E _ S I Z E ( % s p ) ,% r3
2016-10-05 23:28:46 +03:00
ENDPROC_ C F I ( r e t u r n _ t o _ h a n d l e r )
2016-04-13 23:27:22 +03:00
2016-05-24 00:23:26 +03:00
# endif / * C O N F I G _ F U N C T I O N _ G R A P H _ T R A C E R * /
2009-02-09 02:43:36 +03:00
# endif / * C O N F I G _ F U N C T I O N _ T R A C E R * /
2013-05-08 00:25:42 +04:00
# ifdef C O N F I G _ I R Q S T A C K S
/ * void c a l l _ o n _ s t a c k ( u n s i g n e d l o n g p a r a m 1 , v o i d * f u n c ,
unsigned l o n g n e w _ s t a c k ) * /
2018-08-05 01:03:29 +03:00
ENTRY_ C F I ( c a l l _ o n _ s t a c k , F R A M E =2 * F R A M E _ S I Z E ,C A L L S ,S A V E _ R P ,S A V E _ S P )
2018-08-21 15:31:32 +03:00
ENTRY( _ c a l l _ o n _ s t a c k )
2013-05-08 00:25:42 +04:00
copy % s p , % r1
/ * Regarding t h e H P P A c a l l i n g c o n v e n t i o n s f o r f u n c t i o n p o i n t e r s ,
we a s s u m e t h e P I C r e g i s t e r i s n o t c h a n g e d a c r o s s c a l l . F o r
CONFIG_ 6 4 B I T , t h e a r g u m e n t p o i n t e r i s l e f t t o p o i n t a t t h e
argument r e g i o n a l l o c a t e d f o r t h e c a l l t o c a l l _ o n _ s t a c k . * /
2018-08-05 01:03:29 +03:00
/* Switch to new stack. We allocate two frames. */
ldo 2 * F R A M E _ S I Z E ( % a r g 2 ) , % s p
2013-05-08 00:25:42 +04:00
# ifdef C O N F I G _ 6 4 B I T
/* Save previous stack pointer and return pointer in frame marker */
2018-08-05 01:03:29 +03:00
STREG % r p , - F R A M E _ S I Z E - R P _ O F F S E T ( % s p )
2013-05-08 00:25:42 +04:00
/* Calls always use function descriptor */
LDREG 1 6 ( % a r g 1 ) , % a r g 1
bve,l ( % a r g 1 ) , % r p
2018-08-05 01:03:29 +03:00
STREG % r1 , - F R A M E _ S I Z E - R E G _ S Z ( % s p )
LDREG - F R A M E _ S I Z E - R P _ O F F S E T ( % s p ) , % r p
2013-05-08 00:25:42 +04:00
bve ( % r p )
2018-08-05 01:03:29 +03:00
LDREG - F R A M E _ S I Z E - R E G _ S Z ( % s p ) , % s p
2013-05-08 00:25:42 +04:00
# else
/* Save previous stack pointer and return pointer in frame marker */
2018-08-05 01:03:29 +03:00
STREG % r1 , - F R A M E _ S I Z E - R E G _ S Z ( % s p )
STREG % r p , - F R A M E _ S I Z E - R P _ O F F S E T ( % s p )
2013-05-08 00:25:42 +04:00
/* Calls use function descriptor if PLABEL bit is set */
bb,> = ,n % a r g 1 , 3 0 , 1 f
depwi 0 ,3 1 ,2 , % a r g 1
LDREG 0 ( % a r g 1 ) , % a r g 1
1 :
be,l 0 ( % s r4 ,% a r g 1 ) , % s r0 , % r31
copy % r31 , % r p
2018-08-05 01:03:29 +03:00
LDREG - F R A M E _ S I Z E - R P _ O F F S E T ( % s p ) , % r p
2013-05-08 00:25:42 +04:00
bv ( % r p )
2018-08-05 01:03:29 +03:00
LDREG - F R A M E _ S I Z E - R E G _ S Z ( % s p ) , % s p
2013-05-08 00:25:42 +04:00
# endif / * C O N F I G _ 6 4 B I T * /
2016-10-05 23:28:46 +03:00
ENDPROC_ C F I ( c a l l _ o n _ s t a c k )
2013-05-08 00:25:42 +04:00
# endif / * C O N F I G _ I R Q S T A C K S * /
2009-02-09 02:43:36 +03:00
2016-10-05 23:28:46 +03:00
ENTRY_ C F I ( g e t _ r e g i s t e r )
2005-04-17 02:20:36 +04:00
/ *
* get_ r e g i s t e r i s u s e d b y t h e n o n a c c e s s t l b m i s s h a n d l e r s t o
* copy t h e v a l u e o f t h e g e n e r a l r e g i s t e r s p e c i f i e d i n r8 i n t o
* r1 . T h i s r o u t i n e c a n ' t b e u s e d f o r s h a d o w e d r e g i s t e r s , s i n c e
* the r f i r w i l l r e s t o r e t h e o r i g i n a l v a l u e . S o , f o r t h e s h a d o w e d
* registers w e p u t a - 1 i n t o r1 t o i n d i c a t e t h a t t h e r e g i s t e r
* should n o t b e u s e d ( t h e r e g i s t e r b e i n g c o p i e d c o u l d a l s o h a v e
* a - 1 i n i t , b u t t h a t i s O K , i t j u s t m e a n s t h a t w e w i l l h a v e
* to u s e t h e s l o w p a t h i n s t e a d ) .
* /
blr % r8 ,% r0
nop
bv % r0 ( % r25 ) / * r0 * /
copy % r0 ,% r1
bv % r0 ( % r25 ) / * r1 - s h a d o w e d * /
ldi - 1 ,% r1
bv % r0 ( % r25 ) / * r2 * /
copy % r2 ,% r1
bv % r0 ( % r25 ) / * r3 * /
copy % r3 ,% r1
bv % r0 ( % r25 ) / * r4 * /
copy % r4 ,% r1
bv % r0 ( % r25 ) / * r5 * /
copy % r5 ,% r1
bv % r0 ( % r25 ) / * r6 * /
copy % r6 ,% r1
bv % r0 ( % r25 ) / * r7 * /
copy % r7 ,% r1
bv % r0 ( % r25 ) / * r8 - s h a d o w e d * /
ldi - 1 ,% r1
bv % r0 ( % r25 ) / * r9 - s h a d o w e d * /
ldi - 1 ,% r1
bv % r0 ( % r25 ) / * r10 * /
copy % r10 ,% r1
bv % r0 ( % r25 ) / * r11 * /
copy % r11 ,% r1
bv % r0 ( % r25 ) / * r12 * /
copy % r12 ,% r1
bv % r0 ( % r25 ) / * r13 * /
copy % r13 ,% r1
bv % r0 ( % r25 ) / * r14 * /
copy % r14 ,% r1
bv % r0 ( % r25 ) / * r15 * /
copy % r15 ,% r1
bv % r0 ( % r25 ) / * r16 - s h a d o w e d * /
ldi - 1 ,% r1
bv % r0 ( % r25 ) / * r17 - s h a d o w e d * /
ldi - 1 ,% r1
bv % r0 ( % r25 ) / * r18 * /
copy % r18 ,% r1
bv % r0 ( % r25 ) / * r19 * /
copy % r19 ,% r1
bv % r0 ( % r25 ) / * r20 * /
copy % r20 ,% r1
bv % r0 ( % r25 ) / * r21 * /
copy % r21 ,% r1
bv % r0 ( % r25 ) / * r22 * /
copy % r22 ,% r1
bv % r0 ( % r25 ) / * r23 * /
copy % r23 ,% r1
bv % r0 ( % r25 ) / * r24 - s h a d o w e d * /
ldi - 1 ,% r1
bv % r0 ( % r25 ) / * r25 - s h a d o w e d * /
ldi - 1 ,% r1
bv % r0 ( % r25 ) / * r26 * /
copy % r26 ,% r1
bv % r0 ( % r25 ) / * r27 * /
copy % r27 ,% r1
bv % r0 ( % r25 ) / * r28 * /
copy % r28 ,% r1
bv % r0 ( % r25 ) / * r29 * /
copy % r29 ,% r1
bv % r0 ( % r25 ) / * r30 * /
copy % r30 ,% r1
bv % r0 ( % r25 ) / * r31 * /
copy % r31 ,% r1
2016-10-05 23:28:46 +03:00
ENDPROC_ C F I ( g e t _ r e g i s t e r )
2005-04-17 02:20:36 +04:00
2007-01-23 22:50:59 +03:00
2016-10-05 23:28:46 +03:00
ENTRY_ C F I ( s e t _ r e g i s t e r )
2005-04-17 02:20:36 +04:00
/ *
* set_ r e g i s t e r i s u s e d b y t h e n o n a c c e s s t l b m i s s h a n d l e r s t o
* copy t h e v a l u e o f r1 i n t o t h e g e n e r a l r e g i s t e r s p e c i f i e d i n
* r8 .
* /
blr % r8 ,% r0
nop
bv % r0 ( % r25 ) / * r0 ( s i l l y , b u t i t i s a p l a c e h o l d e r ) * /
copy % r1 ,% r0
bv % r0 ( % r25 ) / * r1 * /
copy % r1 ,% r1
bv % r0 ( % r25 ) / * r2 * /
copy % r1 ,% r2
bv % r0 ( % r25 ) / * r3 * /
copy % r1 ,% r3
bv % r0 ( % r25 ) / * r4 * /
copy % r1 ,% r4
bv % r0 ( % r25 ) / * r5 * /
copy % r1 ,% r5
bv % r0 ( % r25 ) / * r6 * /
copy % r1 ,% r6
bv % r0 ( % r25 ) / * r7 * /
copy % r1 ,% r7
bv % r0 ( % r25 ) / * r8 * /
copy % r1 ,% r8
bv % r0 ( % r25 ) / * r9 * /
copy % r1 ,% r9
bv % r0 ( % r25 ) / * r10 * /
copy % r1 ,% r10
bv % r0 ( % r25 ) / * r11 * /
copy % r1 ,% r11
bv % r0 ( % r25 ) / * r12 * /
copy % r1 ,% r12
bv % r0 ( % r25 ) / * r13 * /
copy % r1 ,% r13
bv % r0 ( % r25 ) / * r14 * /
copy % r1 ,% r14
bv % r0 ( % r25 ) / * r15 * /
copy % r1 ,% r15
bv % r0 ( % r25 ) / * r16 * /
copy % r1 ,% r16
bv % r0 ( % r25 ) / * r17 * /
copy % r1 ,% r17
bv % r0 ( % r25 ) / * r18 * /
copy % r1 ,% r18
bv % r0 ( % r25 ) / * r19 * /
copy % r1 ,% r19
bv % r0 ( % r25 ) / * r20 * /
copy % r1 ,% r20
bv % r0 ( % r25 ) / * r21 * /
copy % r1 ,% r21
bv % r0 ( % r25 ) / * r22 * /
copy % r1 ,% r22
bv % r0 ( % r25 ) / * r23 * /
copy % r1 ,% r23
bv % r0 ( % r25 ) / * r24 * /
copy % r1 ,% r24
bv % r0 ( % r25 ) / * r25 * /
copy % r1 ,% r25
bv % r0 ( % r25 ) / * r26 * /
copy % r1 ,% r26
bv % r0 ( % r25 ) / * r27 * /
copy % r1 ,% r27
bv % r0 ( % r25 ) / * r28 * /
copy % r1 ,% r28
bv % r0 ( % r25 ) / * r29 * /
copy % r1 ,% r29
bv % r0 ( % r25 ) / * r30 * /
copy % r1 ,% r30
bv % r0 ( % r25 ) / * r31 * /
copy % r1 ,% r31
2016-10-05 23:28:46 +03:00
ENDPROC_ C F I ( s e t _ r e g i s t e r )
2007-01-23 22:50:59 +03:00