2005-04-16 15:20:36 -07:00
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
2005-04-29 22:08:33 +01:00
# include " a b o r t - m a c r o . S "
2005-04-16 15:20:36 -07:00
/ *
* Function : v6 _ e a r l y _ a b o r t
*
* Params : r2 = a d d r e s s o f a b o r t e d i n s t r u c t i o n
* : r3 = s a v e d S P S R
*
* Returns : r0 = a d d r e s s o f a b o r t
* : r1 = F S R , b i t 1 1 = w r i t e
* : r2 - r8 = c o r r u p t e d
* : r9 = p r e s e r v e d
* : sp = p o i n t e r t o r e g i s t e r s
*
* Purpose : o b t a i n i n f o r m a t i o n a b o u t c u r r e n t a b o r t e d i n s t r u c t i o n .
2005-04-29 22:08:33 +01:00
* Note : we r e a d u s e r s p a c e . T h i s m e a n s w e m i g h t c a u s e a d a t a
* abort h e r e i f t h e I - T L B a n d D - T L B a r e n ' t s e e i n g t h e s a m e
* picture. U n f o r t u n a t e l y , t h i s d o e s h a p p e n . W e l i v e w i t h i t .
2005-04-16 15:20:36 -07:00
* /
.align 5
ENTRY( v6 _ e a r l y _ a b o r t )
2006-02-22 21:13:28 +00:00
# ifdef C O N F I G _ C P U _ 3 2 v6 K
2005-10-02 22:34:35 +01:00
clrex
# else
2009-03-02 22:39:36 +01:00
sub r1 , s p , #4 @ Get unused stack location
strex r0 , r1 , [ r1 ] @ Clear the exclusive monitor
2005-10-02 22:34:35 +01:00
# endif
2005-04-16 15:20:36 -07:00
mrc p15 , 0 , r1 , c5 , c0 , 0 @ get FSR
mrc p15 , 0 , r0 , c6 , c0 , 0 @ get FAR
2005-04-29 22:08:33 +01:00
/ *
2009-04-01 13:53:48 +01:00
* Faulty S W P i n s t r u c t i o n o n 1 1 3 6 d o e s n ' t s e t b i t 1 1 i n D F S R ( e r r a t u m 3 2 6 1 0 3 ) .
2005-04-29 22:08:33 +01:00
* The t e s t b e l o w c o v e r s a l l t h e w r i t e s i t u a t i o n s , i n c l u d i n g J a v a b y t e c o d e s
* /
2009-04-01 13:53:48 +01:00
bic r1 , r1 , #1 < < 1 1 @ clear bit 11 of FSR
2005-04-29 22:08:33 +01:00
tst r3 , #P S R _ J _ B I T @ J a v a ?
movne p c , l r
do_ t h u m b _ a b o r t
ldreq r3 , [ r2 ] @ read aborted ARM instruction
2009-05-30 14:00:18 +01:00
# ifdef C O N F I G _ C P U _ E N D I A N _ B E 8
reveq r3 , r3
# endif
2005-04-29 22:08:33 +01:00
do_ l d r d _ a b o r t
tst r3 , #1 < < 2 0 @ L = 0 -> write
orreq r1 , r1 , #1 < < 1 1 @ yes.
2005-04-16 15:20:36 -07:00
mov p c , l r