Introduce Platform::Log (#1640)

* Add Platform::Log and Platform::LogLevel

* Replace most printf calls with Platform::Log calls

* Move a brace down

* Move some log entries to one Log call

- Some implementations of Log may assume a full line

* Log the MAC address as LogLevel::Info
This commit is contained in:
Jesse Talavera-Greenberg
2023-03-23 13:04:38 -04:00
committed by GitHub
parent 19280cff2d
commit 79dfb8dc8f
50 changed files with 521 additions and 378 deletions

View File

@ -24,12 +24,16 @@
#include "ARMInterpreter.h"
#include "AREngine.h"
#include "ARMJIT.h"
#include "Platform.h"
#ifdef JIT_ENABLED
#include "ARMJIT.h"
#include "ARMJIT_Memory.h"
#endif
using Platform::Log;
using Platform::LogLevel;
// instruction timing notes
//
// * simple instruction: 1S (code)
@ -419,7 +423,7 @@ void ARM::RestoreCPSR()
break;
default:
printf("!! attempt to restore CPSR under bad mode %02X, %08X\n", CPSR&0x1F, R[15]);
Log(LogLevel::Warn, "!! attempt to restore CPSR under bad mode %02X, %08X\n", CPSR&0x1F, R[15]);
break;
}
@ -532,7 +536,7 @@ void ARM::TriggerIRQ()
void ARMv5::PrefetchAbort()
{
printf("ARM9: prefetch abort (%08X)\n", R[15]);
Log(LogLevel::Warn, "ARM9: prefetch abort (%08X)\n", R[15]);
u32 oldcpsr = CPSR;
CPSR &= ~0xBF;
@ -543,7 +547,7 @@ void ARMv5::PrefetchAbort()
// so better take care of it
if (!(PU_Map[ExceptionBase>>12] & 0x04))
{
printf("!!!!! EXCEPTION REGION NOT EXECUTABLE. THIS IS VERY BAD!!\n");
Log(LogLevel::Error, "!!!!! EXCEPTION REGION NOT EXECUTABLE. THIS IS VERY BAD!!\n");
NDS::Stop();
return;
}
@ -555,7 +559,7 @@ void ARMv5::PrefetchAbort()
void ARMv5::DataAbort()
{
printf("ARM9: data abort (%08X)\n", R[15]);
Log(LogLevel::Warn, "ARM9: data abort (%08X)\n", R[15]);
u32 oldcpsr = CPSR;
CPSR &= ~0xBF;
@ -679,7 +683,7 @@ void ARMv5::ExecuteJIT()
&& !ARMJIT::SetupExecutableRegion(0, instrAddr, FastBlockLookup, FastBlockLookupStart, FastBlockLookupSize))
{
NDS::ARM9Timestamp = NDS::ARM9Target;
printf("ARMv5 PC in non executable region %08X\n", R[15]);
Log(LogLevel::Error, "ARMv5 PC in non executable region %08X\n", R[15]);
return;
}
@ -830,7 +834,7 @@ void ARMv4::ExecuteJIT()
&& !ARMJIT::SetupExecutableRegion(1, instrAddr, FastBlockLookup, FastBlockLookupStart, FastBlockLookupSize))
{
NDS::ARM7Timestamp = NDS::ARM7Target;
printf("ARMv4 PC in non executable region %08X\n", R[15]);
Log(LogLevel::Error, "ARMv4 PC in non executable region %08X\n", R[15]);
return;
}