2005-04-16 15:20:36 -07:00
/ *
* linux/ a r c h / a r m / l i b / i o - w r i t e s w - a r m v4 . S
*
* Copyright ( C ) 1 9 9 5 - 2 0 0 0 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 .
* /
# 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 >
.macro outword, r d
# ifndef _ _ A R M E B _ _
strh \ r d , [ r0 ]
mov \ r d , \ r d , l s r #16
strh \ r d , [ r0 ]
# else
mov l r , \ r d , l s r #16
strh l r , [ r0 ]
strh \ r d , [ r0 ]
# endif
.endm
2005-11-11 21:51:48 +00:00
.Loutsw_align : movs i p , r1 , l s l #31
bne . L o u t s w _ n o a l i g n
2005-04-16 15:20:36 -07:00
ldrh r3 , [ r1 ] , #2
sub r2 , r2 , #1
strh r3 , [ r0 ]
ENTRY( _ _ r a w _ w r i t e s w )
teq r2 , #0
moveq p c , l r
ands r3 , r1 , #3
2005-11-11 21:51:48 +00:00
bne . L o u t s w _ a l i g n
2005-04-16 15:20:36 -07:00
stmfd s p ! , { r4 , r5 , l r }
subs r2 , r2 , #8
2005-11-11 21:51:48 +00:00
bmi . L n o _ o u t s w _ 8
2005-04-16 15:20:36 -07:00
2005-11-11 21:51:48 +00:00
.Loutsw_8_lp : ldmia r1 ! , { r3 , r4 , r5 , i p }
2005-04-16 15:20:36 -07:00
subs r2 , r2 , #8
outword r3
outword r4
outword r5
outword i p
2005-11-11 21:51:48 +00:00
bpl . L o u t s w _ 8 _ l p
2005-04-16 15:20:36 -07:00
2005-11-11 21:51:48 +00:00
.Lno_outsw_8 : tst r2 , #4
beq . L n o _ o u t s w _ 4
2005-04-16 15:20:36 -07:00
ldmia r1 ! , { r3 , i p }
outword r3
outword i p
2005-11-11 21:51:48 +00:00
.Lno_outsw_4 : movs r2 , r2 , l s l #31
bcc . L n o _ o u t s w _ 2
2005-04-16 15:20:36 -07:00
ldr r3 , [ r1 ] , #4
outword r3
2005-11-11 21:51:48 +00:00
.Lno_outsw_2 : ldrneh r3 , [ r1 ]
2005-04-16 15:20:36 -07:00
strneh r3 , [ r0 ]
ldmfd s p ! , { r4 , r5 , p c }
# ifdef _ _ A R M E B _ _
# define p u l l _ h b y t e 0 l s l #8
# define p u s h _ h b y t e 1 l s r #24
# else
# define p u l l _ h b y t e 0 l s r #24
# define p u s h _ h b y t e 1 l s l #8
# endif
2005-11-11 21:51:48 +00:00
.Loutsw_noalign :
2009-07-24 12:32:57 +01:00
ARM( l d r r3 , [ r1 , - r3 ] ! )
THUMB( r s b r3 , r3 , #0 )
THUMB( l d r r3 , [ r1 , r3 ] )
THUMB( s u b r1 , r3 )
2005-04-16 15:20:36 -07:00
subcs r2 , r2 , #1
bcs 2 f
subs r2 , r2 , #2
bmi 3 f
1 : mov i p , r3 , l s r #8
strh i p , [ r0 ]
2 : mov i p , r3 , p u l l _ h b y t e 0
ldr r3 , [ r1 , #4 ] !
subs r2 , r2 , #2
orr i p , i p , r3 , p u s h _ h b y t e 1
strh i p , [ r0 ]
2005-06-08 19:00:16 +01:00
bpl 1 b
2005-04-16 15:20:36 -07:00
2005-06-08 19:00:16 +01:00
tst r2 , #1
3 : movne i p , r3 , l s r #8
2005-04-16 15:20:36 -07:00
strneh i p , [ r0 ]
mov p c , l r
2008-08-28 11:22:32 +01:00
ENDPROC( _ _ r a w _ w r i t e s w )