2005-04-16 15:20:36 -07:00
/ * $ Id : ultra. S ,v 1 . 7 2 2 0 0 2 / 0 2 / 0 9 1 9 : 4 9 : 3 1 d a v e m E x p $
* ultra. S : D o n ' t e x p a n d t h e s e a l l o v e r t h e p l a c e . . .
*
* Copyright ( C ) 1 9 9 7 , 2 0 0 0 D a v i d S . M i l l e r ( d a v e m @redhat.com)
* /
# include < l i n u x / c o n f i g . h >
# include < a s m / a s i . h >
# include < a s m / p g t a b l e . h >
# include < a s m / p a g e . h >
# include < a s m / s p i t f i r e . h >
# include < a s m / m m u _ c o n t e x t . h >
2005-08-30 20:21:34 -07:00
# include < a s m / m m u . h >
2005-04-16 15:20:36 -07:00
# include < a s m / p i l . h >
# include < a s m / h e a d . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / c a c h e f l u s h . h >
/ * Basically, m o s t o f t h e S p i t f i r e v s . C h e e t a h m a d n e s s
* has t o d o w i t h t h e f a c t t h a t C h e e t a h d o e s n o t s u p p o r t
* IMMU f l u s h e s o u t o f t h e s e c o n d a r y c o n t e x t . S o m e o n e n e e d s
* to t h r o w a s o u t h l a k e b i r t h d a y p a r t y f o r t h e f o l k s
* in M i c r o e l e c t r o n i c s w h o r e f u s e d t o f i x t h i s s h i t .
* /
/ * This f i l e i s m e a n t t o b e r e a d e f f i c i e n t l y b y t h e C P U , n o t h u m a n s .
* Staraj s i e t e g o n i k o m u n i e p i e r d o l n a c . . .
* /
.text
.align 32
.globl __flush_tlb_mm
__flush_tlb_mm : /* %o0=(ctx & TAG_CONTEXT_BITS), %o1=SECONDARY_CONTEXT */
ldxa [ % o 1 ] A S I _ D M M U , % g 2
cmp % g 2 , % o 0
bne,p n % i c c , _ _ s p i t f i r e _ f l u s h _ t l b _ m m _ s l o w
mov 0 x50 , % g 3
stxa % g 0 , [ % g 3 ] A S I _ D M M U _ D E M A P
stxa % g 0 , [ % g 3 ] A S I _ I M M U _ D E M A P
retl
flush % g 6
nop
nop
nop
nop
nop
nop
nop
nop
2005-08-30 20:21:34 -07:00
nop
nop
2005-04-16 15:20:36 -07:00
.align 32
.globl __flush_tlb_pending
__flush_tlb_pending :
/* %o0 = context, %o1 = nr, %o2 = vaddrs[] */
rdpr % p s t a t e , % g 7
sllx % o 1 , 3 , % o 1
andn % g 7 , P S T A T E _ I E , % g 2
wrpr % g 2 , % p s t a t e
mov S E C O N D A R Y _ C O N T E X T , % o 4
ldxa [ % o 4 ] A S I _ D M M U , % g 2
stxa % o 0 , [ % o 4 ] A S I _ D M M U
1 : sub % o 1 , ( 1 < < 3 ) , % o 1
ldx [ % o 2 + % o 1 ] , % o 3
andcc % o 3 , 1 , % g 0
andn % o 3 , 1 , % o 3
be,p n % i c c , 2 f
or % o 3 , 0 x10 , % o 3
stxa % g 0 , [ % o 3 ] A S I _ I M M U _ D E M A P
2 : stxa % g 0 , [ % o 3 ] A S I _ D M M U _ D E M A P
membar #S y n c
brnz,p t % o 1 , 1 b
nop
stxa % g 2 , [ % o 4 ] A S I _ D M M U
flush % g 6
retl
wrpr % g 7 , 0 x0 , % p s t a t e
2005-07-05 19:45:24 -07:00
nop
2005-08-30 20:21:34 -07:00
nop
nop
nop
2005-04-16 15:20:36 -07:00
.align 32
.globl __flush_tlb_kernel_range
__flush_tlb_kernel_range : /* %o0=start, %o1=end */
cmp % o 0 , % o 1
be,p n % x c c , 2 f
sethi % h i ( P A G E _ S I Z E ) , % o 4
sub % o 1 , % o 0 , % o 3
sub % o 3 , % o 4 , % o 3
or % o 0 , 0 x20 , % o 0 ! N u c l e u s
1 : stxa % g 0 , [ % o 0 + % o 3 ] A S I _ D M M U _ D E M A P
stxa % g 0 , [ % o 0 + % o 3 ] A S I _ I M M U _ D E M A P
membar #S y n c
brnz,p t % o 3 , 1 b
sub % o 3 , % o 4 , % o 3
2 : retl
flush % g 6
__spitfire_flush_tlb_mm_slow :
rdpr % p s t a t e , % g 1
wrpr % g 1 , P S T A T E _ I E , % p s t a t e
stxa % o 0 , [ % o 1 ] A S I _ D M M U
stxa % g 0 , [ % g 3 ] A S I _ D M M U _ D E M A P
stxa % g 0 , [ % g 3 ] A S I _ I M M U _ D E M A P
flush % g 6
stxa % g 2 , [ % o 1 ] A S I _ D M M U
flush % g 6
retl
wrpr % g 1 , 0 , % p s t a t e
/ *
* The f o l l o w i n g c o d e f l u s h e s o n e p a g e _ s i z e w o r t h .
* /
# if ( P A G E _ S H I F T = = 1 3 )
# define I T A G _ M A S K 0 x f e
# elif ( P A G E _ S H I F T = = 1 6 )
# define I T A G _ M A S K 0 x7 f e
# else
# error u n s u p p o r t e d P A G E _ S I Z E
# endif
2005-09-06 15:19:31 -07:00
.section .kprobes .text , " ax"
2005-04-16 15:20:36 -07:00
.align 32
.globl __flush_icache_page
__flush_icache_page : /* %o0 = phys_page */
membar #S t o r e S t o r e
srlx % o 0 , P A G E _ S H I F T , % o 0
sethi % u h i ( P A G E _ O F F S E T ) , % g 1
sllx % o 0 , P A G E _ S H I F T , % o 0
sethi % h i ( P A G E _ S I Z E ) , % g 2
sllx % g 1 , 3 2 , % g 1
add % o 0 , % g 1 , % o 0
1 : subcc % g 2 , 3 2 , % g 2
bne,p t % i c c , 1 b
flush % o 0 + % g 2
retl
nop
# ifdef D C A C H E _ A L I A S I N G _ P O S S I B L E
# if ( P A G E _ S H I F T ! = 1 3 )
# error o n l y p a g e s h i f t o f 1 3 i s s u p p o r t e d b y d c a c h e f l u s h
# endif
# define D T A G _ M A S K 0 x3
2005-09-26 16:06:03 -07:00
/ * This r o u t i n e i s S p i t f i r e s p e c i f i c s o t h e h a r d c o d e d
* D- c a c h e s i z e a n d l i n e - s i z e a r e O K .
* /
2005-04-16 15:20:36 -07:00
.align 64
.globl __flush_dcache_page
__flush_dcache_page : /* %o0=kaddr, %o1=flush_icache */
sethi % u h i ( P A G E _ O F F S E T ) , % g 1
sllx % g 1 , 3 2 , % g 1
2005-09-26 16:06:03 -07:00
sub % o 0 , % g 1 , % o 0 ! p h y s i c a l a d d r e s s
srlx % o 0 , 1 1 , % o 0 ! m a k e D - c a c h e T A G
sethi % h i ( 1 < < 1 4 ) , % o 2 ! D - c a c h e s i z e
sub % o 2 , ( 1 < < 5 ) , % o 2 ! D - c a c h e l i n e s i z e
1 : ldxa [ % o 2 ] A S I _ D C A C H E _ T A G , % o 3 ! l o a d D - c a c h e T A G
andcc % o 3 , D T A G _ M A S K , % g 0 ! V a l i d ?
be,p n % x c c , 2 f ! N o p e , b r a n c h
andn % o 3 , D T A G _ M A S K , % o 3 ! C l e a r v a l i d b i t s
cmp % o 3 , % o 0 ! T A G m a t c h ?
bne,p t % x c c , 2 f ! N o p e , b r a n c h
nop
stxa % g 0 , [ % o 2 ] A S I _ D C A C H E _ T A G ! I n v a l i d a t e T A G
membar #S y n c
2 : brnz,p t % o 2 , 1 b
sub % o 2 , ( 1 < < 5 ) , % o 2 ! D - c a c h e l i n e s i z e
2005-04-16 15:20:36 -07:00
/ * The I - c a c h e d o e s n o t s n o o p l o c a l s t o r e s s o w e
* better f l u s h t h a t t o o w h e n n e c e s s a r y .
* /
brnz,p t % o 1 , _ _ f l u s h _ i c a c h e _ p a g e
sllx % o 0 , 1 1 , % o 0
retl
nop
# endif / * D C A C H E _ A L I A S I N G _ P O S S I B L E * /
2005-09-26 16:06:03 -07:00
.previous
2005-08-30 20:21:34 -07:00
/* Cheetah specific versions, patched at boot time. */
__cheetah_flush_tlb_mm : /* 18 insns */
2005-04-16 15:20:36 -07:00
rdpr % p s t a t e , % g 7
andn % g 7 , P S T A T E _ I E , % g 2
wrpr % g 2 , 0 x0 , % p s t a t e
wrpr % g 0 , 1 , % t l
mov P R I M A R Y _ C O N T E X T , % o 2
mov 0 x40 , % g 3
ldxa [ % o 2 ] A S I _ D M M U , % g 2
2005-08-30 20:21:34 -07:00
srlx % g 2 , C T X _ P G S Z 1 _ N U C _ S H I F T , % o 1
sllx % o 1 , C T X _ P G S Z 1 _ N U C _ S H I F T , % o 1
or % o 0 , % o 1 , % o 0 / * P r e s e r v e n u c l e u s p a g e s i z e f i e l d s * /
2005-04-16 15:20:36 -07:00
stxa % o 0 , [ % o 2 ] A S I _ D M M U
stxa % g 0 , [ % g 3 ] A S I _ D M M U _ D E M A P
stxa % g 0 , [ % g 3 ] A S I _ I M M U _ D E M A P
stxa % g 2 , [ % o 2 ] A S I _ D M M U
flush % g 6
wrpr % g 0 , 0 , % t l
retl
wrpr % g 7 , 0 x0 , % p s t a t e
2005-08-30 20:21:34 -07:00
__cheetah_flush_tlb_pending : /* 26 insns */
2005-04-16 15:20:36 -07:00
/* %o0 = context, %o1 = nr, %o2 = vaddrs[] */
rdpr % p s t a t e , % g 7
sllx % o 1 , 3 , % o 1
andn % g 7 , P S T A T E _ I E , % g 2
wrpr % g 2 , 0 x0 , % p s t a t e
wrpr % g 0 , 1 , % t l
mov P R I M A R Y _ C O N T E X T , % o 4
ldxa [ % o 4 ] A S I _ D M M U , % g 2
2005-08-30 20:21:34 -07:00
srlx % g 2 , C T X _ P G S Z 1 _ N U C _ S H I F T , % o 3
sllx % o 3 , C T X _ P G S Z 1 _ N U C _ S H I F T , % o 3
or % o 0 , % o 3 , % o 0 / * P r e s e r v e n u c l e u s p a g e s i z e f i e l d s * /
2005-04-16 15:20:36 -07:00
stxa % o 0 , [ % o 4 ] A S I _ D M M U
1 : sub % o 1 , ( 1 < < 3 ) , % o 1
ldx [ % o 2 + % o 1 ] , % o 3
andcc % o 3 , 1 , % g 0
be,p n % i c c , 2 f
andn % o 3 , 1 , % o 3
stxa % g 0 , [ % o 3 ] A S I _ I M M U _ D E M A P
2 : stxa % g 0 , [ % o 3 ] A S I _ D M M U _ D E M A P
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-27 15:42:04 -07:00
membar #S y n c
2005-04-16 15:20:36 -07:00
brnz,p t % o 1 , 1 b
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-27 15:42:04 -07:00
nop
2005-04-16 15:20:36 -07:00
stxa % g 2 , [ % o 4 ] A S I _ D M M U
flush % g 6
wrpr % g 0 , 0 , % t l
retl
wrpr % g 7 , 0 x0 , % p s t a t e
# ifdef D C A C H E _ A L I A S I N G _ P O S S I B L E
2005-09-26 16:06:03 -07:00
__cheetah_flush_dcache_page : /* 11 insns */
2005-04-16 15:20:36 -07:00
sethi % u h i ( P A G E _ O F F S E T ) , % g 1
sllx % g 1 , 3 2 , % g 1
sub % o 0 , % g 1 , % o 0
sethi % h i ( P A G E _ S I Z E ) , % o 4
1 : subcc % o 4 , ( 1 < < 5 ) , % o 4
stxa % g 0 , [ % o 0 + % o 4 ] A S I _ D C A C H E _ I N V A L I D A T E
membar #S y n c
bne,p t % i c c , 1 b
nop
retl / * I - c a c h e f l u s h n e v e r n e e d e d o n C h e e t a h , s e e c a l l e r s . * /
nop
# endif / * D C A C H E _ A L I A S I N G _ P O S S I B L E * /
cheetah_patch_one :
1 : lduw [ % o 1 ] , % g 1
stw % g 1 , [ % o 0 ]
flush % o 0
subcc % o 2 , 1 , % o 2
add % o 1 , 4 , % o 1
bne,p t % i c c , 1 b
add % o 0 , 4 , % o 0
retl
nop
.globl cheetah_patch_cachetlbops
cheetah_patch_cachetlbops :
save % s p , - 1 2 8 , % s p
sethi % h i ( _ _ f l u s h _ t l b _ m m ) , % o 0
or % o 0 , % l o ( _ _ f l u s h _ t l b _ m m ) , % o 0
sethi % h i ( _ _ c h e e t a h _ f l u s h _ t l b _ m m ) , % o 1
or % o 1 , % l o ( _ _ c h e e t a h _ f l u s h _ t l b _ m m ) , % o 1
call c h e e t a h _ p a t c h _ o n e
2005-08-30 20:21:34 -07:00
mov 1 8 , % o 2
2005-04-16 15:20:36 -07:00
sethi % h i ( _ _ f l u s h _ t l b _ p e n d i n g ) , % o 0
or % o 0 , % l o ( _ _ f l u s h _ t l b _ p e n d i n g ) , % o 0
sethi % h i ( _ _ c h e e t a h _ f l u s h _ t l b _ p e n d i n g ) , % o 1
or % o 1 , % l o ( _ _ c h e e t a h _ f l u s h _ t l b _ p e n d i n g ) , % o 1
call c h e e t a h _ p a t c h _ o n e
2005-08-30 20:21:34 -07:00
mov 2 6 , % o 2
2005-04-16 15:20:36 -07:00
# ifdef D C A C H E _ A L I A S I N G _ P O S S I B L E
sethi % h i ( _ _ f l u s h _ d c a c h e _ p a g e ) , % o 0
or % o 0 , % l o ( _ _ f l u s h _ d c a c h e _ p a g e ) , % o 0
2005-09-26 16:06:03 -07:00
sethi % h i ( _ _ c h e e t a h _ f l u s h _ d c a c h e _ p a g e ) , % o 1
or % o 1 , % l o ( _ _ c h e e t a h _ f l u s h _ d c a c h e _ p a g e ) , % o 1
2005-04-16 15:20:36 -07:00
call c h e e t a h _ p a t c h _ o n e
mov 1 1 , % o 2
# endif / * D C A C H E _ A L I A S I N G _ P O S S I B L E * /
ret
restore
# ifdef C O N F I G _ S M P
/ * These a r e a l l c a l l e d b y t h e s l a v e s o f a c r o s s c a l l , a t
* trap l e v e l 1 , w i t h i n t e r r u p t s f u l l y d i s a b l e d .
*
* Register u s a g e :
* % g5 m m - > c o n t e x t ( a l l t l b f l u s h e s )
* % g1 a d d r e s s a r g 1 ( t l b p a g e a n d r a n g e f l u s h e s )
* % g7 a d d r e s s a r g 2 ( t l b r a n g e f l u s h o n l y )
*
* % g6 i v e c t o r t a b l e , d o n ' t t o u c h
* % g2 s c r a t c h 1
* % g3 s c r a t c h 2
* % g4 s c r a t c h 3
*
* TODO : Make x c a l l T L B r a n g e f l u s h e s u s e t h e t r i c k s a b o v e . . . - D a v e M
* /
.align 32
.globl xcall_flush_tlb_mm
xcall_flush_tlb_mm :
mov P R I M A R Y _ C O N T E X T , % g 2
ldxa [ % g 2 ] A S I _ D M M U , % g 3
2005-08-30 20:21:34 -07:00
srlx % g 3 , C T X _ P G S Z 1 _ N U C _ S H I F T , % g 4
sllx % g 4 , C T X _ P G S Z 1 _ N U C _ S H I F T , % g 4
or % g 5 , % g 4 , % g 5 / * P r e s e r v e n u c l e u s p a g e s i z e f i e l d s * /
2005-04-16 15:20:36 -07:00
stxa % g 5 , [ % g 2 ] A S I _ D M M U
2005-08-30 20:21:34 -07:00
mov 0 x40 , % g 4
2005-04-16 15:20:36 -07:00
stxa % g 0 , [ % g 4 ] A S I _ D M M U _ D E M A P
stxa % g 0 , [ % g 4 ] A S I _ I M M U _ D E M A P
stxa % g 3 , [ % g 2 ] A S I _ D M M U
retry
.globl xcall_flush_tlb_pending
xcall_flush_tlb_pending :
/* %g5=context, %g1=nr, %g7=vaddrs[] */
sllx % g 1 , 3 , % g 1
mov P R I M A R Y _ C O N T E X T , % g 4
ldxa [ % g 4 ] A S I _ D M M U , % g 2
2005-08-30 20:21:34 -07:00
srlx % g 2 , C T X _ P G S Z 1 _ N U C _ S H I F T , % g 4
sllx % g 4 , C T X _ P G S Z 1 _ N U C _ S H I F T , % g 4
or % g 5 , % g 4 , % g 5
mov P R I M A R Y _ C O N T E X T , % g 4
2005-04-16 15:20:36 -07:00
stxa % g 5 , [ % g 4 ] A S I _ D M M U
1 : sub % g 1 , ( 1 < < 3 ) , % g 1
ldx [ % g 7 + % g 1 ] , % g 5
andcc % g 5 , 0 x1 , % g 0
be,p n % i c c , 2 f
andn % g 5 , 0 x1 , % g 5
stxa % g 0 , [ % g 5 ] A S I _ I M M U _ D E M A P
2 : stxa % g 0 , [ % g 5 ] A S I _ D M M U _ D E M A P
membar #S y n c
brnz,p t % g 1 , 1 b
nop
stxa % g 2 , [ % g 4 ] A S I _ D M M U
retry
.globl xcall_flush_tlb_kernel_range
xcall_flush_tlb_kernel_range :
sethi % h i ( P A G E _ S I Z E - 1 ) , % g 2
or % g 2 , % l o ( P A G E _ S I Z E - 1 ) , % g 2
andn % g 1 , % g 2 , % g 1
andn % g 7 , % g 2 , % g 7
sub % g 7 , % g 1 , % g 3
add % g 2 , 1 , % g 2
sub % g 3 , % g 2 , % g 3
or % g 1 , 0 x20 , % g 1 ! N u c l e u s
1 : stxa % g 0 , [ % g 1 + % g 3 ] A S I _ D M M U _ D E M A P
stxa % g 0 , [ % g 1 + % g 3 ] A S I _ I M M U _ D E M A P
membar #S y n c
brnz,p t % g 3 , 1 b
sub % g 3 , % g 2 , % g 3
retry
nop
nop
/ * This r u n s i n a v e r y c o n t r o l l e d e n v i r o n m e n t , s o w e d o
* not n e e d t o w o r r y a b o u t B H r a c e s e t c .
* /
.globl xcall_sync_tick
xcall_sync_tick :
rdpr % p s t a t e , % g 2
wrpr % g 2 , P S T A T E _ I G | P S T A T E _ A G , % p s t a t e
rdpr % p i l , % g 2
wrpr % g 0 , 1 5 , % p i l
sethi % h i ( 1 0 9 f ) , % g 7
b,p t % x c c , e t r a p _ i r q
109 : or % g 7 , % l o ( 1 0 9 b ) , % g 7
call s m p _ s y n c h r o n i z e _ t i c k _ c l i e n t
nop
clr % l 6
b r t r a p _ x c a l l
ldx [ % s p + P T R E G S _ O F F + P T _ V 9 _ T S T A T E ] , % l 1
/ * NOTE : This i s S P E C I A L ! ! W e d o e t r a p / r t r a p h o w e v e r
* we c h o o s e t o d e a l w i t h t h e " B H ' s r u n w i t h
* % pil= =15 " p r o b l e m ( d e s c r i b e d i n a s m / p i l . h )
* by j u s t i n v o k i n g r t r a p d i r e c t l y p a s t w h e r e
* BH' s a r e c h e c k e d f o r .
*
* We d o i t l i k e t h i s b e c a u s e w e d o n o t w a n t % p i l = =15
* lockups t o p r e v e n t r e g s b e i n g r e p o r t e d .
* /
.globl xcall_report_regs
xcall_report_regs :
rdpr % p s t a t e , % g 2
wrpr % g 2 , P S T A T E _ I G | P S T A T E _ A G , % p s t a t e
rdpr % p i l , % g 2
wrpr % g 0 , 1 5 , % p i l
sethi % h i ( 1 0 9 f ) , % g 7
b,p t % x c c , e t r a p _ i r q
109 : or % g 7 , % l o ( 1 0 9 b ) , % g 7
call _ _ s h o w _ r e g s
add % s p , P T R E G S _ O F F , % o 0
clr % l 6
/* Has to be a non-v9 branch due to the large distance. */
b r t r a p _ x c a l l
ldx [ % s p + P T R E G S _ O F F + P T _ V 9 _ T S T A T E ] , % l 1
# ifdef D C A C H E _ A L I A S I N G _ P O S S I B L E
.align 32
.globl xcall_flush_dcache_page_cheetah
xcall_flush_dcache_page_cheetah : /* %g1 == physical page address */
sethi % h i ( P A G E _ S I Z E ) , % g 3
1 : subcc % g 3 , ( 1 < < 5 ) , % g 3
stxa % g 0 , [ % g 1 + % g 3 ] A S I _ D C A C H E _ I N V A L I D A T E
membar #S y n c
bne,p t % i c c , 1 b
nop
retry
nop
# endif / * D C A C H E _ A L I A S I N G _ P O S S I B L E * /
.globl xcall_flush_dcache_page_spitfire
xcall_flush_dcache_page_spitfire : / * % g1 = = p h y s i c a l p a g e a d d r e s s
% g7 = = k e r n e l p a g e v i r t u a l a d d r e s s
% g5 = = ( p a g e - > m a p p i n g ! = N U L L ) * /
# ifdef D C A C H E _ A L I A S I N G _ P O S S I B L E
srlx % g 1 , ( 1 3 - 2 ) , % g 1 ! F o r m t a g c o m p a r i t o r
sethi % h i ( L 1 D C A C H E _ S I Z E ) , % g 3 ! D $ s i z e = = 1 6 K
sub % g 3 , ( 1 < < 5 ) , % g 3 ! D $ l i n e s i z e = = 3 2
1 : ldxa [ % g 3 ] A S I _ D C A C H E _ T A G , % g 2
andcc % g 2 , 0 x3 , % g 0
be,p n % x c c , 2 f
andn % g 2 , 0 x3 , % g 2
cmp % g 2 , % g 1
bne,p t % x c c , 2 f
nop
stxa % g 0 , [ % g 3 ] A S I _ D C A C H E _ T A G
membar #S y n c
2 : cmp % g 3 , 0
bne,p t % x c c , 1 b
sub % g 3 , ( 1 < < 5 ) , % g 3
brz,p n % g 5 , 2 f
# endif / * D C A C H E _ A L I A S I N G _ P O S S I B L E * /
sethi % h i ( P A G E _ S I Z E ) , % g 3
1 : flush % g 7
subcc % g 3 , ( 1 < < 5 ) , % g 3
bne,p t % i c c , 1 b
add % g 7 , ( 1 < < 5 ) , % g 7
2 : retry
nop
nop
.data
errata32_hwbug :
.xword 0
.text
/* These two are not performance critical... */
.globl xcall_flush_tlb_all_spitfire
xcall_flush_tlb_all_spitfire :
/* Spitfire Errata #32 workaround. */
sethi % h i ( e r r a t a32 _ h w b u g ) , % g 4
stx % g 0 , [ % g 4 + % l o ( e r r a t a32 _ h w b u g ) ]
clr % g 2
clr % g 3
1 : ldxa [ % g 3 ] A S I _ D T L B _ D A T A _ A C C E S S , % g 4
and % g 4 , _ P A G E _ L , % g 5
brnz,p n % g 5 , 2 f
mov T L B _ T A G _ A C C E S S , % g 7
stxa % g 0 , [ % g 7 ] A S I _ D M M U
membar #S y n c
stxa % g 0 , [ % g 3 ] A S I _ D T L B _ D A T A _ A C C E S S
membar #S y n c
/* Spitfire Errata #32 workaround. */
sethi % h i ( e r r a t a32 _ h w b u g ) , % g 4
stx % g 0 , [ % g 4 + % l o ( e r r a t a32 _ h w b u g ) ]
2 : ldxa [ % g 3 ] A S I _ I T L B _ D A T A _ A C C E S S , % g 4
and % g 4 , _ P A G E _ L , % g 5
brnz,p n % g 5 , 2 f
mov T L B _ T A G _ A C C E S S , % g 7
stxa % g 0 , [ % g 7 ] A S I _ I M M U
membar #S y n c
stxa % g 0 , [ % g 3 ] A S I _ I T L B _ D A T A _ A C C E S S
membar #S y n c
/* Spitfire Errata #32 workaround. */
sethi % h i ( e r r a t a32 _ h w b u g ) , % g 4
stx % g 0 , [ % g 4 + % l o ( e r r a t a32 _ h w b u g ) ]
2 : add % g 2 , 1 , % g 2
cmp % g 2 , S P I T F I R E _ H I G H E S T _ L O C K E D _ T L B E N T
ble,p t % i c c , 1 b
sll % g 2 , 3 , % g 3
flush % g 6
retry
.globl xcall_flush_tlb_all_cheetah
xcall_flush_tlb_all_cheetah :
mov 0 x80 , % g 2
stxa % g 0 , [ % g 2 ] A S I _ D M M U _ D E M A P
stxa % g 0 , [ % g 2 ] A S I _ I M M U _ D E M A P
retry
/* These just get rescheduled to PIL vectors. */
.globl xcall_call_function
xcall_call_function :
wr % g 0 , ( 1 < < P I L _ S M P _ C A L L _ F U N C ) , % s e t _ s o f t i n t
retry
.globl xcall_receive_signal
xcall_receive_signal :
wr % g 0 , ( 1 < < P I L _ S M P _ R E C E I V E _ S I G N A L ) , % s e t _ s o f t i n t
retry
.globl xcall_capture
xcall_capture :
wr % g 0 , ( 1 < < P I L _ S M P _ C A P T U R E ) , % s e t _ s o f t i n t
retry
# endif / * C O N F I G _ S M P * /