XThread::StepToSafePoint - Handle cases where the thread hasn't started yet.
This commit is contained in:
parent
0f82e0d090
commit
f9de61ceed
|
@ -947,23 +947,31 @@ uint32_t XThread::StepToSafePoint() {
|
||||||
} else if (export_data) {
|
} else if (export_data) {
|
||||||
// Non-blocking. Run until we return from the thunk.
|
// Non-blocking. Run until we return from the thunk.
|
||||||
StepToAddress(uint32_t(thread_state_->context()->lr));
|
StepToAddress(uint32_t(thread_state_->context()->lr));
|
||||||
} else {
|
} else if (first_pc) {
|
||||||
// We're in the MMIO handler/mfmsr/something calling out of the guest
|
// We're in the MMIO handler/mfmsr/something calling out of the guest
|
||||||
// that doesn't use an export. If the current instruction is
|
// that doesn't use an export. If the current instruction is
|
||||||
// synchronizing, we can just save here. Otherwise, step forward
|
// synchronizing, we can just save here. Otherwise, step forward
|
||||||
// (and call ourselves again so we run the correct logic).
|
// (and call ourselves again so we run the correct logic).
|
||||||
cpu::frontend::InstrData i;
|
cpu::frontend::InstrData i;
|
||||||
i.address = first_pc;
|
i.address = first_pc;
|
||||||
i.code = xe::load_and_swap<uint32_t>(memory()->TranslateVirtual(first_pc));
|
i.code =
|
||||||
|
xe::load_and_swap<uint32_t>(memory()->TranslateVirtual(first_pc));
|
||||||
i.type = cpu::frontend::GetInstrType(i.code);
|
i.type = cpu::frontend::GetInstrType(i.code);
|
||||||
if (i.type->type & cpu::frontend::kXEPPCInstrTypeSynchronizeContext) {
|
if (i.type->type & cpu::frontend::kXEPPCInstrTypeSynchronizeContext) {
|
||||||
// Good to go.
|
// Good to go.
|
||||||
return first_pc;
|
pc = first_pc;
|
||||||
} else {
|
} else {
|
||||||
// Step forward.
|
// Step forward.
|
||||||
StepToAddress(first_pc + 4);
|
StepToAddress(first_pc + 4);
|
||||||
StepToSafePoint();
|
return StepToSafePoint();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// We've managed to catch a thread before it called into the guest.
|
||||||
|
// Set a breakpoint on its startup procedure and capture it there.
|
||||||
|
pc = creation_params_.xapi_thread_startup
|
||||||
|
? creation_params_.xapi_thread_startup
|
||||||
|
: creation_params_.start_address;
|
||||||
|
StepToAddress(pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue