From d09fb82113e0a912a66872baa0dd6f1f5c1ef315 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 20 Dec 2018 23:40:30 -0500 Subject: [PATCH] kernel/process_capability: Handle debug capability flags --- src/core/hle/kernel/process_capability.cpp | 8 +++++++- src/core/hle/kernel/process_capability.h | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index 7ee0ad9cc3..3a2164b25a 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp @@ -342,7 +342,13 @@ ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) { } ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) { - // TODO: Implement + const u32 reserved = flags >> 19; + if (reserved != 0) { + return ERR_RESERVED_VALUE; + } + + is_debuggable = (flags & 0x20000) != 0; + can_force_debug = (flags & 0x40000) != 0; return RESULT_SUCCESS; } diff --git a/src/core/hle/kernel/process_capability.h b/src/core/hle/kernel/process_capability.h index 7b9f24d518..fbc8812a3f 100644 --- a/src/core/hle/kernel/process_capability.h +++ b/src/core/hle/kernel/process_capability.h @@ -165,6 +165,17 @@ public: return kernel_version; } + /// Whether or not this process can be debugged. + bool IsDebuggable() const { + return is_debuggable; + } + + /// Whether or not this process can forcibly debug another + /// process, even if that process is not considered debuggable. + bool CanForceDebug() const { + return can_force_debug; + } + private: /// Attempts to parse a given sequence of capability descriptors. ///