2009-06-12 22:01:00 +08:00
/ *
* arch/ s c o r e / l i b / s t r i n g . S
*
* Score P r o c e s s o r v e r s i o n .
*
* Copyright ( C ) 2 0 0 9 S u n p l u s C o r e T e c h n o l o g y C o . , L t d .
* Chen L i q i n < l i q i n . c h e n @sunplusct.com>
* Lennox W u < l e n n o x . w u @sunplusct.com>
*
* 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 a s p u b l i s h e d b y
* the F r e e S o f t w a r e F o u n d a t i o n ; either version 2 of the License, or
* ( at y o u r o p t i o n ) a n y l a t e r v e r s i o n .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y 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
* along w i t h t h i s p r o g r a m ; if not, see the file COPYING, or write
* to 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 , I n c . ,
* 5 1 Franklin S t , F i f t h F l o o r , B o s t o n , M A 0 2 1 1 0 - 1 3 0 1 U S A
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m - g e n e r i c / e r r n o . h >
.text
.align 2
ENTRY( _ _ s t r n c p y _ f r o m _ u s e r )
cmpi. c r6 , 0
mv r9 , r6
ble . L 2
0 : lbu r7 , [ r5 ]
ldi r8 , 0
1 : sb r7 , [ r4 ]
2 : lb r6 , [ r5 ]
cmp. c r6 , r8
beq . L 2
.L5 :
addi r8 , 1
cmp. c r8 , r9
beq . L 7
3 : lbu r6 , [ r5 , 1 ] +
4 : sb r6 , [ r4 , 1 ] +
5 : lb r7 , [ r5 ]
cmpi. c r7 , 0
bne . L 5
.L7 :
mv r4 , r8
br r3
.L2 :
ldi r8 , 0
mv r4 , r8
br r3
.section .fixup , " ax"
99 :
ldi r4 , - E F A U L T
br r3
.previous
.section _ _ ex_ t a b l e , " a "
.align 2
.word 0b , 9 9 b
.word 1b , 9 9 b
.word 2b , 9 9 b
.word 3b , 9 9 b
.word 4b , 9 9 b
.word 5b , 9 9 b
.previous
.align 2
ENTRY( _ _ s t r n l e n _ u s e r )
cmpi. c r5 , 0
ble . L 1 1
0 : lb r6 , [ r4 ]
ldi r7 , 0
cmp. c r6 , r7
beq . L 1 1
.L15 :
addi r7 , 1
cmp. c r7 , r5
beq . L 2 3
1 : lb r6 , [ r4 ,1 ] +
cmpi. c r6 , 0
bne . L 1 5
.L23 :
addri r4 , r7 , 1
br r3
.L11 :
ldi r4 , 1
br r3
.section .fixup , " ax"
99 :
ldi r4 , 0
br r3
.section _ _ ex_ t a b l e ," a "
.align 2
.word 0 b, 9 9 b
.word 1 b, 9 9 b
.previous
.align 2
ENTRY( _ _ s t r l e n _ u s e r )
0 : lb r6 , [ r4 ]
mv r7 , r4
extsb r6 , r6
cmpi. c r6 , 0
mv r4 , r6
beq . L 2 7
.L28 :
1 : lb r6 , [ r7 , 1 ] +
addi r6 , 1
cmpi. c r6 , 0
bne . L 2 8
.L27 :
br r3
.section .fixup , " ax"
ldi r4 , 0 x0
br r3
99 :
ldi r4 , 0
br r3
.previous
.section _ _ ex_ t a b l e , " a "
.align 2
.word 0b , 9 9 b
.word 1b , 9 9 b
.previous
.align 2
ENTRY( _ _ c o p y _ t o f r o m _ u s e r )
cmpi. c r6 , 0
mv r10 ,r6
beq . L 3 2
ldi r9 , 0
.L34 :
add r6 , r5 , r9
0 : lbu r8 , [ r6 ]
add r7 , r4 , r9
1 : sb r8 , [ r7 ]
addi r9 , 1
cmp. c r9 , r10
bne . L 3 4
.L32 :
ldi r4 , 0
br r3
.section .fixup , " ax"
99 :
sub r4 , r10 , r9
br r3
.previous
.section _ _ ex_ t a b l e , " a "
.align 2
.word 0 b, 9 9 b
.word 1 b, 9 9 b
.previous
.align 2
ENTRY( _ _ c l e a r _ u s e r )
cmpi. c r5 , 0
beq . L 3 8
ldi r6 , 0
mv r7 , r6
.L40 :
addi r6 , 1
0 : sb r7 , [ r4 ] + , 1
cmp. c r6 , r5
bne . L 4 0
.L38 :
ldi r4 , 0
br r3
.section .fixup , " ax"
2015-04-15 08:33:50 -07:00
99 :
2009-06-12 22:01:00 +08:00
br r3
.previous
.section _ _ ex_ t a b l e , " a "
.align 2
.word 0 b, 9 9 b
.previous