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

Function onExitSignal

source/kernel/kthread.cpp:1097–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1095}
1096
1097void OPCALL onExitSignal(CPU* cpu, DecodedOp* op) {
1098 U64 count = cpu->instructionCount;
1099
1100 cpu->pop32(); // signal
1101 cpu->pop32(); // address
1102 U32 context = cpu->pop32();
1103 cpu->thread->condStartWaitTime = cpu->pop32();
1104 cpu->thread->interrupted = cpu->pop32()!=0;
1105
1106#ifdef LOG_OPS
1107 //klog("onExitSignal signal=%d info=%X context=%X stack=%X interrupted=%d", signal, address, context, cpu->reg[4].u32, cpu->thread->interrupted);
1108 //klog(" before context %.8X EAX=%.8X ECX=%.8X EDX=%.8X EBX=%.8X ESP=%.8X EBP=%.8X ESI=%.8X EDI=%.8X fs=%d(%X) fs18=%X", cpu->eip.u32, cpu->reg[0].u32, cpu->reg[1].u32, cpu->reg[2].u32, cpu->reg[3].u32, cpu->reg[4].u32, cpu->reg[5].u32, cpu->reg[6].u32, cpu->reg[7].u32, cpu->segValue[4], cpu->segAddress[4], cpu->segAddress[4]?readd(cpu->memory, cpu->segAddress[4]+0x18):0);
1109#endif
1110 readFromContext(cpu, context);
1111#ifdef LOG_OPS
1112 klog(" after context %.8X EAX=%.8X ECX=%.8X EDX=%.8X EBX=%.8X ESP=%.8X EBP=%.8X ESI=%.8X EDI=%.8X fs=%d(%X) fs18=%X", cpu->eip.u32, cpu->reg[0].u32, cpu->reg[1].u32, cpu->reg[2].u32, cpu->reg[3].u32, cpu->reg[4].u32, cpu->reg[5].u32, cpu->reg[6].u32, cpu->reg[7].u32, cpu->seg[4].value, cpu->seg[4].address, cpu->seg[4].address ? readd(cpu->seg[4].address + 0x18) : 0);
1113#endif
1114 cpu->instructionCount = count;
1115 cpu->thread->inSignal--;
1116
1117 if (cpu->thread->waitingForSignalToEndMaskToRestore & RESTORE_SIGNAL_MASK) {
1118 cpu->thread->sigMask = cpu->thread->waitingForSignalToEndMaskToRestore & RESTORE_SIGNAL_MASK;
1119 cpu->thread->waitingForSignalToEndMaskToRestore = SIGSUSPEND_RETURN;
1120 }
1121
1122 {
1123 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(cpu->thread->waitingForSignalToEndCond);
1124 BOXEDWINE_CONDITION_SIGNAL_ALL(cpu->thread->waitingForSignalToEndCond);
1125 }
1126
1127 cpu->nextOp = cpu->getNextOp();
1128
1129 /*
1130 if (action->flags & K_SA_RESTORER) {
1131 push32(&thread->cpu, thread->cpu->eip.u32);
1132 thread->cpu->eip.u32 = action->restorer;
1133 while (thread->cpu->eip.u32!=savedState.eip.u32) {
1134 runCPU(&thread->cpu);
1135 }
1136 }
1137 */
1138}
1139
1140// interrupted and condStartWaitTime are pushed because syscall's during the signal will clobber them
1141void KThread::runSignal(U32 signal, U32 trapNo, U32 errorNo) {

Callers

nothing calls this directly

Calls 4

readFromContextFunction · 0.85
klogFunction · 0.85
getNextOpMethod · 0.80
pop32Method · 0.45

Tested by

no test coverage detected