OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [armnommu/] [lib/] [string.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * linux/arch/arm/lib/string.S
3
 *
4
 * Copyright (C) 1995, 1996 Russell King
5
 */
6
 
7
#include 
8
                .text
9
# Prototype: char *strrchr(const char *s,char c);
10
 
11
@ r0 = pointer, r1 = length
12
                .global _memzero,memzero
13
memzero:
14
_memzero:       stmfd   sp!, {lr}
15
                mov     r2, #0
16
                mov     r3, #0
17
                mov     ip, #0
18
                mov     lr, #0
19
Lgfpmemzerolp:  subs    r1, r1, #4*8
20
                stmgeia r0!, {r2, r3, ip, lr}
21
                stmgeia r0!, {r2, r3, ip, lr}
22
                bgt     Lgfpmemzerolp
23
                LOADREGS(fd, sp!, {pc})
24
 
25
                .global ___page_memcpy,__page_memcpy
26
__page_memcpy:
27
___page_memcpy: stmfd   sp!, {r4, r5, lr}
28
Lpagememcpylp:  subs    r2, r2, #4*8
29
                ldmgeia r1!, {r3, r4, r5, ip}
30
                stmgeia r0!, {r3, r4, r5, ip}
31
                ldmgeia r1!, {r3, r4, r5, ip}
32
                stmgeia r0!, {r3, r4, r5, ip}
33
                bgt     Lpagememcpylp
34
                LOADREGS(fd, sp!, {r4, r5, pc})
35
 
36
                .global _memset,memset
37
memset:
38
_memset:        mov     r3, r0
39
                cmp     r2, #16
40
                blt     Lmemsetbytelp
41
                ands    ip, r3, #3
42
                beq     Laligned
43
                cmp     ip, #2
44
                strltb  r1, [r3], #1                    @ Align destination
45
                strleb  r1, [r3], #1
46
                strb    r1, [r3], #1
47
                rsb     ip, ip, #4
48
                sub     r2, r2, ip
49
Laligned:       orr     r1, r1, r1, lsl #8
50
                orr     r1, r1, r1, lsl #16
51
                cmp     r2, #256
52
                blt     Lmemsetnotopt1
53
                stmfd   sp!, {r4, r5, lr}
54
                mov     r4, r1
55
                mov     r5, r1
56
                mov     lr, r1
57
                mov     ip, r2, lsr #6
58
                sub     r2, r2, ip, lsl #6
59
Lmemset64lp1:   stmia   r3!, {r1, r4, r5, lr}           @ 64 bytes at a time.
60
                stmia   r3!, {r1, r4, r5, lr}
61
                stmia   r3!, {r1, r4, r5, lr}
62
                stmia   r3!, {r1, r4, r5, lr}
63
                subs    ip, ip, #1
64
                bne     Lmemset64lp1
65
                teq     r2, #0
66
                LOADREGS(eqfd, sp!, {r4, r5, pc})       @ Now <64 bytes to go.
67
                tst     r2, #32
68
                stmneia r3!, {r1, r4, r5, lr}
69
                stmneia r3!, {r1, r4, r5, lr}
70
                tst     r2, #16
71
                stmneia r3!, {r1, r4, r5, lr}
72
                ldmia   sp!, {r4, r5}
73
Lmemsetexit:    tst     r2, #8
74
                stmneia r3!, {r1, lr}
75
                tst     r2, #4
76
                strne   r1, [r3], #4
77
                tst     r2, #2
78
                strneb  r1, [r3], #1
79
                strneb  r1, [r3], #1
80
                tst     r2, #1
81
                strneb  r1, [r3], #1
82
                LOADREGS(fd, sp!, {pc})
83
 
84
Lmemsetnotopt1: movs    ip, r2, lsr #3
85
                beq     Lmemsetexit
86
                sub     r2, r2, ip, lsl #3
87
                stmfd   sp!, {lr}
88
                mov     lr, r1
89
                subs    ip, ip, #4
90
Lmemset1616lp:  stmgeia r3!, {r1, lr}
91
                stmgeia r3!, {r1, lr}
92
                stmgeia r3!, {r1, lr}
93
                stmgeia r3!, {r1, lr}
94
                subges  ip, ip, #4
95
                bge     Lmemset1616lp
96
                tst     ip, #2
97
                stmneia r3!, {r1, lr}
98
                stmneia r3!, {r1, lr}
99
                tst     ip, #1
100
                stmneia r3!, {r1, lr}
101
                teq     r2, #0
102
                LOADREGS(eqfd, sp!, {pc})
103
                b       Lmemsetexit
104
 
105
Lmemsetbytelp:
106
Lmemsetlp:      subs    r2, r2, #1
107
                strgeb  r1, [r3], #1
108
                bgt     Lmemsetlp
109
                RETINSTR(mov, pc, lr)
110
 
111
                .global _strrchr,strrchr
112
strrchr:
113
_strrchr:       stmfd   sp!,{lr}
114
                mov     r3,#0
115
Lstrrchrlp:     ldrb    r2,[r0],#1
116
                teq     r2,r1
117
                moveq   r3,r0
118
                teq     r2,#0
119
                bne     Lstrrchrlp
120
                mov     r0,r3
121
                LOADREGS(fd, sp!, {pc})
122
 
123
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.