| 53 | } sController; |
| 54 | |
| 55 | static bool |
| 56 | copyPauseContext(int core) |
| 57 | { |
| 58 | auto pauseContext = sController.pausedContexts[core]; |
| 59 | if (!pauseContext) { |
| 60 | return false; |
| 61 | } |
| 62 | |
| 63 | auto &context = sController.contexts[core]; |
| 64 | context.cia = pauseContext->cia; |
| 65 | context.nia = pauseContext->nia; |
| 66 | |
| 67 | for (auto i = 0u; i < 32; ++i) { |
| 68 | context.gpr[i] = pauseContext->gpr[i]; |
| 69 | context.fpr[i] = pauseContext->fpr[i].paired0; |
| 70 | context.ps1[i] = pauseContext->fpr[i].paired1; |
| 71 | } |
| 72 | |
| 73 | context.cr = pauseContext->cr.value; |
| 74 | context.xer = pauseContext->xer.value; |
| 75 | context.lr = pauseContext->lr; |
| 76 | context.ctr = pauseContext->ctr; |
| 77 | context.fpscr = pauseContext->fpscr.value; |
| 78 | context.pvr = pauseContext->pvr.value; |
| 79 | context.msr = pauseContext->msr.value; |
| 80 | |
| 81 | for (auto i = 0u; i < 16; ++i) { |
| 82 | context.sr[i] = pauseContext->sr[i]; |
| 83 | } |
| 84 | |
| 85 | for (auto i = 0u; i < 8; ++i) { |
| 86 | context.gqr[i] = pauseContext->gqr[i].value; |
| 87 | } |
| 88 | |
| 89 | context.dar = pauseContext->dar; |
| 90 | context.dsisr = pauseContext->dsisr; |
| 91 | context.srr0 = pauseContext->srr0; |
| 92 | |
| 93 | // If we are inside a kernel call we need to adjust gpr[1] due to how we |
| 94 | // use lazy stack frame creation |
| 95 | auto instr = mem::read<espresso::Instruction>(pauseContext->nia - 4); |
| 96 | auto data = espresso::decodeInstruction(instr); |
| 97 | if (data && data->id == espresso::InstructionID::kc) { |
| 98 | context.gpr[1] = pauseContext->systemCallStackHead; |
| 99 | } |
| 100 | |
| 101 | return true; |
| 102 | } |
| 103 | |
| 104 | bool |
| 105 | ready() |
no test coverage detected