Always clear memory when booting

Reading uninitalized memory is non-deterministic. We used to only
clear the memory when using EmulatedBS2_GC or FifoPlayer, but we
now do it during Memory::Init instead so it always gets done.
This commit is contained in:
JosJuice 2016-04-01 21:35:26 +02:00
parent 486d3a7114
commit 2db2672810
3 changed files with 6 additions and 7 deletions

View File

@ -50,9 +50,6 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff; PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff;
PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a; PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a;
// Clear ALL memory
Memory::Clear();
// Write necessary values // Write necessary values
// Here we write values to memory that the apploader does not take care of. Game info goes // Here we write values to memory that the apploader does not take care of. Game info goes
// to 0x80000000 according to YAGCD 4.2. // to 0x80000000 according to YAGCD 4.2.

View File

@ -380,8 +380,6 @@ void FifoPlayer::LoadMemory()
PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff; PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff;
PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a; PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a;
Memory::Clear();
SetupFifo(); SetupFifo();
u32 *regs = m_File->GetBPMem(); u32 *regs = m_File->GetBPMem();

View File

@ -180,8 +180,10 @@ void Init()
#endif #endif
u32 flags = 0; u32 flags = 0;
if (wii) flags |= MV_WII_ONLY; if (wii)
if (bFakeVMEM) flags |= MV_FAKE_VMEM; flags |= MV_WII_ONLY;
if (bFakeVMEM)
flags |= MV_FAKE_VMEM;
physical_base = MemoryMap_Setup(views, num_views, flags, &g_arena); physical_base = MemoryMap_Setup(views, num_views, flags, &g_arena);
#ifndef _ARCH_32 #ifndef _ARCH_32
logical_base = physical_base + 0x200000000; logical_base = physical_base + 0x200000000;
@ -192,6 +194,8 @@ void Init()
else else
mmio_mapping = InitMMIO(); mmio_mapping = InitMMIO();
Clear();
INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p", m_pRAM); INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p", m_pRAM);
m_IsInitialized = true; m_IsInitialized = true;
} }