Changes in kernel/arch/ppc32/src/exception.S [adb71b17:3fde837] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/exception.S
radb71b17 r3fde837 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> 32 35 33 36 .section K_UNMAPPED_TEXT_START, "ax" … … 42 45 mtsprg2 sp 43 46 44 # check whether SP is in kernel 45 46 andis. sp, sp, 0x8000 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 47 51 bne 1f 48 49 # stack is in user-space 50 51 mfsprg0 sp 52 53 b 2f 54 55 1: 56 57 # stack is in kernel 52 # previous mode was kernel 58 53 59 54 mfsprg2 sp 60 55 subis sp, sp, 0x8000 61 56 b 2f 57 58 1: 59 # previous mode was user 60 61 mfsprg0 sp 62 62 2: 63 63 64 subi sp, sp, 17665 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)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) 97 97 98 98 mfsrr0 r12 99 stw r12, 132(sp)99 stw r12, ISTATE_OFFSET_PC(sp) 100 100 101 101 mfsrr1 r12 102 stw r12, 136(sp)102 stw r12, ISTATE_OFFSET_SRR1(sp) 103 103 104 104 mflr r12 105 stw r12, 140(sp)105 stw r12, ISTATE_OFFSET_LR(sp) 106 106 107 107 mfctr r12 108 stw r12, 144(sp)108 stw r12, ISTATE_OFFSET_CTR(sp) 109 109 110 110 mfxer r12 111 stw r12, 148(sp)111 stw r12, ISTATE_OFFSET_XER(sp) 112 112 113 113 mfdar r12 114 stw r12, 152(sp)114 stw r12, ISTATE_OFFSET_DAR(sp) 115 115 116 116 mfsprg1 r12 117 stw r12, 156(sp)117 stw r12, ISTATE_OFFSET_R12(sp) 118 118 119 119 mfsprg2 r12 120 stw r12, 160(sp)120 stw r12, ISTATE_OFFSET_SP(sp) 121 121 122 122 li r12, 0 123 stw r12, 0(sp) 123 stw r12, ISTATE_OFFSET_LR_FRAME(sp) 124 stw r12, ISTATE_OFFSET_SP_FRAME(sp) 124 125 .endm 125 126 … … 253 254 .org 0x4000 254 255 jump_to_kernel: 256 mfsrr1 r5 257 andi. r5, r5, MSR_PR 258 bne 1f 259 # Previous mode was kernel. 260 # We can construct a proper frame linkage. 261 262 mfsrr0 r12 263 stw r12, ISTATE_OFFSET_LR_FRAME(sp) 264 mfsprg2 r12 265 stw r12, ISTATE_OFFSET_SP_FRAME(sp) 266 1: 267 255 268 lis r12, iret@ha 256 269 addi r12, r12, iret@l 257 270 mtlr r12 258 271 259 272 lis r12, exc_dispatch@ha 260 273 addi r12, r12, exc_dispatch@l 261 274 mtsrr0 r12 262 275 276 mfmsr r12 263 277 mfsrr1 r5 264 278 andi. r5, r5, MSR_FP 265 mfmsr r12266 279 or r12, r12, r5 # Propagate MSR_FP from SRR1 to MSR 267 ori r12, r12, (MSR_IR | MSR_DR) @l280 ori r12, r12, (MSR_IR | MSR_DR) 268 281 mtsrr1 r12 269 282 270 283 addis sp, sp, 0x8000 271 284 mr r4, sp 272 addi r4, r4, 8273 285 274 286 rfi … … 287 299 mfmsr r12 288 300 or r12, r12, r0 # Propagate MSR_FP from SRR1 to MSR 289 ori r12, r12, (MSR_IR | MSR_DR) @l301 ori r12, r12, (MSR_IR | MSR_DR) 290 302 mtsrr1 r12 291 303
Note:
See TracChangeset
for help on using the changeset viewer.