Subversion Repositories HelenOS-historic

Rev

Rev 860 | Rev 1007 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
162 decky 1
#
2
# Copyright (C) 2005 Martin Decky
3
# All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
7
# are met:
8
#
9
# - Redistributions of source code must retain the above copyright
10
#   notice, this list of conditions and the following disclaimer.
11
# - Redistributions in binary form must reproduce the above copyright
12
#   notice, this list of conditions and the following disclaimer in the
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
15
#   derived from this software without specific prior written permission.
16
#
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
19
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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
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
26
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
#
28
 
845 decky 29
#include <arch/asm/regname.h>
191 decky 30
 
162 decky 31
.text
32
 
185 decky 33
.global cpu_sleep
210 decky 34
.global memsetb
35
.global memcpy
185 decky 36
 
37
cpu_sleep:
38
	b cpu_sleep
210 decky 39
 
40
memsetb:
41
	rlwimi r5, r5, 8, 16, 23
42
	rlwimi r5, r5, 16, 0, 15
43
 
44
	addi r14, r3, -4
45
 
46
	cmplwi 0, r4, 4
47
	blt 7f
48
 
49
	stwu r5, 4(r14)
50
	beqlr
51
 
52
	andi. r15, r14, 3
53
	add r4, r15, r4
54
	subf r14, r15, r14
55
	srwi r15, r4, 2
56
	mtctr r15
57
 
58
	bdz 6f
59
 
60
	1:
61
		stwu r5, 4(r14)
62
		bdnz 1b
63
 
64
	6:
65
 
66
	andi. r4, r4, 3
67
 
68
	7:
69
 
70
	cmpwi 0, r4, 0
71
	beqlr
72
 
73
	mtctr r4
74
	addi r6, r6, 3
75
 
76
	8:
77
 
78
	stbu r5, 1(r14)
79
	bdnz 8b
80
 
81
	blr
82
 
83
memcpy:
860 decky 84
	srwi. r7, r5, 3
85
	addi r6, r3, -4
86
	addi r4, r4, -4
87
	beq	2f
88
 
89
	andi. r0, r6, 3
90
	mtctr r7
91
	bne 5f
92
 
93
	1:
94
 
95
	lwz r7, 4(r4)
96
	lwzu r8, 8(r4)
97
	stw r7, 4(r6)
98
	stwu r8, 8(r6)
99
	bdnz 1b
100
 
101
	andi. r5, r5, 7
102
 
103
	2:
104
 
105
	cmplwi 0, r5, 4
106
	blt 3f
107
 
108
	lwzu r0, 4(r4)
109
	addi r5, r5, -4
110
	stwu r0, 4(r6)
111
 
112
	3:
113
 
114
	cmpwi 0, r5, 0
115
	beqlr
116
	mtctr r5
117
	addi r4, r4, 3
118
	addi r6, r6, 3
119
 
120
	4:
121
 
122
	lbzu r0, 1(r4)
123
	stbu r0, 1(r6)
124
	bdnz 4b
210 decky 125
	blr
860 decky 126
 
127
	5:
128
 
129
	subfic r0, r0, 4
130
	mtctr r0
131
 
132
	6:
133
 
134
	lbz r7, 4(r4)
135
	addi r4, r4, 1
136
	stb r7, 4(r6)
137
	addi r6, r6, 1
138
	bdnz 6b
139
	subf r5, r0, r5
140
	rlwinm. r7, r5, 32-3, 3, 31
141
	beq 2b
142
	mtctr r7
143
	b 1b