Rev 982 | Rev 1007 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 982 | Rev 1004 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (C) 2005 Martin Decky |
2 | # Copyright (C) 2005 Martin Decky |
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 | #include <arch/asm/regname.h> |
29 | #include <arch/asm/regname.h> |
30 | 30 | ||
31 | .text |
31 | .text |
32 | 32 | ||
33 | .global cpu_sleep |
33 | .global cpu_sleep |
- | 34 | .global iret |
|
34 | .global memsetb |
35 | .global memsetb |
35 | .global memcpy |
36 | .global memcpy |
36 | 37 | ||
37 | cpu_sleep: |
38 | cpu_sleep: |
38 | b cpu_sleep |
39 | b cpu_sleep |
39 | 40 | ||
- | 41 | iret: |
|
- | 42 | lwz r3, 144(sp) |
|
- | 43 | mtxer r3 |
|
- | 44 | ||
- | 45 | lwz r3, 140(sp) |
|
- | 46 | mtctr r3 |
|
- | 47 | ||
- | 48 | lwz r3, 136(sp) |
|
- | 49 | mtcr r3 |
|
- | 50 | ||
- | 51 | lwz r3, 132(sp) |
|
- | 52 | mtlr r3 |
|
- | 53 | ||
- | 54 | lwz r3, 128(sp) |
|
- | 55 | mtspr srr1, r3 |
|
- | 56 | ||
- | 57 | lwz r3, 124(sp) |
|
- | 58 | mtspr srr0, r3 |
|
- | 59 | ||
- | 60 | lwz r0, 0(sp) |
|
- | 61 | lwz r2, 4(sp) |
|
- | 62 | lwz r3, 8(sp) |
|
- | 63 | lwz r4, 12(sp) |
|
- | 64 | lwz r5, 16(sp) |
|
- | 65 | lwz r6, 20(sp) |
|
- | 66 | lwz r7, 24(sp) |
|
- | 67 | lwz r8, 28(sp) |
|
- | 68 | lwz r9, 32(sp) |
|
- | 69 | lwz r10, 36(sp) |
|
- | 70 | lwz r11, 40(sp) |
|
- | 71 | lwz r12, 44(sp) |
|
- | 72 | lwz r13, 48(sp) |
|
- | 73 | lwz r14, 52(sp) |
|
- | 74 | lwz r15, 56(sp) |
|
- | 75 | lwz r16, 60(sp) |
|
- | 76 | lwz r17, 64(sp) |
|
- | 77 | lwz r18, 68(sp) |
|
- | 78 | lwz r19, 72(sp) |
|
- | 79 | lwz r20, 76(sp) |
|
- | 80 | lwz r21, 80(sp) |
|
- | 81 | lwz r22, 84(sp) |
|
- | 82 | lwz r23, 88(sp) |
|
- | 83 | lwz r24, 92(sp) |
|
- | 84 | lwz r25, 96(sp) |
|
- | 85 | lwz r26, 100(sp) |
|
- | 86 | lwz r27, 104(sp) |
|
- | 87 | lwz r28, 108(sp) |
|
- | 88 | lwz r29, 112(sp) |
|
- | 89 | lwz r30, 116(sp) |
|
- | 90 | lwz r31, 120(sp) |
|
- | 91 | ||
- | 92 | mfspr sp, sprg1 |
|
- | 93 | ||
- | 94 | rfi |
|
- | 95 | ||
40 | memsetb: |
96 | memsetb: |
41 | rlwimi r5, r5, 8, 16, 23 |
97 | rlwimi r5, r5, 8, 16, 23 |
42 | rlwimi r5, r5, 16, 0, 15 |
98 | rlwimi r5, r5, 16, 0, 15 |
43 | 99 | ||
44 | addi r14, r3, -4 |
100 | addi r14, r3, -4 |
45 | 101 | ||
46 | cmplwi 0, r4, 4 |
102 | cmplwi 0, r4, 4 |
47 | blt 7f |
103 | blt 7f |
48 | 104 | ||
49 | stwu r5, 4(r14) |
105 | stwu r5, 4(r14) |
50 | beqlr |
106 | beqlr |
51 | 107 | ||
52 | andi. r15, r14, 3 |
108 | andi. r15, r14, 3 |
53 | add r4, r15, r4 |
109 | add r4, r15, r4 |
54 | subf r14, r15, r14 |
110 | subf r14, r15, r14 |
55 | srwi r15, r4, 2 |
111 | srwi r15, r4, 2 |
56 | mtctr r15 |
112 | mtctr r15 |
57 | 113 | ||
58 | bdz 6f |
114 | bdz 6f |
59 | 115 | ||
60 | 1: |
116 | 1: |
61 | stwu r5, 4(r14) |
117 | stwu r5, 4(r14) |
62 | bdnz 1b |
118 | bdnz 1b |
63 | 119 | ||
64 | 6: |
120 | 6: |
65 | 121 | ||
66 | andi. r4, r4, 3 |
122 | andi. r4, r4, 3 |
67 | 123 | ||
68 | 7: |
124 | 7: |
69 | 125 | ||
70 | cmpwi 0, r4, 0 |
126 | cmpwi 0, r4, 0 |
71 | beqlr |
127 | beqlr |
72 | 128 | ||
73 | mtctr r4 |
129 | mtctr r4 |
74 | addi r6, r6, 3 |
130 | addi r6, r6, 3 |
75 | 131 | ||
76 | 8: |
132 | 8: |
77 | 133 | ||
78 | stbu r5, 1(r14) |
134 | stbu r5, 1(r14) |
79 | bdnz 8b |
135 | bdnz 8b |
80 | 136 | ||
81 | blr |
137 | blr |
82 | 138 | ||
83 | memcpy: |
139 | memcpy: |
84 | srwi. r7, r5, 3 |
140 | srwi. r7, r5, 3 |
85 | addi r6, r3, -4 |
141 | addi r6, r3, -4 |
86 | addi r4, r4, -4 |
142 | addi r4, r4, -4 |
87 | beq 2f |
143 | beq 2f |
88 | 144 | ||
89 | andi. r0, r6, 3 |
145 | andi. r0, r6, 3 |
90 | mtctr r7 |
146 | mtctr r7 |
91 | bne 5f |
147 | bne 5f |
92 | 148 | ||
93 | 1: |
149 | 1: |
94 | 150 | ||
95 | lwz r7, 4(r4) |
151 | lwz r7, 4(r4) |
96 | lwzu r8, 8(r4) |
152 | lwzu r8, 8(r4) |
97 | stw r7, 4(r6) |
153 | stw r7, 4(r6) |
98 | stwu r8, 8(r6) |
154 | stwu r8, 8(r6) |
99 | bdnz 1b |
155 | bdnz 1b |
100 | 156 | ||
101 | andi. r5, r5, 7 |
157 | andi. r5, r5, 7 |
102 | 158 | ||
103 | 2: |
159 | 2: |
104 | 160 | ||
105 | cmplwi 0, r5, 4 |
161 | cmplwi 0, r5, 4 |
106 | blt 3f |
162 | blt 3f |
107 | 163 | ||
108 | lwzu r0, 4(r4) |
164 | lwzu r0, 4(r4) |
109 | addi r5, r5, -4 |
165 | addi r5, r5, -4 |
110 | stwu r0, 4(r6) |
166 | stwu r0, 4(r6) |
111 | 167 | ||
112 | 3: |
168 | 3: |
113 | 169 | ||
114 | cmpwi 0, r5, 0 |
170 | cmpwi 0, r5, 0 |
115 | beqlr |
171 | beqlr |
116 | mtctr r5 |
172 | mtctr r5 |
117 | addi r4, r4, 3 |
173 | addi r4, r4, 3 |
118 | addi r6, r6, 3 |
174 | addi r6, r6, 3 |
119 | 175 | ||
120 | 4: |
176 | 4: |
121 | 177 | ||
122 | lbzu r0, 1(r4) |
178 | lbzu r0, 1(r4) |
123 | stbu r0, 1(r6) |
179 | stbu r0, 1(r6) |
124 | bdnz 4b |
180 | bdnz 4b |
125 | blr |
181 | blr |
126 | 182 | ||
127 | 5: |
183 | 5: |
128 | 184 | ||
129 | subfic r0, r0, 4 |
185 | subfic r0, r0, 4 |
130 | mtctr r0 |
186 | mtctr r0 |
131 | 187 | ||
132 | 6: |
188 | 6: |
133 | 189 | ||
134 | lbz r7, 4(r4) |
190 | lbz r7, 4(r4) |
135 | addi r4, r4, 1 |
191 | addi r4, r4, 1 |
136 | stb r7, 4(r6) |
192 | stb r7, 4(r6) |
137 | addi r6, r6, 1 |
193 | addi r6, r6, 1 |
138 | bdnz 6b |
194 | bdnz 6b |
139 | subf r5, r0, r5 |
195 | subf r5, r0, r5 |
140 | rlwinm. r7, r5, 32-3, 3, 31 |
196 | rlwinm. r7, r5, 32-3, 3, 31 |
141 | beq 2b |
197 | beq 2b |
142 | mtctr r7 |
198 | mtctr r7 |
143 | b 1b |
199 | b 1b |
144 | 200 |