| 112 | } |
| 113 | |
| 114 | void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsisr, u32 dar) |
| 115 | { |
| 116 | OSTime now; |
| 117 | |
| 118 | now = OSGetTime(); |
| 119 | |
| 120 | if (!(context->srr1 & MSR_RI)) |
| 121 | { |
| 122 | OSReport("Non-recoverable Exception %d", exception); |
| 123 | } |
| 124 | else |
| 125 | { |
| 126 | if (exception == __OS_EXCEPTION_PROGRAM && (context->srr1 & (0x80000000 >> 11)) && |
| 127 | __OSErrorTable[OS_ERROR_FPE] != 0) |
| 128 | { |
| 129 | u32 fpscr; |
| 130 | u32 msr; |
| 131 | |
| 132 | exception = OS_ERROR_FPE; |
| 133 | |
| 134 | msr = PPCMfmsr(); |
| 135 | PPCMtmsr(msr | MSR_FP); |
| 136 | |
| 137 | if (__OSFPUContext) |
| 138 | { |
| 139 | OSSaveFPUContext((OSContext*)__OSFPUContext); |
| 140 | } |
| 141 | |
| 142 | fpscr = PPCMffpscr(); |
| 143 | fpscr &= ~(FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | |
| 144 | FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | |
| 145 | FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); |
| 146 | PPCMtfpscr(fpscr); |
| 147 | |
| 148 | PPCMtmsr(msr); |
| 149 | |
| 150 | if (__OSFPUContext == context) |
| 151 | { |
| 152 | OSDisableScheduler(); |
| 153 | __OSErrorTable[exception](exception, context, dsisr, dar); |
| 154 | context->srr1 &= ~MSR_FP; |
| 155 | __OSFPUContext = NULL; |
| 156 | |
| 157 | context->fpscr &= |
| 158 | ~(FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | |
| 159 | FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | |
| 160 | FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); |
| 161 | OSEnableScheduler(); |
| 162 | __OSReschedule(); |
| 163 | } |
| 164 | else |
| 165 | { |
| 166 | context->srr1 &= ~MSR_FP; |
| 167 | __OSFPUContext = NULL; |
| 168 | } |
| 169 | |
| 170 | OSLoadContext(context); |
| 171 | } |
no test coverage detected