diff --git a/exosphere/src/configitem.c b/exosphere/src/configitem.c index 2eac9036e..4579e506c 100644 --- a/exosphere/src/configitem.c +++ b/exosphere/src/configitem.c @@ -264,6 +264,10 @@ uint32_t configitem_get(bool privileged, ConfigItem item, uint64_t *p_outvalue) /* UNOFFICIAL: Gets information about the current exosphere git commit hash. */ *p_outvalue = ATMOSPHERE_RELEASE_VERSION_HASH; break; + case CONFIGITEM_HAS_RCM_BUG_PATCH: + /* UNOFFICIAL: Gets whether this unit has the RCM bug patched. */ + *p_outvalue = (int)(fuse_has_rcm_bug_patch());; + break; default: result = 2; break; diff --git a/exosphere/src/configitem.h b/exosphere/src/configitem.h index e62a2266b..756d461ff 100644 --- a/exosphere/src/configitem.h +++ b/exosphere/src/configitem.h @@ -44,6 +44,7 @@ typedef enum { CONFIGITEM_NEEDS_REBOOT = 65001, CONFIGITEM_NEEDS_SHUTDOWN = 65002, CONFIGITEM_EXOSPHERE_VERHASH = 65003, + CONFIGITEM_HAS_RCM_BUG_PATCH = 65004, } ConfigItem; #define REBOOT_KIND_NO_REBOOT 0 diff --git a/exosphere/src/fuse.c b/exosphere/src/fuse.c index b33459f42..cd162256b 100644 --- a/exosphere/src/fuse.c +++ b/exosphere/src/fuse.c @@ -23,6 +23,7 @@ #include "exocfg.h" #include "masterkey.h" + /* Prototypes for internal commands. */ void fuse_make_regs_visible(void); @@ -257,3 +258,9 @@ void fuse_get_hardware_info(void *dst) { memcpy(dst, hw_info, 0x10); } + +bool fuse_has_rcm_bug_patch(void) { + /* Patched units have this bit set in reserved_sw, according to reports. */ + /* TODO: Is there an ipatch we should check? This should be researched. */ + return (FUSE_CHIP_REGS->FUSE_RESERVED_SW & 0x80) != 0; +} diff --git a/exosphere/src/fuse.h b/exosphere/src/fuse.h index 9176893df..c1c8dca81 100644 --- a/exosphere/src/fuse.h +++ b/exosphere/src/fuse.h @@ -215,4 +215,6 @@ uint32_t fuse_get_hardware_type(void); uint32_t fuse_get_retail_type(void); void fuse_get_hardware_info(void *dst); +bool fuse_has_rcm_bug_patch(void); + #endif