From fca5e176b381e052d11e273540602552091c524e Mon Sep 17 00:00:00 2001 From: magumagu Date: Sun, 22 Feb 2015 20:51:50 -0800 Subject: [PATCH] Correctly set up MSR and BAT registers for ELF loading. --- Source/Core/Core/Boot/Boot_ELF.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/Core/Core/Boot/Boot_ELF.cpp b/Source/Core/Core/Boot/Boot_ELF.cpp index d41c95c1ba..fd9d0ee0cc 100644 --- a/Source/Core/Core/Boot/Boot_ELF.cpp +++ b/Source/Core/Core/Boot/Boot_ELF.cpp @@ -67,6 +67,25 @@ bool CBoot::Boot_ELF(const std::string& filename) if(!reader.LoadIntoMemory()) return false; + // Set up MSR and the BAT SPR registers. + UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr); + m_MSR.FP = 1; + m_MSR.DR = 1; + m_MSR.IR = 1; + m_MSR.EE = 1; + PowerPC::ppcState.spr[SPR_IBAT0U] = 0x80001fff; + PowerPC::ppcState.spr[SPR_IBAT0L] = 0x00000002; + PowerPC::ppcState.spr[SPR_IBAT4U] = 0x90001fff; + PowerPC::ppcState.spr[SPR_IBAT4L] = 0x10000002; + PowerPC::ppcState.spr[SPR_DBAT0U] = 0x80001fff; + PowerPC::ppcState.spr[SPR_DBAT0L] = 0x00000002; + PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff; + PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a; + PowerPC::ppcState.spr[SPR_DBAT4U] = 0x90001fff; + PowerPC::ppcState.spr[SPR_DBAT4L] = 0x10000002; + PowerPC::ppcState.spr[SPR_DBAT5U] = 0xd0001fff; + PowerPC::ppcState.spr[SPR_DBAT5L] = 0x1000002a; + if (!reader.LoadSymbols()) { if (LoadMapFromFilename())