ldr: ifdef logging

This commit is contained in:
Lightos1
2026-07-26 21:36:12 +02:00
parent 9eb53f5a0b
commit 8c54df039f
4 changed files with 30 additions and 10 deletions

View File

@@ -19,7 +19,7 @@
#include "oc_common.hpp"
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
#ifdef HOC_IRAM_LOG
#include "fatal_handler_bin.h"
#endif
@@ -70,6 +70,8 @@ namespace ams::ldr::hoc {
return rc;
}
#ifdef HOC_UART_LOG
/* Remove this? */
void UartLog(const char *fmt, ...) {
char line[256];
constexpr size_t PrefixLen = 13; /* "[HOC] " */
@@ -92,6 +94,7 @@ namespace ams::ldr::hoc {
svc::OutputDebugString(line, len);
}
#endif
struct log_ctx_t {
u32 magic;
@@ -104,7 +107,7 @@ namespace ams::ldr::hoc {
#define IRAM_LOG_CTX_ADDR 0x4003C000
#define IRAM_LOG_MAX_SZ 4096
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
#ifdef HOC_IRAM_LOG
void Log(const char *data, ...) {
static const u32 max_log_sz = sizeof(working_buf) - sizeof(log_ctx_t);
static bool initDone = false;
@@ -135,8 +138,8 @@ namespace ams::ldr::hoc {
}
#endif
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
void ViewLog() {
#ifdef HOC_IRAM_LOG
if (spl::GetSocType() == spl::SocType_Mariko) {
return;
}
@@ -150,6 +153,6 @@ namespace ams::ldr::hoc {
SmcRebootToIramPayload();
while(true) { }
#endif
}
#endif
}