Changes in kernel/arch/ppc32/src/asm.S [b60c582:da52547] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/asm.S
rb60c582 rda52547 1 # 2 #Copyright (c) 2005 Martin Decky3 #All rights reserved.4 # 5 #Redistribution and use in source and binary forms, with or without6 #modification, are permitted provided that the following conditions7 #are met:8 # 9 #- Redistributions of source code must retain the above copyright10 #notice, this list of conditions and the following disclaimer.11 #- Redistributions in binary form must reproduce the above copyright12 #notice, this list of conditions and the following disclaimer in the13 #documentation and/or other materials provided with the distribution.14 #- The name of the author may not be used to endorse or promote products15 #derived from this software without specific prior written permission.16 # 17 #THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR18 #IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES19 #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, BUT22 #NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23 #DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24 #THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25 #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF26 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.27 # 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 28 29 29 #include <arch/asm/regname.h> 30 #include <arch/cpu.h> 30 31 31 32 .text … … 41 42 .global memcpy_from_uspace_failover_address 42 43 .global memcpy_to_uspace_failover_address 44 .global early_putchar 43 45 44 46 userspace_asm: 45 46 # r3 = uspace_uarg 47 # r4 = stack 48 # r5 = entry 49 50 # disable interrupts 51 47 48 /* 49 * r3 = uspace_uarg 50 * r4 = stack 51 * r5 = entry 52 */ 53 54 /* Disable interrupts */ 55 52 56 mfmsr r31 53 57 rlwinm r31, r31, 0, 17, 15 54 58 mtmsr r31 55 59 56 # set entry point60 /* Set entry point */ 57 61 58 62 mtsrr0 r5 59 63 60 # set problem state, enable interrupts61 62 ori r31, r31, msr_pr63 ori r31, r31, msr_ee64 /* Set problem state, enable interrupts */ 65 66 ori r31, r31, MSR_PR 67 ori r31, r31, MSR_EE 64 68 mtsrr1 r31 65 69 66 # set stack70 /* Set stack */ 67 71 68 72 mr sp, r4 69 70 # %r6 is defined to hold pcb_ptr - set it to 071 73 74 /* %r6 is defined to hold pcb_ptr - set it to 0 */ 75 72 76 xor r6, r6, r6 73 77 74 # jump to userspace78 /* Jump to userspace */ 75 79 76 80 rfi … … 78 82 iret: 79 83 80 # disable interrupts84 /* Disable interrupts */ 81 85 82 86 mfmsr r31 … … 140 144 iret_syscall: 141 145 142 # reset decrementer143 146 /* Reset decrementer */ 147 144 148 li r31, 1000 145 149 mtdec r31 146 150 147 # disable interrupts151 /* Disable interrupts */ 148 152 149 153 mfmsr r31 … … 201 205 lwz r12, 156(sp) 202 206 lwz sp, 160(sp) 203 207 204 208 rfi 205 209 … … 213 217 memcpy_from_uspace: 214 218 memcpy_to_uspace: 215 219 216 220 srwi. r7, r5, 3 217 221 addi r6, r3, -4 218 222 addi r4, r4, -4 219 beq 223 beq 2f 220 224 221 225 andi. r0, r6, 3 … … 225 229 1: 226 230 227 lwz r7, 4(r4)228 lwzu r8, 8(r4)229 stw r7, 4(r6)230 stwu r8, 8(r6)231 bdnz 1b232 233 andi. r5, r5, 7231 lwz r7, 4(r4) 232 lwzu r8, 8(r4) 233 stw r7, 4(r6) 234 stwu r8, 8(r6) 235 bdnz 1b 236 237 andi. r5, r5, 7 234 238 235 239 2: 236 240 237 cmplwi 0, r5, 4238 blt 3f239 240 lwzu r0, 4(r4)241 addi r5, r5, -4242 stwu r0, 4(r6)241 cmplwi 0, r5, 4 242 blt 3f 243 244 lwzu r0, 4(r4) 245 addi r5, r5, -4 246 stwu r0, 4(r6) 243 247 244 248 3: 245 249 246 cmpwi 0, r5, 0247 beqlr248 mtctr r5249 addi r4, r4, 3250 addi r6, r6, 3250 cmpwi 0, r5, 0 251 beqlr 252 mtctr r5 253 addi r4, r4, 3 254 addi r6, r6, 3 251 255 252 256 4: 253 257 254 lbzu r0, 1(r4)255 stbu r0, 1(r6)256 bdnz 4b257 blr258 lbzu r0, 1(r4) 259 stbu r0, 1(r6) 260 bdnz 4b 261 blr 258 262 259 263 5: 260 264 261 subfic r0, r0, 4262 mtctr r0265 subfic r0, r0, 4 266 mtctr r0 263 267 264 268 6: 265 269 266 lbz r7, 4(r4)267 addi r4, r4, 1268 stb r7, 4(r6)269 addi r6, r6, 1270 bdnz 6b271 subf r5, r0, r5272 rlwinm. r7, r5, 32-3, 3, 31273 beq 2b274 mtctr r7275 b 1b270 lbz r7, 4(r4) 271 addi r4, r4, 1 272 stb r7, 4(r6) 273 addi r6, r6, 1 274 bdnz 6b 275 subf r5, r0, r5 276 rlwinm. r7, r5, 32-3, 3, 31 277 beq 2b 278 mtctr r7 279 b 1b 276 280 277 281 memcpy_from_uspace_failover_address: 278 282 memcpy_to_uspace_failover_address: 279 # return zero, failure283 /* Return zero, failure */ 280 284 xor r3, r3, r3 281 285 blr 286 287 early_putchar: 288 blr
Note:
See TracChangeset
for help on using the changeset viewer.