2005-04-17 02:20:36 +04:00
/ *
* linux/ a r c h / a r m / l i b / i o - r e a d 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 >
2005-11-12 00:51:48 +03:00
.Linsb_align : rsb i p , i p , #4
2005-04-17 02:20:36 +04:00
cmp i p , r2
movgt i p , r2
cmp i p , #2
ldrb r3 , [ r0 ]
strb r3 , [ r1 ] , #1
ldrgeb r3 , [ r0 ]
strgeb r3 , [ r1 ] , #1
ldrgtb r3 , [ r0 ]
strgtb r3 , [ r1 ] , #1
subs r2 , r2 , i p
2005-11-12 00:51:48 +03:00
bne . L i n s b _ a l i g n e d
2005-04-17 02:20:36 +04:00
ENTRY( _ _ r a w _ r e a d 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-12 00:51:48 +03:00
bne . L i n s b _ a l i g n
2005-04-17 02:20:36 +04:00
2005-11-12 00:51:48 +03:00
.Linsb_aligned : stmfd s p ! , { r4 - r6 , l r }
2005-04-17 02:20:36 +04:00
subs r2 , r2 , #16
2005-11-12 00:51:48 +03:00
bmi . L i n s b _ n o _ 1 6
2005-04-17 02:20:36 +04:00
2005-11-12 00:51:48 +03:00
.Linsb_16_lp : ldrb r3 , [ r0 ]
2005-04-17 02:20:36 +04:00
ldrb r4 , [ r0 ]
ldrb r5 , [ r0 ]
mov r3 , r3 , p u t _ b y t e _ 0
ldrb r6 , [ r0 ]
orr r3 , r3 , r4 , p u t _ b y t e _ 1
ldrb r4 , [ r0 ]
orr r3 , r3 , r5 , p u t _ b y t e _ 2
ldrb r5 , [ r0 ]
orr r3 , r3 , r6 , p u t _ b y t e _ 3
ldrb r6 , [ r0 ]
mov r4 , r4 , p u t _ b y t e _ 0
ldrb i p , [ r0 ]
orr r4 , r4 , r5 , p u t _ b y t e _ 1
ldrb r5 , [ r0 ]
orr r4 , r4 , r6 , p u t _ b y t e _ 2
ldrb r6 , [ r0 ]
orr r4 , r4 , i p , p u t _ b y t e _ 3
ldrb i p , [ r0 ]
mov r5 , r5 , p u t _ b y t e _ 0
ldrb l r , [ r0 ]
orr r5 , r5 , r6 , p u t _ b y t e _ 1
ldrb r6 , [ r0 ]
orr r5 , r5 , i p , p u t _ b y t e _ 2
ldrb i p , [ r0 ]
orr r5 , r5 , l r , p u t _ b y t e _ 3
ldrb l r , [ r0 ]
mov r6 , r6 , p u t _ b y t e _ 0
orr r6 , r6 , i p , p u t _ b y t e _ 1
ldrb i p , [ r0 ]
orr r6 , r6 , l r , p u t _ b y t e _ 2
orr r6 , r6 , i p , p u t _ b y t e _ 3
stmia r1 ! , { r3 - r6 }
subs r2 , r2 , #16
2005-11-12 00:51:48 +03:00
bpl . L i n s b _ 1 6 _ l p
2005-04-17 02:20:36 +04:00
tst r2 , #15
2006-06-25 14:23:45 +04:00
ldmeqfd s p ! , { r4 - r6 , p c }
2005-04-17 02:20:36 +04:00
2005-11-12 00:51:48 +03:00
.Linsb_no_16 : tst r2 , #8
beq . L i n s b _ n o _ 8
2005-04-17 02:20:36 +04:00
ldrb r3 , [ r0 ]
ldrb r4 , [ r0 ]
ldrb r5 , [ r0 ]
mov r3 , r3 , p u t _ b y t e _ 0
ldrb r6 , [ r0 ]
orr r3 , r3 , r4 , p u t _ b y t e _ 1
ldrb r4 , [ r0 ]
orr r3 , r3 , r5 , p u t _ b y t e _ 2
ldrb r5 , [ r0 ]
orr r3 , r3 , r6 , p u t _ b y t e _ 3
ldrb r6 , [ r0 ]
mov r4 , r4 , p u t _ b y t e _ 0
ldrb i p , [ r0 ]
orr r4 , r4 , r5 , p u t _ b y t e _ 1
orr r4 , r4 , r6 , p u t _ b y t e _ 2
orr r4 , r4 , i p , p u t _ b y t e _ 3
stmia r1 ! , { r3 , r4 }
2005-11-12 00:51:48 +03:00
.Linsb_no_8 : tst r2 , #4
beq . L i n s b _ n o _ 4
2005-04-17 02:20:36 +04:00
ldrb r3 , [ r0 ]
ldrb r4 , [ r0 ]
ldrb r5 , [ r0 ]
ldrb r6 , [ r0 ]
mov r3 , r3 , p u t _ b y t e _ 0
orr r3 , r3 , r4 , p u t _ b y t e _ 1
orr r3 , r3 , r5 , p u t _ b y t e _ 2
orr r3 , r3 , r6 , p u t _ b y t e _ 3
str r3 , [ r1 ] , #4
2005-11-12 00:51:48 +03:00
.Linsb_no_4 : ands r2 , r2 , #3
2006-06-25 14:23:45 +04:00
ldmeqfd s p ! , { r4 - r6 , p c }
2005-04-17 02:20:36 +04:00
cmp r2 , #2
ldrb r3 , [ r0 ]
strb r3 , [ r1 ] , #1
ldrgeb r3 , [ r0 ]
strgeb r3 , [ r1 ] , #1
ldrgtb r3 , [ r0 ]
strgtb r3 , [ r1 ]
2006-06-25 14:23:45 +04:00
ldmfd s p ! , { r4 - r6 , p c }
2008-08-28 14:22:32 +04:00
ENDPROC( _ _ r a w _ r e a d s b )