Add RCM bug detection util

This commit is contained in:
Michael Scire 2019-04-01 17:22:38 -07:00
parent 37b74c7d75
commit b6ca2d89ae

View File

@ -16,6 +16,7 @@
#pragma once
#include <switch.h>
#include <cstdlib>
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;
}