add kip detection

This commit is contained in:
Lightos1 committed 2026-06-27 19:47:00 +02:00
1 parent cd9d494de9
commit f3886c60b0
8 files changed
+71 -7

No files matched your search

+21 -1
View File
@@ -19,9 +19,9 @@
#include "../i2c/i2cDrv.h"
#include "../mgr/clock_manager.hpp"
#include "file_utils.hpp"
#include "../mapping/mem_map.hpp"
#include "kip.hpp"
namespace kip {
bool kipAvailable = false;
@@ -172,6 +172,24 @@ namespace kip {
}
}
bool IsKipLoaded() {
constexpr u32 ExpectedMagic = 0x686F634D;
constexpr uintptr_t LoadMagicAddress = 0x4003DC00;
u32 iramValue = {};
SmcCopyFromIram(&iramValue, LoadMagicAddress, sizeof(iramValue));
if (iramValue == ExpectedMagic) {
iramValue = 0;
SmcCopyToIram(LoadMagicAddress, &iramValue, sizeof(iramValue));
return true;
}
notification::writeNotification("Kip is not loaded!");
fileUtils::LogLine("Kip was not loaded!");
return false;
}
// I know this is very hacky, but the config system in the sysmodule doesn't really support writing
void GetKipData() {
@@ -231,6 +249,7 @@ namespace kip {
return;
}
clockManager::gContext.isKipLoaded = IsKipLoaded();
clockManager::gContext.kipVersion = kipVersion;
configValues.values[KipConfigValue_custRev] = cust_get_cust_rev(&table);
configValues.values[KipConfigValue_KipVersion] = cust_get_kip_version(&table); // Run this after the check so we can do migration process
@@ -350,4 +369,5 @@ namespace kip {
}
config::SetConfigValues(&configValues, true);
}
} // namespace kip