MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / signalHandler

Function signalHandler

platform/linux/platformThreads-x64.cpp:239–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void 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

Callers

nothing calls this directly

Calls 7

getMemDataFunction · 0.85
klogFunction · 0.85
kpanic_fmtFunction · 0.85
startExceptionMethod · 0.80
findOpFromJitAddressMethod · 0.80
getNextOpMethod · 0.80
handleAccessExceptionMethod · 0.80

Tested by

no test coverage detected