add kip detection
This commit is contained in:
@@ -24,10 +24,7 @@
|
||||
#define CRASH(msg, ...) { ams::diag::AbortImpl(msg, __PRETTY_FUNCTION__, "", 0); __builtin_unreachable(); }
|
||||
|
||||
#include "customize.hpp"
|
||||
|
||||
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||
#include "oc_log.hpp"
|
||||
#endif
|
||||
#include "oc_log.hpp"
|
||||
|
||||
#define PATCH_OFFSET(offset, value) \
|
||||
static_assert(sizeof(__typeof__(offset)) <= sizeof(u64)); \
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace ams::ldr::hoc {
|
||||
|
||||
Result SmcCopyToIram(uintptr_t dest, const void *src, u32 size);
|
||||
void Log(const char *data, ...);
|
||||
void ViewLog();
|
||||
|
||||
|
||||
@@ -170,6 +170,12 @@ namespace ams::ldr::hoc::pcv {
|
||||
}
|
||||
}
|
||||
|
||||
void WriteKipLoadToIram() {
|
||||
const u32 hocMagic = 0x686F634D;
|
||||
constexpr uintptr_t LoadMagicAddress = 0x4003DC00 ; /* Should be a pretty safe address. */
|
||||
R_DISCARD(SmcCopyToIram(LoadMagicAddress, &hocMagic, sizeof(hocMagic)));
|
||||
}
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
SafetyCheck();
|
||||
|
||||
@@ -179,6 +185,8 @@ namespace ams::ldr::hoc::pcv {
|
||||
} else {
|
||||
erista::Patch(mapped_nso, nso_size);
|
||||
}
|
||||
|
||||
WriteKipLoadToIram();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user