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
*
2011-06-26 16:01:26 +01:00
* Params : r2 = p t _ r e g s
* : r4 = a b o r t e d c o n t e x t p c
2011-06-26 14:35:07 +01:00
* : r5 = a b o r t e d c o n t e x t p s r
2005-04-16 15:20:36 -07:00
*
2011-06-26 16:01:26 +01:00
* Returns : r4 - r11 , r13 p r e s e r v e d
2005-04-16 15:20:36 -07:00
*
* 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 )
2011-01-17 15:35:37 +00:00
# ifdef C O N F I G _ C P U _ V 6
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
2011-01-17 15:35:37 +00:00
# elif d e f i n e d ( C O N F I G _ C P U _ 3 2 v6 K )
clrex
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
/ *
2012-04-20 17:20:08 +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 .
2005-04-29 22:08:33 +01:00
* /
2012-04-20 17:20:08 +01:00
# ifdef C O N F I G _ A R M _ E R R A T A _ 3 2 6 1 0 3
ldr i p , =0x4107b36
mrc p15 , 0 , r3 , c0 , c0 , 0 @ get processor id
teq i p , r3 , l s r #4 @ r0 ARM1136?
bne d o _ D a t a A b o r t
2011-06-26 14:35:07 +01:00
tst r5 , #P S R _ J _ B I T @ J a v a ?
2012-04-20 17:20:08 +01:00
tsteq r5 , #P S R _ T _ B I T @ T h u m b ?
2011-06-26 16:01:26 +01:00
bne d o _ D a t a A b o r t
2012-04-20 17:20:08 +01:00
bic r1 , r1 , #1 < < 1 1 @ clear bit 11 of FSR
ldr r3 , [ r4 ] @ 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
2012-04-20 17:20:08 +01:00
rev r3 , r3
2009-05-30 14:00:18 +01:00
# endif
2011-06-26 14:42:02 +01:00
do_ l d r d _ a b o r t t m p =ip , i n s n =r3
2005-04-29 22:08:33 +01:00
tst r3 , #1 < < 2 0 @ L = 0 -> write
orreq r1 , r1 , #1 < < 1 1 @ yes.
2012-04-20 17:20:08 +01:00
# endif
2011-06-26 16:01:26 +01:00
b d o _ D a t a A b o r t