2007-05-09 01:27:46 +04: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 >
/ *
* Function : v7 _ e a r l y _ a b o r t
*
2011-06-26 19:01:26 +04: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 17:35:07 +04:00
* : r5 = a b o r t e d c o n t e x t p s r
2007-05-09 01:27:46 +04:00
*
2011-06-26 19:01:26 +04:00
* Returns : r4 - r11 , r13 p r e s e r v e d
2007-05-09 01:27:46 +04: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 .
* /
.align 5
ENTRY( v7 _ e a r l y _ a b o r t )
/ *
* The e f f e c t o f d a t a a b o r t s o n o n t h e e x c l u s i v e a c c e s s m o n i t o r a r e
* UNPREDICTABLE. D o a C L R E X t o c l e a r t h e s t a t e
* /
clrex
mrc p15 , 0 , r1 , c5 , c0 , 0 @ get FSR
mrc p15 , 0 , r0 , c6 , c0 , 0 @ get FAR
/ *
* V6 c o d e a d j u s t s t h e r e t u r n e d D F S R .
* New d e s i g n s s h o u l d n o t n e e d t o p a t c h u p f a u l t s .
* /
2009-08-12 01:58:49 +04:00
# if d e f i n e d ( C O N F I G _ V E R I F Y _ P E R M I S S I O N _ F A U L T )
/ *
* Detect e r r o n e o u s p e r m i s s i o n f a i l u r e s a n d f i x
* /
ldr r3 , =0x40d @ On permission fault
and r3 , r1 , r3
cmp r3 , #0x0d
2011-06-26 19:01:26 +04:00
bne d o _ D a t a A b o r t
2009-08-12 01:58:49 +04:00
mcr p15 , 0 , r0 , c7 , c8 , 0 @ Retranslate FAR
isb
2011-06-26 17:42:02 +04:00
mrc p15 , 0 , i p , c7 , c4 , 0 @ Read the PAR
and r3 , i p , #0x7b @ On translation fault
2009-08-12 01:58:49 +04:00
cmp r3 , #0x0b
2011-06-26 19:01:26 +04:00
bne d o _ D a t a A b o r t
2009-08-12 01:58:49 +04:00
bic r1 , r1 , #0xf @ Fix up FSR FS[5:0]
2011-06-26 17:42:02 +04:00
and i p , i p , #0x7e
orr r1 , r1 , i p , L S R #1
2009-08-12 01:58:49 +04:00
# endif
2011-06-26 19:01:26 +04:00
b d o _ D a t a A b o r t
2008-08-28 14:22:32 +04:00
ENDPROC( v7 _ e a r l y _ a b o r t )