From b6ca2d89ae5106ea21454f332f07076159ad2e92 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 1 Apr 2019 17:22:38 -0700 Subject: [PATCH] Add RCM bug detection util --- include/stratosphere/utilities.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/stratosphere/utilities.hpp b/include/stratosphere/utilities.hpp index ae98e501..3f171b40 100644 --- a/include/stratosphere/utilities.hpp +++ b/include/stratosphere/utilities.hpp @@ -16,6 +16,7 @@ #pragma once #include +#include static inline void RebootToRcm() { SecmonArgs args = {0}; @@ -79,3 +80,20 @@ static inline Result SmcGetConfig(SplConfigItem config_item, u64 *out_config) { } return rc; } + +static inline Result GetRcmBugPatched(bool *out) { + u64 tmp = 0; + Result rc = SmcGetConfig((SplConfigItem)65004, &tmp); + if (R_SUCCEEDED(rc)) { + *out = (tmp != 0); + } + return rc; +} + +static inline bool IsRcmBugPatched() { + bool rcm_bug_patched; + if (R_FAILED(GetRcmBugPatched(&rcm_bug_patched))) { + std::abort(); + } + return rcm_bug_patched; +}