kern: SvcQueryProcessMemory64, notification SvcBreaks

This commit is contained in:
Michael Scire 2020-07-24 08:50:31 -07:00 committed by SciresM
parent 5ecc80a5f6
commit cbecda2a27
2 changed files with 27 additions and 4 deletions

View file

@ -21,15 +21,30 @@ namespace ams::kern::svc {
namespace { namespace {
void Break(ams::svc::BreakReason break_reason, uintptr_t address, size_t size) {
/* Log for debug that Break was called. */
MESOSPHERE_LOG("%s: Break(%08x)\n", GetCurrentProcess().GetName(), static_cast<u32>(break_reason));
/* If the current process is attached to debugger, notify it. */
if (GetCurrentProcess().IsAttachedToDebugger()) {
MESOSPHERE_UNIMPLEMENTED();
}
/* If the break is only a notification, we're done. */
if ((break_reason & ams::svc::BreakReason_NotificationOnlyFlag) != 0) {
return;
}
/* TODO */
MESOSPHERE_UNIMPLEMENTED();
}
} }
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
void Break64(ams::svc::BreakReason break_reason, ams::svc::Address arg, ams::svc::Size size) { void Break64(ams::svc::BreakReason break_reason, ams::svc::Address arg, ams::svc::Size size) {
MESOSPHERE_LOG("%s: Break\n", GetCurrentProcess().GetName()); return Break(break_reason, arg, size);
MESOSPHERE_PANIC("Stubbed SvcBreak64 was called.");
} }
void ReturnFromException64(ams::Result result) { void ReturnFromException64(ams::Result result) {
@ -39,7 +54,7 @@ namespace ams::kern::svc {
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
void Break64From32(ams::svc::BreakReason break_reason, ams::svc::Address arg, ams::svc::Size size) { void Break64From32(ams::svc::BreakReason break_reason, ams::svc::Address arg, ams::svc::Size size) {
MESOSPHERE_PANIC("Stubbed SvcBreak64From32 was called."); return Break(break_reason, arg, size);
} }
void ReturnFromException64From32(ams::Result result) { void ReturnFromException64From32(ams::Result result) {

View file

@ -57,7 +57,15 @@ namespace ams::kern::svc {
} }
Result QueryProcessMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle process_handle, uint64_t address) { Result QueryProcessMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle process_handle, uint64_t address) {
MESOSPHERE_PANIC("Stubbed SvcQueryProcessMemory64 was called."); /* Get an ams::svc::MemoryInfo for the region. */
ams::svc::MemoryInfo info = {};
R_TRY(QueryProcessMemory(std::addressof(info), out_page_info, process_handle, address));
/* Try to copy to userspace. In the 64-bit case, ams::svc::lp64::MemoryInfo is the same as ams::svc::MemoryInfo. */
static_assert(sizeof(ams::svc::MemoryInfo) == sizeof(ams::svc::lp64::MemoryInfo));
R_TRY(out_memory_info.CopyFrom(std::addressof(info)));
return ResultSuccess();
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */