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 v3 . 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 >
2008-08-05 16:14:15 +01:00
# include < m a c h / h a r d w a r e . h >
2005-04-16 15:20:36 -07:00
2005-11-11 21:51:48 +00:00
.Linsw_bad_alignment :
adr r0 , . L i n s w _ b a d _ a l i g n _ m s g
2005-04-16 15:20:36 -07:00
mov r2 , l r
b p a n i c
2005-11-11 21:51:48 +00:00
.Linsw_bad_align_msg :
2005-04-16 15:20:36 -07:00
.asciz " insw : bad b u f f e r a l i g n m e n t ( 0 x % p , l r =0x % 0 8 l X ) \ n "
.align
2005-11-11 21:51:48 +00:00
.Linsw_align : tst r1 , #1
bne . L i n s w _ b a d _ a l i g n m e n t
2005-04-16 15:20:36 -07:00
ldr r3 , [ r0 ]
strb r3 , [ r1 ] , #1
mov r3 , r3 , l s r #8
strb r3 , [ r1 ] , #1
subs r2 , r2 , #1
2006-06-25 11:17:23 +01:00
moveq p c , l r
2005-04-16 15:20:36 -07:00
ENTRY( _ _ r a w _ r e a d s w )
teq r2 , #0 @ do we have to check for the zero len?
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
2005-11-11 21:51:48 +00:00
.Linsw_aligned : mov i p , #0xff
2005-04-16 15:20:36 -07:00
orr i p , i p , i p , l s l #8
stmfd s p ! , { r4 , r5 , r6 , 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 : ldr r3 , [ r0 ]
2005-04-16 15:20:36 -07:00
and r3 , r3 , i p
ldr r4 , [ r0 ]
orr r3 , r3 , r4 , l s l #16
ldr r4 , [ r0 ]
and r4 , r4 , i p
ldr r5 , [ r0 ]
orr r4 , r4 , r5 , l s l #16
ldr r5 , [ r0 ]
and r5 , r5 , i p
ldr r6 , [ r0 ]
orr r5 , r5 , r6 , l s l #16
ldr r6 , [ r0 ]
and r6 , r6 , i p
ldr l r , [ r0 ]
orr r6 , r6 , l r , l s l #16
stmia r1 ! , { r3 - r6 }
subs r2 , r2 , #8
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
tst r2 , #7
2006-06-25 11:23:45 +01:00
ldmeqfd s p ! , { r4 , r5 , r6 , p c }
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
ldr r3 , [ r0 ]
and r3 , r3 , i p
ldr r4 , [ r0 ]
orr r3 , r3 , r4 , l s l #16
ldr r4 , [ r0 ]
and r4 , r4 , i p
ldr r5 , [ r0 ]
orr r4 , r4 , r5 , l s l #16
stmia r1 ! , { r3 , r4 }
2005-11-11 21:51:48 +00:00
.Lno_insw_4 : tst r2 , #2
beq . L n o _ i n s w _ 2
2005-04-16 15:20:36 -07:00
ldr r3 , [ r0 ]
and r3 , r3 , i p
ldr r4 , [ r0 ]
orr r3 , r3 , r4 , l s l #16
str r3 , [ r1 ] , #4
2005-11-11 21:51:48 +00:00
.Lno_insw_2 : tst r2 , #1
2005-04-16 15:20:36 -07:00
ldrne r3 , [ r0 ]
strneb r3 , [ r1 ] , #1
movne r3 , r3 , l s r #8
strneb r3 , [ r1 ]
2006-06-25 11:23:45 +01:00
ldmfd s p ! , { r4 , r5 , r6 , p c }
2005-04-16 15:20:36 -07:00