2006-02-06 23:44:37 -08:00
/ * sun4 v _ t l b _ m i s s . S : S u n 4 v T L B m i s s h a n d l e r s .
*
* Copyright ( C ) 2 0 0 6 < d a v e m @davemloft.net>
* /
.text
.align 32
2006-02-11 00:29:34 -08:00
/* Load ITLB fault information into VADDR and CTX, using BASE. */
# define L O A D _ I T L B _ I N F O ( B A S E , V A D D R , C T X ) \
ldx [ B A S E + H V _ F A U L T _ I _ A D D R _ O F F S E T ] , V A D D R ; \
ldx [ B A S E + H V _ F A U L T _ I _ C T X _ O F F S E T ] , C T X ;
/* Load DTLB fault information into VADDR and CTX, using BASE. */
# define L O A D _ D T L B _ I N F O ( B A S E , V A D D R , C T X ) \
ldx [ B A S E + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , V A D D R ; \
ldx [ B A S E + H V _ F A U L T _ D _ C T X _ O F F S E T ] , C T X ;
2006-02-06 23:44:37 -08:00
2006-02-17 18:01:02 -08:00
/ * DEST = ( V A D D R > > 2 2 )
2006-02-11 00:29:34 -08:00
*
2006-03-02 20:42:53 -08:00
* Branch t o Z E R O _ C T X _ L A B E L i f c o n t e x t i s z e r o .
2006-02-06 23:44:37 -08:00
* /
2006-02-17 18:01:02 -08:00
# define C O M P U T E _ T A G _ T A R G E T ( D E S T , V A D D R , C T X , Z E R O _ C T X _ L A B E L ) \
srlx V A D D R , 2 2 , D E S T ; \
2006-02-11 00:29:34 -08:00
brz,p n C T X , Z E R O _ C T X _ L A B E L ; \
2006-02-17 18:01:02 -08:00
nop;
2006-02-06 23:44:37 -08:00
/ * Create T S B p o i n t e r . T h i s i s s o m e t h i n g l i k e :
*
* index_ m a s k = ( 5 1 2 < < ( t s b _ r e g & 0 x7 U L ) ) - 1 U L ;
* tsb_ b a s e = t s b _ r e g & ~ 0 x7 U L ;
2006-03-22 00:49:59 -08:00
* tsb_ i n d e x = ( ( v a d d r > > H A S H _ S H I F T ) & t s b _ m a s k ) ;
2006-02-06 23:44:37 -08:00
* tsb_ p t r = t s b _ b a s e + ( t s b _ i n d e x * 1 6 ) ;
* /
2006-03-22 00:49:59 -08:00
# define C O M P U T E _ T S B _ P T R ( T S B _ P T R , V A D D R , H A S H _ S H I F T , T M P 1 , T M P 2 ) \
2006-02-11 00:29:34 -08:00
and T S B _ P T R , 0 x7 , T M P 1 ; \
mov 5 1 2 , T M P 2 ; \
andn T S B _ P T R , 0 x7 , T S B _ P T R ; \
sllx T M P 2 , T M P 1 , T M P 2 ; \
2006-03-22 00:49:59 -08:00
srlx V A D D R , H A S H _ S H I F T , T M P 1 ; \
2006-02-11 00:29:34 -08:00
sub T M P 2 , 1 , T M P 2 ; \
and T M P 1 , T M P 2 , T M P 1 ; \
sllx T M P 1 , 4 , T M P 1 ; \
add T S B _ P T R , T M P 1 , T S B _ P T R ;
sun4v_itlb_miss :
/* Load MMU Miss base into %g2. */
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
/* Load UTSB reg into %g1. */
mov S C R A T C H P A D _ U T S B R E G 1 , % g 1
ldxa [ % g 1 ] A S I _ S C R A T C H P A D , % g 1
LOAD_ I T L B _ I N F O ( % g 2 , % g 4 , % g 5 )
2006-02-17 18:01:02 -08:00
COMPUTE_ T A G _ T A R G E T ( % g 6 , % g 4 , % g 5 , k v m a p _ i t l b _ 4 v )
2006-03-22 00:49:59 -08:00
COMPUTE_ T S B _ P T R ( % g 1 , % g 4 , P A G E _ S H I F T , % g 3 , % g 7 )
2006-02-06 23:44:37 -08:00
/* Load TSB tag/pte into %g2/%g3 and compare the tag. */
2006-02-15 21:21:17 -08:00
ldda [ % g 1 ] A S I _ Q U A D _ L D D _ P H Y S _ 4 V , % g 2
2006-02-06 23:44:37 -08:00
cmp % g 2 , % g 6
bne,a ,p n % x c c , t s b _ m i s s _ p a g e _ t a b l e _ w a l k
mov F A U L T _ C O D E _ I T L B , % g 3
2006-03-01 22:42:18 -08:00
andcc % g 3 , _ P A G E _ E X E C _ 4 V , % g 0
2006-02-06 23:44:37 -08:00
be,a ,p n % x c c , t s b _ d o _ f a u l t
mov F A U L T _ C O D E _ I T L B , % g 3
/ * We h a v e a v a l i d e n t r y , m a k e h y p e r v i s o r c a l l t o l o a d
* I- T L B a n d r e t u r n f r o m t r a p .
*
* % g3 : PTE
* % g4 : vaddr
* /
sun4v_itlb_load :
2006-02-17 18:01:02 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 6
2006-02-06 23:44:37 -08:00
mov % o 0 , % g 1 ! s a v e % o 0
mov % o 1 , % g 2 ! s a v e % o 1
mov % o 2 , % g 5 ! s a v e % o 2
mov % o 3 , % g 7 ! s a v e % o 3
mov % g 4 , % o 0 ! v a d d r
2006-02-17 18:01:02 -08:00
ldx [ % g 6 + H V _ F A U L T _ I _ C T X _ O F F S E T ] , % o 1 ! c t x
2006-02-06 23:44:37 -08:00
mov % g 3 , % o 2 ! P T E
mov H V _ M M U _ I M M U , % o 3 ! f l a g s
ta H V _ M M U _ M A P _ A D D R _ T R A P
2006-02-17 14:58:02 -08:00
brnz,p n % o 0 , s u n 4 v _ i t l b _ e r r o r
mov % g 2 , % o 1 ! r e s t o r e % o 1
2006-02-06 23:44:37 -08:00
mov % g 1 , % o 0 ! r e s t o r e % o 0
mov % g 5 , % o 2 ! r e s t o r e % o 2
mov % g 7 , % o 3 ! r e s t o r e % o 3
retry
sun4v_dtlb_miss :
2006-02-10 15:39:51 -08:00
/* Load MMU Miss base into %g2. */
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
2006-02-06 23:44:37 -08:00
/* Load UTSB reg into %g1. */
2006-02-10 15:39:51 -08:00
mov S C R A T C H P A D _ U T S B R E G 1 , % g 1
2006-02-11 12:21:20 -08:00
ldxa [ % g 1 ] A S I _ S C R A T C H P A D , % g 1
2006-02-06 23:44:37 -08:00
2006-02-11 00:29:34 -08:00
LOAD_ D T L B _ I N F O ( % g 2 , % g 4 , % g 5 )
2006-02-17 18:01:02 -08:00
COMPUTE_ T A G _ T A R G E T ( % g 6 , % g 4 , % g 5 , k v m a p _ d t l b _ 4 v )
2006-03-22 00:49:59 -08:00
COMPUTE_ T S B _ P T R ( % g 1 , % g 4 , P A G E _ S H I F T , % g 3 , % g 7 )
2006-02-06 23:44:37 -08:00
/* Load TSB tag/pte into %g2/%g3 and compare the tag. */
2006-02-15 21:21:17 -08:00
ldda [ % g 1 ] A S I _ Q U A D _ L D D _ P H Y S _ 4 V , % g 2
2006-02-06 23:44:37 -08:00
cmp % g 2 , % g 6
bne,a ,p n % x c c , t s b _ m i s s _ p a g e _ t a b l e _ w a l k
2006-03-01 22:27:09 -08:00
mov F A U L T _ C O D E _ D T L B , % g 3
2006-02-06 23:44:37 -08:00
/ * We h a v e a v a l i d e n t r y , m a k e h y p e r v i s o r c a l l t o l o a d
* D- T L B a n d r e t u r n f r o m t r a p .
*
* % g3 : PTE
* % g4 : vaddr
* /
sun4v_dtlb_load :
2006-02-17 18:01:02 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 6
2006-02-06 23:44:37 -08:00
mov % o 0 , % g 1 ! s a v e % o 0
mov % o 1 , % g 2 ! s a v e % o 1
mov % o 2 , % g 5 ! s a v e % o 2
mov % o 3 , % g 7 ! s a v e % o 3
mov % g 4 , % o 0 ! v a d d r
2006-02-17 18:01:02 -08:00
ldx [ % g 6 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % o 1 ! c t x
2006-02-06 23:44:37 -08:00
mov % g 3 , % o 2 ! P T E
mov H V _ M M U _ D M M U , % o 3 ! f l a g s
ta H V _ M M U _ M A P _ A D D R _ T R A P
2006-02-17 14:58:02 -08:00
brnz,p n % o 0 , s u n 4 v _ d t l b _ e r r o r
mov % g 2 , % o 1 ! r e s t o r e % o 1
2006-02-06 23:44:37 -08:00
mov % g 1 , % o 0 ! r e s t o r e % o 0
mov % g 5 , % o 2 ! r e s t o r e % o 2
mov % g 7 , % o 3 ! r e s t o r e % o 3
retry
sun4v_dtlb_prot :
2006-02-17 18:01:02 -08:00
SET_ G L ( 1 )
2006-02-18 16:39:39 -08:00
/* Load MMU Miss base into %g5. */
2006-02-17 18:01:02 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 5
2006-02-06 23:44:37 -08:00
2006-02-17 18:01:02 -08:00
ldx [ % g 5 + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , % g 5
2006-02-06 23:44:37 -08:00
rdpr % t l , % g 1
cmp % g 1 , 1
2006-02-17 18:01:02 -08:00
bgu,p n % x c c , w i n f i x _ t r a m p o l i n e
mov F A U L T _ C O D E _ D T L B | F A U L T _ C O D E _ W R I T E , % g 4
2007-01-26 18:48:16 -08:00
ba,p t % x c c , s p a r c64 _ r e a l f a u l t _ c o m m o n
nop
2006-02-06 23:44:37 -08:00
2006-02-18 16:39:39 -08:00
/ * Called f r o m t r a p t a b l e :
* % g4 : vaddr
* % g5 : context
* % g6 : TAG T A R G E T
2006-02-09 16:12:22 -08:00
* /
sun4v_itsb_miss :
2006-02-11 12:21:20 -08:00
mov S C R A T C H P A D _ U T S B R E G 1 , % g 1
ldxa [ % g 1 ] A S I _ S C R A T C H P A D , % g 1
brz,p n % g 5 , k v m a p _ i t l b _ 4 v
2006-02-09 16:12:22 -08:00
mov F A U L T _ C O D E _ I T L B , % g 3
2006-02-17 14:58:02 -08:00
ba,a ,p t % x c c , s u n 4 v _ t s b _ m i s s _ c o m m o n
2006-02-09 16:12:22 -08:00
2006-02-18 16:39:39 -08:00
/ * Called f r o m t r a p t a b l e :
* % g4 : vaddr
* % g5 : context
* % g6 : TAG T A R G E T
2006-02-09 16:12:22 -08:00
* /
sun4v_dtsb_miss :
2006-02-11 12:21:20 -08:00
mov S C R A T C H P A D _ U T S B R E G 1 , % g 1
ldxa [ % g 1 ] A S I _ S C R A T C H P A D , % g 1
brz,p n % g 5 , k v m a p _ d t l b _ 4 v
mov F A U L T _ C O D E _ D T L B , % g 3
2006-02-09 16:12:22 -08:00
2006-02-18 16:39:39 -08:00
/* fallthrough */
2006-02-09 16:12:22 -08:00
sun4v_tsb_miss_common :
2006-03-22 00:49:59 -08:00
COMPUTE_ T S B _ P T R ( % g 1 , % g 4 , P A G E _ S H I F T , % g 5 , % g 7 )
2006-02-11 00:29:34 -08:00
sub % g 2 , T R A P _ P E R _ C P U _ F A U L T _ I N F O , % g 2
2006-03-22 00:49:59 -08:00
2012-10-08 16:34:29 -07:00
# if d e f i n e d ( C O N F I G _ H U G E T L B _ P A G E ) | | d e f i n e d ( C O N F I G _ T R A N S P A R E N T _ H U G E P A G E )
2006-03-22 00:49:59 -08:00
mov S C R A T C H P A D _ U T S B R E G 2 , % g 5
ldxa [ % g 5 ] A S I _ S C R A T C H P A D , % g 5
cmp % g 5 , - 1
be,p t % x c c , 8 0 f
nop
sparc64: Move from 4MB to 8MB huge pages.
The impetus for this is that we would like to move to 64-bit PMDs and
PGDs, but that would result in only supporting a 42-bit address space
with the current page table layout. It'd be nice to support at least
43-bits.
The reason we'd end up with only 42-bits after making PMDs and PGDs
64-bit is that we only use half-page sized PTE tables in order to make
PMDs line up to 4MB, the hardware huge page size we use.
So what we do here is we make huge pages 8MB, and fabricate them using
4MB hw TLB entries.
Facilitate this by providing a "REAL_HPAGE_SHIFT" which is used in
places that really need to operate on hardware 4MB pages.
Use full pages (512 entries) for PTE tables, and adjust PMD_SHIFT,
PGD_SHIFT, and the build time CPP test as needed. Use a CPP test to
make sure REAL_HPAGE_SHIFT and the _PAGE_SZHUGE_* we use match up.
This makes the pgtable cache completely unused, so remove the code
managing it and the state used in mm_context_t. Now we have less
spinlocks taken in the page table allocation path.
The technique we use to fabricate the 8MB pages is to transfer bit 22
from the missing virtual address into the PTEs physical address field.
That takes care of the transparent huge pages case.
For hugetlb, we fill things in at the PTE level and that code already
puts the sub huge page physical bits into the PTEs, based upon the
offset, so there is nothing special we need to do. It all just works
out.
So, a small amount of complexity in the THP case, but this code is
about to get much simpler when we move the 64-bit PMDs as we can move
away from the fancy 32-bit huge PMD encoding and just put a real PTE
value in there.
With bug fixes and help from Bob Picco.
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-09-25 13:48:49 -07:00
COMPUTE_ T S B _ P T R ( % g 5 , % g 4 , R E A L _ H P A G E _ S H I F T , % g 2 , % g 7 )
2006-03-22 00:49:59 -08:00
/* That clobbered %g2, reload it. */
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
sub % g 2 , T R A P _ P E R _ C P U _ F A U L T _ I N F O , % g 2
80 : stx % g 5 , [ % g 2 + T R A P _ P E R _ C P U _ T S B _ H U G E _ T E M P ]
# endif
2006-02-11 00:29:34 -08:00
ba,p t % x c c , t s b _ m i s s _ p a g e _ t a b l e _ w a l k _ s u n 4 v _ f a s t p a t h
ldx [ % g 2 + T R A P _ P E R _ C P U _ P G D _ P A D D R ] , % g 7
2006-02-09 16:12:22 -08:00
2006-02-17 14:58:02 -08:00
sun4v_itlb_error :
2014-09-16 09:26:47 -04:00
rdpr % t l , % g 1
cmp % g 1 , 1
ble,p t % i c c , s u n 4 v _ b a d _ r a
or % g 0 , F A U L T _ C O D E _ B A D _ R A | F A U L T _ C O D E _ I T L B , % g 1
2006-02-17 14:58:02 -08:00
sethi % h i ( s u n 4 v _ e r r _ i t l b _ v a d d r ) , % g 1
stx % g 4 , [ % g 1 + % l o ( s u n 4 v _ e r r _ i t l b _ v a d d r ) ]
sethi % h i ( s u n 4 v _ e r r _ i t l b _ c t x ) , % g 1
2006-02-17 18:01:02 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 6
ldx [ % g 6 + H V _ F A U L T _ I _ C T X _ O F F S E T ] , % o 1
2006-02-17 14:58:02 -08:00
stx % o 1 , [ % g 1 + % l o ( s u n 4 v _ e r r _ i t l b _ c t x ) ]
sethi % h i ( s u n 4 v _ e r r _ i t l b _ p t e ) , % g 1
stx % g 3 , [ % g 1 + % l o ( s u n 4 v _ e r r _ i t l b _ p t e ) ]
sethi % h i ( s u n 4 v _ e r r _ i t l b _ e r r o r ) , % g 1
stx % o 0 , [ % g 1 + % l o ( s u n 4 v _ e r r _ i t l b _ e r r o r ) ]
2014-09-16 09:26:47 -04:00
sethi % h i ( 1 f ) , % g 7
2006-02-17 14:58:02 -08:00
rdpr % t l , % g 4
ba,p t % x c c , e t r a p t l 1
2014-09-16 09:26:47 -04:00
1 : or % g 7 , % l o ( 1 f ) , % g 7
2008-01-17 01:32:09 -08:00
mov % l 4 , % o 1
2006-02-17 14:58:02 -08:00
call s u n 4 v _ i t l b _ e r r o r _ r e p o r t
add % s p , P T R E G S _ O F F , % o 0
/* NOTREACHED */
sun4v_dtlb_error :
2014-09-16 09:26:47 -04:00
rdpr % t l , % g 1
cmp % g 1 , 1
ble,p t % i c c , s u n 4 v _ b a d _ r a
or % g 0 , F A U L T _ C O D E _ B A D _ R A | F A U L T _ C O D E _ D T L B , % g 1
2006-02-17 14:58:02 -08:00
sethi % h i ( s u n 4 v _ e r r _ d t l b _ v a d d r ) , % g 1
stx % g 4 , [ % g 1 + % l o ( s u n 4 v _ e r r _ d t l b _ v a d d r ) ]
sethi % h i ( s u n 4 v _ e r r _ d t l b _ c t x ) , % g 1
2006-02-17 18:01:02 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 6
ldx [ % g 6 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % o 1
2006-02-17 14:58:02 -08:00
stx % o 1 , [ % g 1 + % l o ( s u n 4 v _ e r r _ d t l b _ c t x ) ]
sethi % h i ( s u n 4 v _ e r r _ d t l b _ p t e ) , % g 1
stx % g 3 , [ % g 1 + % l o ( s u n 4 v _ e r r _ d t l b _ p t e ) ]
sethi % h i ( s u n 4 v _ e r r _ d t l b _ e r r o r ) , % g 1
stx % o 0 , [ % g 1 + % l o ( s u n 4 v _ e r r _ d t l b _ e r r o r ) ]
2014-09-16 09:26:47 -04:00
sethi % h i ( 1 f ) , % g 7
2006-02-17 14:58:02 -08:00
rdpr % t l , % g 4
ba,p t % x c c , e t r a p t l 1
2014-09-16 09:26:47 -04:00
1 : or % g 7 , % l o ( 1 f ) , % g 7
2008-01-17 01:32:09 -08:00
mov % l 4 , % o 1
2006-02-17 14:58:02 -08:00
call s u n 4 v _ d t l b _ e r r o r _ r e p o r t
add % s p , P T R E G S _ O F F , % o 0
/* NOTREACHED */
2014-09-16 09:26:47 -04:00
sun4v_bad_ra :
or % g 0 , % g 4 , % g 5
ba,p t % x c c , s p a r c64 _ r e a l f a u l t _ c o m m o n
or % g 1 , % g 0 , % g 4
/* NOTREACHED */
2006-02-09 20:20:34 -08:00
/* Instruction Access Exception, tl0. */
sun4v_iacc :
2006-02-10 15:39:51 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
ldx [ % g 2 + H V _ F A U L T _ I _ T Y P E _ O F F S E T ] , % g 3
ldx [ % g 2 + H V _ F A U L T _ I _ A D D R _ O F F S E T ] , % g 4
ldx [ % g 2 + H V _ F A U L T _ I _ C T X _ O F F S E T ] , % g 5
2006-02-09 20:20:34 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 5 , % g 3 , % g 5
ba,p t % x c c , e t r a p
rd % p c , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s u n 4 v _ i n s n _ a c c e s s _ e x c e p t i o n
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 20:20:34 -08:00
/* Instruction Access Exception, tl1. */
sun4v_iacc_tl1 :
2006-02-10 15:39:51 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
ldx [ % g 2 + H V _ F A U L T _ I _ T Y P E _ O F F S E T ] , % g 3
ldx [ % g 2 + H V _ F A U L T _ I _ A D D R _ O F F S E T ] , % g 4
ldx [ % g 2 + H V _ F A U L T _ I _ C T X _ O F F S E T ] , % g 5
2006-02-09 20:20:34 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 5 , % g 3 , % g 5
ba,p t % x c c , e t r a p t l 1
rd % p c , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s u n 4 v _ i n s n _ a c c e s s _ e x c e p t i o n _ t l 1
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 20:20:34 -08:00
/* Data Access Exception, tl0. */
sun4v_dacc :
2006-02-10 15:39:51 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
ldx [ % g 2 + H V _ F A U L T _ D _ T Y P E _ O F F S E T ] , % g 3
ldx [ % g 2 + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , % g 4
ldx [ % g 2 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % g 5
2006-02-09 20:20:34 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 5 , % g 3 , % g 5
ba,p t % x c c , e t r a p
rd % p c , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s u n 4 v _ d a t a _ a c c e s s _ e x c e p t i o n
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 20:20:34 -08:00
/* Data Access Exception, tl1. */
sun4v_dacc_tl1 :
2006-02-10 15:39:51 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
ldx [ % g 2 + H V _ F A U L T _ D _ T Y P E _ O F F S E T ] , % g 3
ldx [ % g 2 + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , % g 4
ldx [ % g 2 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % g 5
2006-02-09 20:20:34 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 5 , % g 3 , % g 5
ba,p t % x c c , e t r a p t l 1
rd % p c , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call s u n 4 v _ d a t a _ a c c e s s _ e x c e p t i o n _ t l 1
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 20:20:34 -08:00
/* Memory Address Unaligned. */
sun4v_mna :
2006-02-18 16:39:39 -08:00
/* Window fixup? */
rdpr % t l , % g 2
cmp % g 2 , 1
ble,p t % i c c , 1 f
nop
SET_ G L ( 1 )
2006-03-02 20:42:53 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
ldx [ % g 2 + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , % g 5
2006-02-18 16:39:39 -08:00
mov H V _ F A U L T _ T Y P E _ U N A L I G N E D , % g 3
2006-03-02 20:42:53 -08:00
ldx [ % g 2 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % g 4
2006-02-18 16:39:39 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 4 , % g 3 , % g 4
ba,p t % x c c , w i n f i x _ m n a
rdpr % t p c , % g 3
/* not reached */
1 : ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
2006-02-09 20:20:34 -08:00
mov H V _ F A U L T _ T Y P E _ U N A L I G N E D , % g 3
2006-02-10 15:39:51 -08:00
ldx [ % g 2 + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , % g 4
ldx [ % g 2 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % g 5
2006-02-09 20:20:34 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 5 , % g 3 , % g 5
ba,p t % x c c , e t r a p
rd % p c , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
2006-02-14 16:39:22 -08:00
call s u n 4 v _ d o _ m n a
2006-02-09 20:20:34 -08:00
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 20:20:34 -08:00
/* Privileged Action. */
sun4v_privact :
ba,p t % x c c , e t r a p
rd % p c , % g 7
call d o _ p r i v a c t
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 20:20:34 -08:00
/* Unaligned ldd float, tl0. */
sun4v_lddfmna :
2006-02-10 15:39:51 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
ldx [ % g 2 + H V _ F A U L T _ D _ T Y P E _ O F F S E T ] , % g 3
ldx [ % g 2 + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , % g 4
ldx [ % g 2 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % g 5
2006-02-09 20:20:34 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 5 , % g 3 , % g 5
ba,p t % x c c , e t r a p
rd % p c , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call h a n d l e _ l d d f m n a
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 20:20:34 -08:00
/* Unaligned std float, tl0. */
sun4v_stdfmna :
2006-02-10 15:39:51 -08:00
ldxa [ % g 0 ] A S I _ S C R A T C H P A D , % g 2
ldx [ % g 2 + H V _ F A U L T _ D _ T Y P E _ O F F S E T ] , % g 3
ldx [ % g 2 + H V _ F A U L T _ D _ A D D R _ O F F S E T ] , % g 4
ldx [ % g 2 + H V _ F A U L T _ D _ C T X _ O F F S E T ] , % g 5
2006-02-09 20:20:34 -08:00
sllx % g 3 , 1 6 , % g 3
or % g 5 , % g 3 , % g 5
ba,p t % x c c , e t r a p
rd % p c , % g 7
mov % l 4 , % o 1
mov % l 5 , % o 2
call h a n d l e _ s t d f m n a
add % s p , P T R E G S _ O F F , % o 0
2008-04-24 03:15:22 -07:00
ba,a ,p t % x c c , r t r a p
2006-02-09 16:12:22 -08:00
2006-02-06 23:44:37 -08:00
# define B R A N C H _ A L W A Y S 0 x10 6 8 0 0 0 0
# define N O P 0 x01 0 0 0 0 0 0
# define S U N 4 V _ D O _ P A T C H ( O L D , N E W ) \
sethi % h i ( N E W ) , % g 1 ; \
or % g 1 , % l o ( N E W ) , % g 1 ; \
sethi % h i ( O L D ) , % g 2 ; \
or % g 2 , % l o ( O L D ) , % g 2 ; \
sub % g 1 , % g 2 , % g 1 ; \
sethi % h i ( B R A N C H _ A L W A Y S ) , % g 3 ; \
2006-02-11 12:21:20 -08:00
sll % g 1 , 1 1 , % g 1 ; \
srl % g 1 , 1 1 + 2 , % g 1 ; \
2006-02-06 23:44:37 -08:00
or % g 3 , % l o ( B R A N C H _ A L W A Y S ) , % g 3 ; \
or % g 3 , % g 1 , % g 3 ; \
stw % g 3 , [ % g 2 ] ; \
sethi % h i ( N O P ) , % g 3 ; \
or % g 3 , % l o ( N O P ) , % g 3 ; \
stw % g 3 , [ % g 2 + 0 x4 ] ; \
flush % g 2 ;
.globl sun4v_patch_tlb_handlers
.type sun4 v _ p a t c h _ t l b _ h a n d l e r s ,#f u n c t i o n
sun4v_patch_tlb_handlers :
SUN4 V _ D O _ P A T C H ( t l 0 _ i a m i s s , s u n 4 v _ i t l b _ m i s s )
SUN4 V _ D O _ P A T C H ( t l 1 _ i a m i s s , s u n 4 v _ i t l b _ m i s s )
SUN4 V _ D O _ P A T C H ( t l 0 _ d a m i s s , s u n 4 v _ d t l b _ m i s s )
SUN4 V _ D O _ P A T C H ( t l 1 _ d a m i s s , s u n 4 v _ d t l b _ m i s s )
SUN4 V _ D O _ P A T C H ( t l 0 _ d a p r o t , s u n 4 v _ d t l b _ p r o t )
SUN4 V _ D O _ P A T C H ( t l 1 _ d a p r o t , s u n 4 v _ d t l b _ p r o t )
2006-02-09 20:20:34 -08:00
SUN4 V _ D O _ P A T C H ( t l 0 _ i a x , s u n 4 v _ i a c c )
SUN4 V _ D O _ P A T C H ( t l 1 _ i a x , s u n 4 v _ i a c c _ t l 1 )
SUN4 V _ D O _ P A T C H ( t l 0 _ d a x , s u n 4 v _ d a c c )
SUN4 V _ D O _ P A T C H ( t l 1 _ d a x , s u n 4 v _ d a c c _ t l 1 )
SUN4 V _ D O _ P A T C H ( t l 0 _ m n a , s u n 4 v _ m n a )
SUN4 V _ D O _ P A T C H ( t l 1 _ m n a , s u n 4 v _ m n a )
SUN4 V _ D O _ P A T C H ( t l 0 _ l d d f m n a , s u n 4 v _ l d d f m n a )
SUN4 V _ D O _ P A T C H ( t l 0 _ s t d f m n a , s u n 4 v _ s t d f m n a )
SUN4 V _ D O _ P A T C H ( t l 0 _ p r i v a c t , s u n 4 v _ p r i v a c t )
2006-02-06 23:44:37 -08:00
retl
nop
.size sun4 v _ p a t c h _ t l b _ h a n d l e r s ,. - s u n 4 v _ p a t c h _ t l b _ h a n d l e r s