2005-04-16 15:20:36 -07:00
/ *
* Linux/ P A - R I S C P r o j e c t ( h t t p : / / w w w . p a r i s c - l i n u x . o r g / )
*
* Copyright ( C ) 2 0 0 4 R a n d o l p h C h u n g < t a u s q @debian.org>
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y
* the F r e e S o f t w a r e F o u n d a t i o n ; either version 2, or (at your option)
* any l a t e r v e r s i o n .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 6 7 5 M a s s A v e , C a m b r i d g e , M A 0 2 1 3 9 , U S A .
*
* Fixup r o u t i n e s f o r k e r n e l e x c e p t i o n h a n d l i n g .
* /
2005-09-09 20:57:26 +02:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-16 15:20:36 -07:00
# include < a s m / a s s e m b l y . h >
# include < a s m / e r r n o . h >
2007-01-28 14:52:57 +01:00
# include < l i n u x / l i n k a g e . h >
2005-04-16 15:20:36 -07:00
# ifdef C O N F I G _ S M P
.macro get_fault_ip t1 t 2
addil L T % _ _ p e r _ c p u _ o f f s e t ,% r27
LDREG R T % _ _ p e r _ c p u _ o f f s e t ( % r1 ) ,\ t 1
/* t2 = smp_processor_id() */
mfctl 3 0 ,\ t 2
ldw T I _ C P U ( \ t 2 ) ,\ t 2
2007-01-28 14:52:57 +01:00
# ifdef C O N F I G _ 6 4 B I T
2005-04-16 15:20:36 -07:00
extrd,u \ t 2 ,6 3 ,3 2 ,\ t 2
# endif
/* t2 = &__per_cpu_offset[smp_processor_id()]; */
2005-10-21 22:56:35 -04:00
LDREGX \ t 2 ( \ t 1 ) ,\ t 2
2009-10-29 22:34:15 +09:00
addil L T % e x c e p t i o n _ d a t a ,% r27
LDREG R T % e x c e p t i o n _ d a t a ( % r1 ) ,\ t 1
2005-04-16 15:20:36 -07:00
/* t1 = &__get_cpu_var(exception_data) */
add,l \ t 1 ,\ t 2 ,\ t 1
/* t1 = t1->fault_ip */
LDREG E X C D A T A _ I P ( \ t 1 ) , \ t 1
.endm
# else
.macro get_fault_ip t1 t 2
/* t1 = &__get_cpu_var(exception_data) */
2009-10-29 22:34:15 +09:00
addil L T % e x c e p t i o n _ d a t a ,% r27
LDREG R T % e x c e p t i o n _ d a t a ( % r1 ) ,\ t 2
2005-04-16 15:20:36 -07:00
/* t1 = t2->fault_ip */
LDREG E X C D A T A _ I P ( \ t 2 ) , \ t 1
.endm
# endif
2005-10-21 22:56:35 -04:00
.level LEVEL
2008-05-22 14:36:31 -04:00
.text
2005-04-16 15:20:36 -07:00
.section .fixup , " ax"
/* get_user() fixups, store -EFAULT in r8, and 0 in r9 */
2007-01-28 14:52:57 +01:00
ENTRY( f i x u p _ g e t _ u s e r _ s k i p _ 1 )
2005-04-16 15:20:36 -07:00
get_ f a u l t _ i p % r1 ,% r8
ldo 4 ( % r1 ) , % r1
ldi - E F A U L T , % r8
bv % r0 ( % r1 )
copy % r0 , % r9
2007-01-28 14:52:57 +01:00
ENDPROC( f i x u p _ g e t _ u s e r _ s k i p _ 1 )
2005-04-16 15:20:36 -07:00
2007-01-28 14:52:57 +01:00
ENTRY( f i x u p _ g e t _ u s e r _ s k i p _ 2 )
2005-04-16 15:20:36 -07:00
get_ f a u l t _ i p % r1 ,% r8
ldo 8 ( % r1 ) , % r1
ldi - E F A U L T , % r8
bv % r0 ( % r1 )
copy % r0 , % r9
2007-01-28 14:52:57 +01:00
ENDPROC( f i x u p _ g e t _ u s e r _ s k i p _ 2 )
2005-04-16 15:20:36 -07:00
/* put_user() fixups, store -EFAULT in r8 */
2007-01-28 14:52:57 +01:00
ENTRY( f i x u p _ p u t _ u s e r _ s k i p _ 1 )
2005-04-16 15:20:36 -07:00
get_ f a u l t _ i p % r1 ,% r8
ldo 4 ( % r1 ) , % r1
bv % r0 ( % r1 )
ldi - E F A U L T , % r8
2007-01-28 14:52:57 +01:00
ENDPROC( f i x u p _ p u t _ u s e r _ s k i p _ 1 )
2005-04-16 15:20:36 -07:00
2007-01-28 14:52:57 +01:00
ENTRY( f i x u p _ p u t _ u s e r _ s k i p _ 2 )
2005-04-16 15:20:36 -07:00
get_ f a u l t _ i p % r1 ,% r8
ldo 8 ( % r1 ) , % r1
bv % r0 ( % r1 )
ldi - E F A U L T , % r8
2007-01-28 14:52:57 +01:00
ENDPROC( f i x u p _ p u t _ u s e r _ s k i p _ 2 )