| 237 | } |
| 238 | |
| 239 | void signalHandler(CPU* cpu) { |
| 240 | void* result = cpu->startException(cpu->exceptionAddress, cpu->exceptionReadAddress); |
| 241 | if (result) { |
| 242 | cpu->returnHostAddress = result; |
| 243 | return; |
| 244 | } |
| 245 | InException e(cpu); |
| 246 | |
| 247 | if (cpu->exceptionSigNo == SIGSEGV || cpu->exceptionSigNo == SIGBUS || cpu->exceptionSigNo == SIGILL) { |
| 248 | BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(cpu->memory->mutex); // jitCache needs this |
| 249 | U32 eip = 0; |
| 250 | if (!getMemData(cpu->memory)->findOpFromJitAddress((U8*)cpu->exceptionIp, eip)) { |
| 251 | klog("probably about to crash, could not find emulation instruction that caused exception"); |
| 252 | cpu->returnHostAddress = cpu->thread->process->blockExit; |
| 253 | } else { |
| 254 | cpu->eip.u32 = eip; |
| 255 | DecodedOp* op = cpu->getNextOp(); |
| 256 | if (op->flags2 & OP_FLAG2_SAVED_TMP_REG) { |
| 257 | if (op->inst == MaskmovqEDIMmxMmx || op->inst == MaskmovdquE128XmmXmm) { |
| 258 | cpu->reg[7].u32 = cpu->tmpReg; |
| 259 | } |
| 260 | } |
| 261 | void* result = cpu->handleAccessException(op); |
| 262 | if (cpu->nextOp->pfnJitCode) { |
| 263 | cpu->returnHostAddress = cpu->nextOp->pfnJitCode; |
| 264 | } else { |
| 265 | cpu->returnHostAddress = result; |
| 266 | } |
| 267 | } |
| 268 | return; |
| 269 | } |
| 270 | kpanic_fmt("unhandled exception %d", cpu->exceptionSigNo); |
| 271 | } |
| 272 | |
| 273 | #endif |
nothing calls this directly
no test coverage detected