Merge branch 'large-mram'
This commit is contained in:
commit
b0ffa72e37
|
@ -27,6 +27,13 @@
|
|||
template <bool> struct CompileTimeAssert;
|
||||
template<> struct CompileTimeAssert<true> {};
|
||||
|
||||
#define b2(x) ( (x) | ( (x) >> 1) )
|
||||
#define b4(x) ( b2(x) | ( b2(x) >> 2) )
|
||||
#define b8(x) ( b4(x) | ( b4(x) >> 4) )
|
||||
#define b16(x) ( b8(x) | ( b8(x) >> 8) )
|
||||
#define b32(x) (b16(x) | (b16(x) >>16) )
|
||||
#define ROUND_UP_POW2(x) (b32(x - 1) + 1)
|
||||
|
||||
#if defined __GNUC__ && !defined __SSSE3__
|
||||
#include <emmintrin.h>
|
||||
static __inline __m128i __attribute__((__always_inline__))
|
||||
|
|
|
@ -66,7 +66,7 @@ bool CBoot::EmulatedBS2_GC()
|
|||
DVDInterface::DVDRead(0x00000000, 0x80000000, 0x20); // write disc info
|
||||
|
||||
Memory::Write_U32(0x0D15EA5E, 0x80000020); // booted from bootrom. 0xE5207C22 = booted from jtag
|
||||
Memory::Write_U32(0x01800000, 0x80000028); // Physical Memory Size (24MB on retail)
|
||||
Memory::Write_U32(Memory::REALRAM_SIZE, 0x80000028); // Physical Memory Size (24MB on retail)
|
||||
// TODO determine why some games fail when using a retail id. (Seem to take different EXI paths, see ikaruga for example)
|
||||
Memory::Write_U32(0x10000006, 0x8000002C); // Console type - DevKit (retail ID == 0x00000003) see yagcd 4.2.1.1.2
|
||||
|
||||
|
@ -172,7 +172,6 @@ bool CBoot::EmulatedBS2_GC()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
|
||||
{
|
||||
INFO_LOG(BOOT, "Setup Wii Memory...");
|
||||
|
@ -238,14 +237,14 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
|
|||
DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20); // Game Code
|
||||
Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
|
||||
Memory::Write_U32(0x00000001, 0x00000024); // Unknown
|
||||
Memory::Write_U32(0x01800000, 0x00000028); // MEM1 size 24MB
|
||||
Memory::Write_U32(Memory::REALRAM_SIZE, 0x00000028); // MEM1 size 24MB
|
||||
Memory::Write_U32(0x00000023, 0x0000002c); // Production Board Model
|
||||
Memory::Write_U32(0x00000000, 0x00000030); // Init
|
||||
Memory::Write_U32(0x817FEC60, 0x00000034); // Init
|
||||
// 38, 3C should get start, size of FST through apploader
|
||||
Memory::Write_U32(0x38a00040, 0x00000060); // Exception init
|
||||
Memory::Write_U32(0x8008f7b8, 0x000000e4); // Thread Init
|
||||
Memory::Write_U32(0x01800000, 0x000000f0); // "Simulated memory size" (debug mode?)
|
||||
Memory::Write_U32(Memory::REALRAM_SIZE, 0x000000f0); // "Simulated memory size" (debug mode?)
|
||||
Memory::Write_U32(0x8179b500, 0x000000f4); // __start
|
||||
Memory::Write_U32(0x0e7be2c0, 0x000000f8); // Bus speed
|
||||
Memory::Write_U32(0x2B73A840, 0x000000fc); // CPU speed
|
||||
|
|
|
@ -69,9 +69,10 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
|
|||
char ArgumentBuffer[256];
|
||||
u32 ParameterCounter = 4;
|
||||
u32 FloatingParameterCounter = 1;
|
||||
char* pString = (char*)Memory::GetPointer(GPR(strReg));
|
||||
if (!pString) {
|
||||
//PanicAlert("Invalid GetStringVA call");
|
||||
char *pString = (char*)Memory::GetPointer(GPR(strReg));
|
||||
if (!pString)
|
||||
{
|
||||
ERROR_LOG(OSREPORT, "r%i invalid", strReg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -625,69 +625,57 @@ void GetString(std::string& _string, const u32 em_address)
|
|||
|
||||
// GetPointer must always return an address in the bottom 32 bits of address space, so that 64-bit
|
||||
// programs don't have problems directly addressing any part of memory.
|
||||
// TODO re-think with respect to other BAT setups...
|
||||
u8 *GetPointer(const u32 _Address)
|
||||
{
|
||||
switch (_Address >> 24)
|
||||
switch (_Address >> 28)
|
||||
{
|
||||
case 0x00:
|
||||
case 0x01:
|
||||
case 0x80:
|
||||
case 0x81:
|
||||
case 0xC0:
|
||||
case 0xC1:
|
||||
return (u8*)(((char*)m_pPhysicalRAM) + (_Address & RAM_MASK));
|
||||
case 0x0:
|
||||
case 0x8:
|
||||
return m_pPhysicalRAM + (_Address & RAM_MASK);
|
||||
case 0xc:
|
||||
switch (_Address >> 24)
|
||||
{
|
||||
case 0xcc:
|
||||
case 0xcd:
|
||||
_dbg_assert_msg_(MEMMAP, 0, "GetPointer from IO Bridge doesnt work");
|
||||
case 0xc8:
|
||||
// EFB. We don't want to return a pointer here since we have no memory mapped for it.
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x12:
|
||||
case 0x13:
|
||||
case 0x90:
|
||||
case 0x91:
|
||||
case 0x92:
|
||||
case 0x93:
|
||||
case 0xD0:
|
||||
case 0xD1:
|
||||
case 0xD2:
|
||||
case 0xD3:
|
||||
default:
|
||||
return m_pPhysicalRAM + (_Address & RAM_MASK);
|
||||
}
|
||||
|
||||
case 0x1:
|
||||
case 0x9:
|
||||
case 0xd:
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
||||
return (u8*)(((char*)m_pPhysicalEXRAM) + (_Address & EXRAM_MASK));
|
||||
return m_pPhysicalEXRAM + (_Address & EXRAM_MASK);
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 0xE0:
|
||||
case 0xe:
|
||||
if (_Address < (0xE0000000 + L1_CACHE_SIZE))
|
||||
return GetCachePtr() + (_Address & L1_CACHE_MASK);
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 0xC8:
|
||||
return 0; // EFB. We don't want to return a pointer here since we have no memory mapped for it.
|
||||
|
||||
case 0xCC:
|
||||
case 0xCD:
|
||||
_dbg_assert_msg_(MEMMAP, 0, "GetPointer from IO Bridge doesnt work");
|
||||
return NULL;
|
||||
default:
|
||||
if (bFakeVMEM)
|
||||
{
|
||||
return (u8*)(((char*)m_pVirtualFakeVMEM) + (_Address & RAM_MASK));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Core::g_CoreStartupParameter.bMMU &&
|
||||
!PanicYesNoT("Unknown pointer %#08x\nContinue?", _Address))
|
||||
Crash();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
return m_pVirtualFakeVMEM + (_Address & FAKEVMEM_MASK);
|
||||
}
|
||||
|
||||
ERROR_LOG(MEMMAP, "Unknown Pointer %#8x PC %#8x LR %#8x", _Address, PC, LR);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool IsRAMAddress(const u32 addr, bool allow_locked_cache)
|
||||
{
|
||||
switch ((addr >> 24) & 0xFC) {
|
||||
switch ((addr >> 24) & 0xFC)
|
||||
{
|
||||
case 0x00:
|
||||
case 0x80:
|
||||
case 0xC0:
|
||||
|
|
|
@ -58,20 +58,22 @@ extern u8 *m_pL1Cache;
|
|||
|
||||
enum
|
||||
{
|
||||
// The size should be just 24MB instead of 32, but the RAM_MASK wouldn't
|
||||
// work.
|
||||
RAM_SIZE = 0x2000000,
|
||||
RAM_MASK = 0x1FFFFFF,
|
||||
// RAM_SIZE is the amount allocated by the emulator, whereas REALRAM_SIZE is
|
||||
// what will be reported in lowmem, and thus used by emulated software.
|
||||
// Note: Writing to lowmem is done by IPL. If using retail IPL, it will
|
||||
// always be set to 24MB.
|
||||
REALRAM_SIZE = 0x1800000,
|
||||
RAM_SIZE = ROUND_UP_POW2(REALRAM_SIZE),
|
||||
RAM_MASK = RAM_SIZE - 1,
|
||||
FAKEVMEM_SIZE = 0x2000000,
|
||||
FAKEVMEM_MASK = 0x1FFFFFF,
|
||||
REALRAM_SIZE = 0x1800000,
|
||||
FAKEVMEM_MASK = FAKEVMEM_SIZE - 1,
|
||||
L1_CACHE_SIZE = 0x40000,
|
||||
L1_CACHE_MASK = 0x3FFFF,
|
||||
L1_CACHE_MASK = L1_CACHE_SIZE - 1,
|
||||
EFB_SIZE = 0x200000,
|
||||
EFB_MASK = 0x1FFFFF,
|
||||
EFB_MASK = EFB_SIZE - 1,
|
||||
IO_SIZE = 0x10000,
|
||||
EXRAM_SIZE = 0x4000000,
|
||||
EXRAM_MASK = 0x3FFFFFF,
|
||||
EXRAM_MASK = EXRAM_SIZE - 1,
|
||||
|
||||
ADDR_MASK_HW_ACCESS = 0x0c000000,
|
||||
ADDR_MASK_MEM1 = 0x20000000,
|
||||
|
|
|
@ -418,7 +418,10 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
}
|
||||
|
||||
if (em_address == 0)
|
||||
PanicAlert("ERROR : Trying to compile at 0. LR=%08x", LR);
|
||||
{
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
PanicAlert("ERROR: Compiling at 0. LR=%08x CTR=%08x", LR, CTR);
|
||||
}
|
||||
|
||||
if (Core::g_CoreStartupParameter.bMMU && (em_address & JIT_ICACHE_VMEM_BIT))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue