2005-04-17 02:20:36 +04:00
/ *
* linux/ a r c h / a r m / l i b / c s u m p a r t i a l c o p y u s e r . S
*
* Copyright ( C ) 1 9 9 5 - 1 9 9 8 R u s s e l l K i n g
*
* 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 v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
*
* 2 7 / 0 3 / 0 3 Ian M o l t o n C l e a n u p C O N F I G _ C P U
*
* /
# 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 >
# include < a s m / e r r n o . h >
2005-09-09 23:08:59 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-17 02:20:36 +04:00
.text
.macro save_regs
2008-08-29 21:31:27 +04:00
stmfd s p ! , { r1 , r2 , r4 - r8 , l r }
2005-04-17 02:20:36 +04:00
.endm
2006-01-12 19:53:51 +03:00
.macro load_regs
2008-08-29 21:31:27 +04:00
ldmfd s p ! , { r1 , r2 , r4 - r8 , p c }
2005-04-17 02:20:36 +04:00
.endm
.macro load1 b , r e g 1
9999 : ldrbt \ r e g 1 , [ r0 ] , $ 1
.section _ _ ex_ t a b l e , " a "
.align 3
.long 9 9 9 9 b, 6 0 0 1 f
.previous
.endm
.macro load2 b , r e g 1 , r e g 2
9999 : ldrbt \ r e g 1 , [ r0 ] , $ 1
9998 : ldrbt \ r e g 2 , [ r0 ] , $ 1
.section _ _ ex_ t a b l e , " a "
.long 9 9 9 9 b, 6 0 0 1 f
.long 9 9 9 8 b, 6 0 0 1 f
.previous
.endm
.macro load1 l , r e g 1
9999 : ldrt \ r e g 1 , [ r0 ] , $ 4
.section _ _ ex_ t a b l e , " a "
.align 3
.long 9 9 9 9 b, 6 0 0 1 f
.previous
.endm
.macro load2 l , r e g 1 , r e g 2
9999 : ldrt \ r e g 1 , [ r0 ] , $ 4
9998 : ldrt \ r e g 2 , [ r0 ] , $ 4
.section _ _ ex_ t a b l e , " a "
.long 9 9 9 9 b, 6 0 0 1 f
.long 9 9 9 8 b, 6 0 0 1 f
.previous
.endm
.macro load4 l , r e g 1 , r e g 2 , r e g 3 , r e g 4
9999 : ldrt \ r e g 1 , [ r0 ] , $ 4
9998 : ldrt \ r e g 2 , [ r0 ] , $ 4
9997 : ldrt \ r e g 3 , [ r0 ] , $ 4
9996 : ldrt \ r e g 4 , [ r0 ] , $ 4
.section _ _ ex_ t a b l e , " a "
.long 9 9 9 9 b, 6 0 0 1 f
.long 9 9 9 8 b, 6 0 0 1 f
.long 9 9 9 7 b, 6 0 0 1 f
.long 9 9 9 6 b, 6 0 0 1 f
.previous
.endm
/ *
* unsigned i n t
* csum_ p a r t i a l _ c o p y _ f r o m _ u s e r ( c o n s t c h a r * s r c , c h a r * d s t , i n t l e n , i n t s u m , i n t * e r r _ p t r )
* r0 = s r c , r1 = d s t , r2 = l e n , r3 = s u m , [ s p ] = * e r r _ p t r
* Returns : r0 = c h e c k s u m , [ [ s p , #0 ] , #0 ] = 0 o r - E F A U L T
* /
# define F N _ E N T R Y E N T R Y ( c s u m _ p a r t i a l _ c o p y _ f r o m _ u s e r )
2008-08-28 14:22:32 +04:00
# define F N _ E X I T E N D P R O C ( c s u m _ p a r t i a l _ c o p y _ f r o m _ u s e r )
2005-04-17 02:20:36 +04:00
# include " c s u m p a r t i a l c o p y g e n e r i c . S "
/ *
* FIXME : minor b u g l e t h e r e
* We d o n ' t r e t u r n t h e c h e c k s u m f o r t h e d a t a p r e s e n t i n t h e b u f f e r . T o d o
* so p r o p e r l y , w e w o u l d h a v e t o a d d i n w h a t e v e r r e g i s t e r s w e r e l o a d e d b e f o r e
* the f a u l t , w h i c h , w i t h t h e c u r r e n t a s m a b o v e i s n o t p r e d i c t a b l e .
* /
.section .fixup , " ax"
.align 4
6001 : mov r4 , #- E F A U L T
ldr r5 , [ f p , #4 ] @ *err_ptr
str r4 , [ r5 ]
ldmia s p , { r1 , r2 } @ retrieve dst, len
add r2 , r2 , r1
mov r0 , #0 @ zero the buffer
6002 : teq r2 , r1
strneb r0 , [ r1 ] , #1
bne 6 0 0 2 b
2006-01-12 19:53:51 +03:00
load_ r e g s
2005-04-17 02:20:36 +04:00
.previous