Subversion Repositories HelenOS

Rev

Rev 2172 | Rev 2300 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2172 Rev 2256
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
memsetb:
33
memsetb:
34
	b _memsetb
34
	b _memsetb
35
	nop
-
 
36
 
35
 
37
 
36
 
38
.global memcpy
37
.global memcpy
39
.global memcpy_from_uspace
38
.global memcpy_from_uspace
40
.global memcpy_to_uspace
39
.global memcpy_to_uspace
41
.global memcpy_from_uspace_failover_address
40
.global memcpy_from_uspace_failover_address
42
.global memcpy_to_uspace_failover_address
41
.global memcpy_to_uspace_failover_address
43
 
42
 
44
memcpy:
43
memcpy:
45
memcpy_from_uspace:
44
memcpy_from_uspace:
46
memcpy_to_uspace:
45
memcpy_to_uspace:
47
	add     r3, r1, #3
46
	add     r3, r1, #3
48
	bic     r3, r3, #3
47
	bic     r3, r3, #3
49
	cmp     r1, r3
48
	cmp     r1, r3
50
	stmdb   sp!, {r4, lr}
49
	stmdb   sp!, {r4, lr}
51
	beq     case_4
50
	beq     case_4
52
case_1:
51
case_1:
53
	cmp     r2, #0
52
	cmp     r2, #0
54
	movne   ip, #0
53
	movne   ip, #0
55
	beq     case_3
54
	beq     case_3
56
case_2:
55
case_2:
57
	ldrb    r3, [ip, r1]
56
	ldrb    r3, [ip, r1]
58
	strb    r3, [ip, r0]
57
	strb    r3, [ip, r0]
59
	add     ip, ip, #1
58
	add     ip, ip, #1
60
	cmp     ip, r2
59
	cmp     ip, r2
61
	bne     case_2
60
	bne     case_2
62
case_3:
61
case_3:
63
	mov     r0, r1
62
	mov     r0, r1
64
	ldmia   sp!, {r4, pc}
63
	ldmia   sp!, {r4, pc}
65
case_4:
64
case_4:
66
	add     r3, r0, #3
65
	add     r3, r0, #3
67
	bic     r3, r3, #3
66
	bic     r3, r3, #3
68
	cmp     r0, r3
67
	cmp     r0, r3
69
	bne     case_1
68
	bne     case_1
70
	movs    r4, r2, lsr #2
69
	movs    r4, r2, lsr #2
71
	moveq   lr, r4
70
	moveq   lr, r4
72
	beq     case_6
71
	beq     case_6
73
	mov     lr, #0
72
	mov     lr, #0
74
	mov     ip, lr
73
	mov     ip, lr
75
case_5:
74
case_5:
76
	ldr     r3, [ip, r1]
75
	ldr     r3, [ip, r1]
77
	add     lr, lr, #1
76
	add     lr, lr, #1
78
	cmp     lr, r4
77
	cmp     lr, r4
79
	str     r3, [ip, r0]
78
	str     r3, [ip, r0]
80
	add     ip, ip, #4
79
	add     ip, ip, #4
81
	bne     case_5
80
	bne     case_5
82
case_6:
81
case_6:
83
	ands    r4, r2, #3
82
	ands    r4, r2, #3
84
	beq     case_3
83
	beq     case_3
85
	mov     r3, lr, lsl #2
84
	mov     r3, lr, lsl #2
86
	add     r0, r3, r0
85
	add     r0, r3, r0
87
	add     ip, r3, r1
86
	add     ip, r3, r1
88
	mov     r2, #0
87
	mov     r2, #0
89
case_7:
88
case_7:
90
	ldrb    r3, [r2, ip]
89
	ldrb    r3, [r2, ip]
91
	strb    r3, [r2, r0]
90
	strb    r3, [r2, r0]
92
	add     r2, r2, #1
91
	add     r2, r2, #1
93
	cmp     r2, r4
92
	cmp     r2, r4
94
	bne     case_7
93
	bne     case_7
95
	b       case_3
94
	b       case_3
96
 
95
 
97
memcpy_from_uspace_failover_address:
96
memcpy_from_uspace_failover_address:
98
memcpy_to_uspace_failover_address:
97
memcpy_to_uspace_failover_address:
99
	mov		r0, #0
98
	mov		r0, #0
100
	ldmia   sp!, {r4, pc}
99
	ldmia   sp!, {r4, pc}
101
 
100
 
102
 
101