2005-04-16 15:20:36 -07:00
/ *
* linux/ a r c h / a r m / l i b / i o - r e a d 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 pack, r d , h w1 , h w2
# ifndef _ _ A R M E B _ _
orr \ r d , \ h w1 , \ h w2 , l s l #16
# else
orr \ r d , \ h w2 , \ h w1 , l s l #16
# endif
.endm
2005-11-11 21:51:48 +00:00
.Linsw_align : movs i p , r1 , l s l #31
bne . L i n s w _ n o a l i g n
2005-04-16 15:20:36 -07:00
ldrh i p , [ r0 ]
sub r2 , r2 , #1
strh i p , [ r1 ] , #2
ENTRY( _ _ r a w _ r e a d s w )
teq r2 , #0
moveq p c , l r
tst r1 , #3
2005-11-11 21:51:48 +00:00
bne . L i n 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 _ i n s w _ 8
2005-04-16 15:20:36 -07:00
2005-11-11 21:51:48 +00:00
.Linsw_8_lp : ldrh r3 , [ r0 ]
2005-04-16 15:20:36 -07:00
ldrh r4 , [ r0 ]
pack r3 , r3 , r4
ldrh r4 , [ r0 ]
ldrh r5 , [ r0 ]
pack r4 , r4 , r5
ldrh r5 , [ r0 ]
ldrh i p , [ r0 ]
pack r5 , r5 , i p
ldrh i p , [ r0 ]
ldrh l r , [ r0 ]
pack i p , i p , l r
subs r2 , r2 , #8
stmia r1 ! , { r3 - r5 , i p }
2005-11-11 21:51:48 +00:00
bpl . L i n s w _ 8 _ l p
2005-04-16 15:20:36 -07:00
2005-11-11 21:51:48 +00:00
.Lno_insw_8 : tst r2 , #4
beq . L n o _ i n s w _ 4
2005-04-16 15:20:36 -07:00
ldrh r3 , [ r0 ]
ldrh r4 , [ r0 ]
pack r3 , r3 , r4
ldrh r4 , [ r0 ]
ldrh i p , [ r0 ]
pack r4 , r4 , i p
stmia r1 ! , { r3 , r4 }
2005-11-11 21:51:48 +00:00
.Lno_insw_4 : movs r2 , r2 , l s l #31
bcc . L n o _ i n s w _ 2
2005-04-16 15:20:36 -07:00
ldrh r3 , [ r0 ]
ldrh i p , [ r0 ]
pack r3 , r3 , i p
str r3 , [ r1 ] , #4
2005-11-11 21:51:48 +00:00
.Lno_insw_2 : ldrneh r3 , [ r0 ]
2005-04-16 15:20:36 -07:00
strneh r3 , [ r1 ]
ldmfd s p ! , { r4 , r5 , p c }
# ifdef _ _ A R M E B _ _
# define _ B E _ O N L Y _ ( c o d e . . . ) c o d e
# define _ L E _ O N L Y _ ( c o d e . . . )
# define p u s h _ h b y t e 0 l s r #8
# define p u l l _ h b y t e 1 l s l #24
# else
# define _ B E _ O N L Y _ ( c o d e . . . )
# define _ L E _ O N L Y _ ( c o d e . . . ) c o d e
# define p u s h _ h b y t e 0 l s l #24
# define p u l l _ h b y t e 1 l s r #8
# endif
2005-11-11 21:51:48 +00:00
.Linsw_noalign : stmfd s p ! , { r4 , l r }
2005-04-16 15:20:36 -07:00
ldrccb i p , [ r1 , #- 1 ] !
bcc 1 f
ldrh i p , [ r0 ]
sub r2 , r2 , #1
_ BE_ O N L Y _ ( m o v i p , i p , r o r #8 )
strb i p , [ r1 ] , #1
_ LE_ O N L Y _ ( m o v i p , i p , l s r #8 )
_ BE_ O N L Y _ ( m o v i p , i p , l s r #24 )
1 : subs r2 , r2 , #2
bmi 3 f
_ BE_ O N L Y _ ( m o v i p , i p , l s l #24 )
2 : ldrh r3 , [ r0 ]
ldrh r4 , [ r0 ]
subs r2 , r2 , #2
orr i p , i p , r3 , l s l #8
orr i p , i p , r4 , p u s h _ h b y t e 0
str i p , [ r1 ] , #4
mov i p , r4 , p u l l _ h b y t e 1
bpl 2 b
_ BE_ O N L Y _ ( m o v i p , i p , l s r #24 )
3 : tst r2 , #1
strb i p , [ r1 ] , #1
ldrneh i p , [ r0 ]
_ BE_ O N L Y _ ( m o v n e i p , i p , r o r #8 )
strneb i p , [ r1 ] , #1
_ LE_ O N L Y _ ( m o v n e i p , i p , l s r #8 )
_ BE_ O N L Y _ ( m o v n e i p , i p , l s r #24 )
strneb i p , [ r1 ]
ldmfd s p ! , { r4 , p c }