| 166 | } |
| 167 | |
| 168 | void signalHandler(CPU* cpu) { |
| 169 | void* result = cpu->startException(cpu->exceptionAddress, cpu->exceptionReadAddress); |
| 170 | if (result) { |
| 171 | cpu->returnHostAddress = result; |
| 172 | return; |
| 173 | } |
| 174 | InException e(cpu); |
| 175 | |
| 176 | if (cpu->exceptionSigNo == SIGSEGV || cpu->exceptionSigNo == SIGBUS || cpu->exceptionSigNo == SIGILL) { |
| 177 | BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(cpu->memory->mutex); // jitCache needs this |
| 178 | U32 eip = 0; |
| 179 | if (!getMemData(cpu->memory)->findOpFromJitAddress((U8*)cpu->exceptionIp, eip)) { |
| 180 | klog("probably about to crash, could not find emulation instruction that caused exception"); |
| 181 | cpu->returnHostAddress = cpu->thread->process->blockExit; |
| 182 | } else { |
| 183 | cpu->eip.u32 = eip; |
| 184 | DecodedOp* op = cpu->getNextOp(); |
| 185 | void* result = cpu->handleAccessException(op); |
| 186 | if (cpu->nextOp->pfnJitCode) { |
| 187 | cpu->returnHostAddress = cpu->nextOp->pfnJitCode; |
| 188 | } else { |
| 189 | cpu->returnHostAddress = result; |
| 190 | } |
| 191 | } |
| 192 | return; |
| 193 | } |
| 194 | kpanic_fmt("unhandled exception %d", cpu->exceptionSigNo); |
| 195 | } |
| 196 | |
| 197 | #endif |
nothing calls this directly
no test coverage detected