Changes in kernel/arch/ppc32/src/exception.S [3fde837:adb71b17] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/exception.S
r3fde837 radb71b17 30 30 #include <arch/msr.h> 31 31 #include <arch/mm/page.h> 32 #include <arch/istate_struct.h>33 #include <arch/stack.h>34 #include <align.h>35 32 36 33 .section K_UNMAPPED_TEXT_START, "ax" … … 45 42 mtsprg2 sp 46 43 47 # check whether the previous mode was user or kernel 48 49 mfsrr1 sp # use sp as a temporary register to hold SRR1 50 andi. sp, sp, MSR_PR 44 # check whether SP is in kernel 45 46 andis. sp, sp, 0x8000 51 47 bne 1f 52 # previous mode was kernel 48 49 # stack is in user-space 50 51 mfsprg0 sp 52 53 b 2f 54 55 1: 56 57 # stack is in kernel 53 58 54 59 mfsprg2 sp 55 60 subis sp, sp, 0x8000 56 b 2f 57 58 1: 59 # previous mode was user 60 61 mfsprg0 sp 61 62 62 2: 63 63 64 subi sp, sp, ALIGN_UP(ISTATE_SIZE, STACK_ALIGNMENT)65 stw r0, ISTATE_OFFSET_R0(sp)66 stw r2, ISTATE_OFFSET_R2(sp)67 stw r3, ISTATE_OFFSET_R3(sp)68 stw r4, ISTATE_OFFSET_R4(sp)69 stw r5, ISTATE_OFFSET_R5(sp)70 stw r6, ISTATE_OFFSET_R6(sp)71 stw r7, ISTATE_OFFSET_R7(sp)72 stw r8, ISTATE_OFFSET_R8(sp)73 stw r9, ISTATE_OFFSET_R9(sp)74 stw r10, ISTATE_OFFSET_R10(sp)75 stw r11, ISTATE_OFFSET_R11(sp)76 stw r13, ISTATE_OFFSET_R13(sp)77 stw r14, ISTATE_OFFSET_R14(sp)78 stw r15, ISTATE_OFFSET_R15(sp)79 stw r16, ISTATE_OFFSET_R16(sp)80 stw r17, ISTATE_OFFSET_R17(sp)81 stw r18, ISTATE_OFFSET_R18(sp)82 stw r19, ISTATE_OFFSET_R19(sp)83 stw r20, ISTATE_OFFSET_R20(sp)84 stw r21, ISTATE_OFFSET_R21(sp)85 stw r22, ISTATE_OFFSET_R22(sp)86 stw r23, ISTATE_OFFSET_R23(sp)87 stw r24, ISTATE_OFFSET_R24(sp)88 stw r25, ISTATE_OFFSET_R25(sp)89 stw r26, ISTATE_OFFSET_R26(sp)90 stw r27, ISTATE_OFFSET_R27(sp)91 stw r28, ISTATE_OFFSET_R28(sp)92 stw r29, ISTATE_OFFSET_R29(sp)93 stw r30, ISTATE_OFFSET_R30(sp)94 stw r31, ISTATE_OFFSET_R31(sp)95 96 stw r12, ISTATE_OFFSET_CR(sp)64 subi sp, sp, 176 65 stw r0, 8(sp) 66 stw r2, 12(sp) 67 stw r3, 16(sp) 68 stw r4, 20(sp) 69 stw r5, 24(sp) 70 stw r6, 28(sp) 71 stw r7, 32(sp) 72 stw r8, 36(sp) 73 stw r9, 40(sp) 74 stw r10, 44(sp) 75 stw r11, 48(sp) 76 stw r13, 52(sp) 77 stw r14, 56(sp) 78 stw r15, 60(sp) 79 stw r16, 64(sp) 80 stw r17, 68(sp) 81 stw r18, 72(sp) 82 stw r19, 76(sp) 83 stw r20, 80(sp) 84 stw r21, 84(sp) 85 stw r22, 88(sp) 86 stw r23, 92(sp) 87 stw r24, 96(sp) 88 stw r25, 100(sp) 89 stw r26, 104(sp) 90 stw r27, 108(sp) 91 stw r28, 112(sp) 92 stw r29, 116(sp) 93 stw r30, 120(sp) 94 stw r31, 124(sp) 95 96 stw r12, 128(sp) 97 97 98 98 mfsrr0 r12 99 stw r12, ISTATE_OFFSET_PC(sp)99 stw r12, 132(sp) 100 100 101 101 mfsrr1 r12 102 stw r12, ISTATE_OFFSET_SRR1(sp)102 stw r12, 136(sp) 103 103 104 104 mflr r12 105 stw r12, ISTATE_OFFSET_LR(sp)105 stw r12, 140(sp) 106 106 107 107 mfctr r12 108 stw r12, ISTATE_OFFSET_CTR(sp)108 stw r12, 144(sp) 109 109 110 110 mfxer r12 111 stw r12, ISTATE_OFFSET_XER(sp)111 stw r12, 148(sp) 112 112 113 113 mfdar r12 114 stw r12, ISTATE_OFFSET_DAR(sp)114 stw r12, 152(sp) 115 115 116 116 mfsprg1 r12 117 stw r12, ISTATE_OFFSET_R12(sp)117 stw r12, 156(sp) 118 118 119 119 mfsprg2 r12 120 stw r12, ISTATE_OFFSET_SP(sp)120 stw r12, 160(sp) 121 121 122 122 li r12, 0 123 stw r12, ISTATE_OFFSET_LR_FRAME(sp) 124 stw r12, ISTATE_OFFSET_SP_FRAME(sp) 123 stw r12, 0(sp) 125 124 .endm 126 125 … … 254 253 .org 0x4000 255 254 jump_to_kernel: 256 mfsrr1 r5257 andi. r5, r5, MSR_PR258 bne 1f259 # Previous mode was kernel.260 # We can construct a proper frame linkage.261 262 mfsrr0 r12263 stw r12, ISTATE_OFFSET_LR_FRAME(sp)264 mfsprg2 r12265 stw r12, ISTATE_OFFSET_SP_FRAME(sp)266 1:267 268 255 lis r12, iret@ha 269 256 addi r12, r12, iret@l 270 257 mtlr r12 271 258 272 259 lis r12, exc_dispatch@ha 273 260 addi r12, r12, exc_dispatch@l 274 261 mtsrr0 r12 275 276 mfmsr r12 262 277 263 mfsrr1 r5 278 264 andi. r5, r5, MSR_FP 265 mfmsr r12 279 266 or r12, r12, r5 # Propagate MSR_FP from SRR1 to MSR 280 ori r12, r12, (MSR_IR | MSR_DR) 267 ori r12, r12, (MSR_IR | MSR_DR)@l 281 268 mtsrr1 r12 282 269 283 270 addis sp, sp, 0x8000 284 271 mr r4, sp 272 addi r4, r4, 8 285 273 286 274 rfi … … 299 287 mfmsr r12 300 288 or r12, r12, r0 # Propagate MSR_FP from SRR1 to MSR 301 ori r12, r12, (MSR_IR | MSR_DR) 289 ori r12, r12, (MSR_IR | MSR_DR)@l 302 290 mtsrr1 r12 303 291
Note:
See TracChangeset
for help on using the changeset viewer.