MCPcopy Create free account
hub / github.com/decaf-emu/decaf-emu / copyPauseContext

Function copyPauseContext

src/libdecaf/src/debug_api/debug_api_controller.cpp:55–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53} sController;
54
55static bool
56copyPauseContext(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
104bool
105ready()

Callers 1

Calls 1

decodeInstructionFunction · 0.85

Tested by

no test coverage detected