Subversion Repositories HelenOS

Rev

Rev 3425 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3425 Rev 4377
1
#
1
#
2
# Copyright (c) 2007 Michal Kebrt
2
# Copyright (c) 2007 Michal Kebrt
3
# All rights reserved.
3
# All rights reserved.
4
#
4
#
5
# Redistribution and use in source and binary forms, with or without
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
6
# modification, are permitted provided that the following conditions
7
# are met:
7
# are met:
8
#
8
#
9
# - Redistributions of source code must retain the above copyright
9
# - Redistributions of source code must retain the above copyright
10
#   notice, this list of conditions and the following disclaimer.
10
#   notice, this list of conditions and the following disclaimer.
11
# - Redistributions in binary form must reproduce the above copyright
11
# - Redistributions in binary form must reproduce the above copyright
12
#   notice, this list of conditions and the following disclaimer in the
12
#   notice, this list of conditions and the following disclaimer in the
13
#   documentation and/or other materials provided with the distribution.
13
#   documentation and/or other materials provided with the distribution.
14
# - The name of the author may not be used to endorse or promote products
14
# - The name of the author may not be used to endorse or promote products
15
#   derived from this software without specific prior written permission.
15
#   derived from this software without specific prior written permission.
16
#
16
#
17
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
27
#
28
 
28
 
29
	
29
	
30
.text
30
.text
31
 
31
 
32
.global memsetb
32
.global memsetb
-
 
33
.global memsetw
33
.global memcpy
34
.global memcpy
34
.global memcpy_from_uspace
35
.global memcpy_from_uspace
35
.global memcpy_to_uspace
36
.global memcpy_to_uspace
36
.global memcpy_from_uspace_failover_address
37
.global memcpy_from_uspace_failover_address
37
.global memcpy_to_uspace_failover_address
38
.global memcpy_to_uspace_failover_address
38
 
39
 
39
memsetb:
40
memsetb:
40
	b _memsetb
41
	b _memsetb
41
 
42
 
-
 
43
memsetw:
-
 
44
	b _memsetw
-
 
45
 
42
memcpy:
46
memcpy:
43
memcpy_from_uspace:
47
memcpy_from_uspace:
44
memcpy_to_uspace:
48
memcpy_to_uspace:
45
	add     r3, r1, #3
49
	add     r3, r1, #3
46
	bic     r3, r3, #3
50
	bic     r3, r3, #3
47
	cmp     r1, r3
51
	cmp     r1, r3
48
	stmdb   sp!, {r4, r5, lr}
52
	stmdb   sp!, {r4, r5, lr}
49
	mov	r5, r0			/* save dst */
53
	mov	r5, r0			/* save dst */
50
	beq     4f
54
	beq     4f
51
1:
55
1:
52
	cmp     r2, #0
56
	cmp     r2, #0
53
	movne   ip, #0
57
	movne   ip, #0
54
	beq     3f
58
	beq     3f
55
2:
59
2:
56
	ldrb    r3, [ip, r1]
60
	ldrb    r3, [ip, r1]
57
	strb    r3, [ip, r0]
61
	strb    r3, [ip, r0]
58
	add     ip, ip, #1
62
	add     ip, ip, #1
59
	cmp     ip, r2
63
	cmp     ip, r2
60
	bne     2b
64
	bne     2b
61
3:
65
3:
62
	mov     r0, r5
66
	mov     r0, r5
63
	ldmia   sp!, {r4, r5, pc}
67
	ldmia   sp!, {r4, r5, pc}
64
4:
68
4:
65
	add     r3, r0, #3
69
	add     r3, r0, #3
66
	bic     r3, r3, #3
70
	bic     r3, r3, #3
67
	cmp     r0, r3
71
	cmp     r0, r3
68
	bne     1b
72
	bne     1b
69
	movs    r4, r2, lsr #2
73
	movs    r4, r2, lsr #2
70
	moveq   lr, r4
74
	moveq   lr, r4
71
	beq     6f
75
	beq     6f
72
	mov     lr, #0
76
	mov     lr, #0
73
	mov     ip, lr
77
	mov     ip, lr
74
5:
78
5:
75
	ldr     r3, [ip, r1]
79
	ldr     r3, [ip, r1]
76
	add     lr, lr, #1
80
	add     lr, lr, #1
77
	cmp     lr, r4
81
	cmp     lr, r4
78
	str     r3, [ip, r0]
82
	str     r3, [ip, r0]
79
	add     ip, ip, #4
83
	add     ip, ip, #4
80
	bne     5b
84
	bne     5b
81
6:
85
6:
82
	ands    r4, r2, #3
86
	ands    r4, r2, #3
83
	beq     3b
87
	beq     3b
84
	mov     r3, lr, lsl #2
88
	mov     r3, lr, lsl #2
85
	add     r0, r3, r0
89
	add     r0, r3, r0
86
	add     ip, r3, r1
90
	add     ip, r3, r1
87
	mov     r2, #0
91
	mov     r2, #0
88
7:
92
7:
89
	ldrb    r3, [r2, ip]
93
	ldrb    r3, [r2, ip]
90
	strb    r3, [r2, r0]
94
	strb    r3, [r2, r0]
91
	add     r2, r2, #1
95
	add     r2, r2, #1
92
	cmp     r2, r4
96
	cmp     r2, r4
93
	bne     7b
97
	bne     7b
94
	b       3b
98
	b       3b
95
 
99
 
96
memcpy_from_uspace_failover_address:
100
memcpy_from_uspace_failover_address:
97
memcpy_to_uspace_failover_address:
101
memcpy_to_uspace_failover_address:
98
	mov	r0, #0
102
	mov	r0, #0
99
	ldmia   sp!, {r4, r5, pc}
103
	ldmia   sp!, {r4, r5, pc}
100
 
104