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 b . 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 _ _
strb \ r d , [ r0 ]
mov \ r d , \ r d , l s r #8
strb \ r d , [ r0 ]
mov \ r d , \ r d , l s r #8
strb \ r d , [ r0 ]
mov \ r d , \ r d , l s r #8
strb \ r d , [ r0 ]
# else
mov l r , \ r d , l s r #24
strb l r , [ r0 ]
mov l r , \ r d , l s r #16
strb l r , [ r0 ]
mov l r , \ r d , l s r #8
strb l r , [ r0 ]
strb \ r d , [ r0 ]
# endif
.endm
2005-11-11 21:51:48 +00:00
.Loutsb_align : rsb i p , i p , #4
2005-04-16 15:20:36 -07:00
cmp i p , r2
movgt i p , r2
cmp i p , #2
ldrb r3 , [ r1 ] , #1
strb r3 , [ r0 ]
ldrgeb r3 , [ r1 ] , #1
strgeb r3 , [ r0 ]
ldrgtb r3 , [ r1 ] , #1
strgtb r3 , [ r0 ]
subs r2 , r2 , i p
2005-11-11 21:51:48 +00:00
bne . L o u t s b _ a l i g n e d
2005-04-16 15:20:36 -07:00
ENTRY( _ _ r a w _ w r i t e s b )
teq r2 , #0 @ do we have to check for the zero len?
moveq p c , l r
ands i p , r1 , #3
2005-11-11 21:51:48 +00:00
bne . L o u t s b _ a l i g n
2005-04-16 15:20:36 -07:00
2005-11-11 21:51:48 +00:00
.Loutsb_aligned :
stmfd s p ! , { r4 , r5 , l r }
2005-04-16 15:20:36 -07:00
subs r2 , r2 , #16
2005-11-11 21:51:48 +00:00
bmi . L o u t s b _ n o _ 1 6
2005-04-16 15:20:36 -07:00
2005-11-11 21:51:48 +00:00
.Loutsb_16_lp : ldmia r1 ! , { r3 , r4 , r5 , i p }
2005-04-16 15:20:36 -07:00
outword r3
outword r4
outword r5
outword i p
subs r2 , r2 , #16
2005-11-11 21:51:48 +00:00
bpl . L o u t s b _ 1 6 _ l p
2005-04-16 15:20:36 -07:00
tst r2 , #15
LOADREGS( e q f d , s p ! , { r4 , r5 , p c } )
2005-11-11 21:51:48 +00:00
.Loutsb_no_16 : tst r2 , #8
beq . L o u t s b _ n o _ 8
2005-04-16 15:20:36 -07:00
ldmia r1 ! , { r3 , r4 }
outword r3
outword r4
2005-11-11 21:51:48 +00:00
.Loutsb_no_8 : tst r2 , #4
beq . L o u t s b _ n o _ 4
2005-04-16 15:20:36 -07:00
ldr r3 , [ r1 ] , #4
outword r3
2005-11-11 21:51:48 +00:00
.Loutsb_no_4 : ands r2 , r2 , #3
2005-04-16 15:20:36 -07:00
LOADREGS( e q f d , s p ! , { r4 , r5 , p c } )
cmp r2 , #2
ldrb r3 , [ r1 ] , #1
strb r3 , [ r0 ]
ldrgeb r3 , [ r1 ] , #1
strgeb r3 , [ r0 ]
ldrgtb r3 , [ r1 ]
strgtb r3 , [ r0 ]
LOADREGS( f d , s p ! , { r4 , r5 , p c } )