SvcQueryDebugProcessMemory

This commit is contained in:
Michael Scire 2020-07-29 16:21:54 -07:00 committed by SciresM
parent 5de853b662
commit 3f17a34b67
3 changed files with 64 additions and 4 deletions

View file

@ -31,6 +31,23 @@ namespace ams::kern {
this->continue_flags = 0;
}
Result KDebugBase::QueryMemoryInfo(ams::svc::MemoryInfo *out_memory_info, ams::svc::PageInfo *out_page_info, KProcessAddress address) {
/* Lock ourselves. */
KScopedLightLock lk(this->lock);
/* Check that we have a valid process. */
R_UNLESS(this->process != nullptr, svc::ResultProcessTerminated());
R_UNLESS(!this->process->IsTerminated(), svc::ResultProcessTerminated());
/* Query the mapping's info. */
KMemoryInfo info;
R_TRY(process->GetPageTable().QueryInfo(std::addressof(info), out_page_info, address));
/* Write output. */
*out_memory_info = info.GetSvcMemoryInfo();
return ResultSuccess();
}
Result KDebugBase::Attach(KProcess *target) {
/* Check that the process isn't null. */
MESOSPHERE_ASSERT(target != nullptr);