From 125cd92c3c56786d1520f10528552d2a4ed476f8 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Tue, 28 Oct 2014 23:54:37 +1300 Subject: [PATCH 1/3] Update pointer types in memmap.cpp to match dolphin style guide. --- Source/Core/Core/HW/Memmap.cpp | 42 +++++++++++++++++----------------- Source/Core/Core/HW/Memmap.h | 12 +++++----- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index f3f95e4a1c..52290a4dbd 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -65,23 +65,23 @@ static bool m_IsInitialized = false; // Save the Init(), Shutdown() state // 64-bit: Pointers to low-mem (sub-0x10000000) mirror // 32-bit: Same as the corresponding physical/virtual pointers. -u8 *m_pRAM; -u8 *m_pL1Cache; -u8 *m_pEXRAM; -u8 *m_pFakeVMEM; -//u8 *m_pEFB; +u8* m_pRAM; +u8* m_pL1Cache; +u8* m_pEXRAM; +u8* m_pFakeVMEM; +//u8* m_pEFB; // 64-bit: Pointers to high-mem mirrors // 32-bit: Same as above -static u8 *m_pPhysicalRAM; -static u8 *m_pVirtualCachedRAM; -static u8 *m_pVirtualUncachedRAM; -static u8 *m_pPhysicalEXRAM; // wii only -static u8 *m_pVirtualCachedEXRAM; // wii only -static u8 *m_pVirtualUncachedEXRAM; // wii only -//u8 *m_pVirtualEFB; -static u8 *m_pVirtualL1Cache; -u8 *m_pVirtualFakeVMEM; +static u8* m_pPhysicalRAM; +static u8* m_pVirtualCachedRAM; +static u8* m_pVirtualUncachedRAM; +static u8* m_pPhysicalEXRAM; // wii only +static u8* m_pVirtualCachedEXRAM; // wii only +static u8* m_pVirtualUncachedEXRAM; // wii only +//u8* m_pVirtualEFB; +static u8* m_pVirtualL1Cache; +u8* m_pVirtualFakeVMEM; // MMIO mapping object. MMIO::Mapping* mmio_mapping; @@ -231,7 +231,7 @@ void CopyToEmu(u32 address, const void* data, size_t size) void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) { - u8 *ptr = GetPointer(_Address); + u8* ptr = GetPointer(_Address); if (ptr != nullptr) { memset(ptr,_iValue,_iLength); @@ -245,7 +245,7 @@ void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) void ClearCacheLine(const u32 _Address) { - u8 *ptr = GetPointer(_Address); + u8* ptr = GetPointer(_Address); if (ptr != nullptr) { memset(ptr, 0, 32); @@ -259,8 +259,8 @@ void ClearCacheLine(const u32 _Address) void DMA_LCToMemory(const u32 _MemAddr, const u32 _CacheAddr, const u32 _iNumBlocks) { - const u8 *src = m_pL1Cache + (_CacheAddr & 0x3FFFF); - u8 *dst = GetPointer(_MemAddr); + const u8* src = m_pL1Cache + (_CacheAddr & 0x3FFFF); + u8* dst = GetPointer(_MemAddr); if ((dst != nullptr) && (src != nullptr) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) { @@ -278,8 +278,8 @@ void DMA_LCToMemory(const u32 _MemAddr, const u32 _CacheAddr, const u32 _iNumBlo void DMA_MemoryToLC(const u32 _CacheAddr, const u32 _MemAddr, const u32 _iNumBlocks) { - const u8 *src = GetPointer(_MemAddr); - u8 *dst = m_pL1Cache + (_CacheAddr & 0x3FFFF); + const u8* src = GetPointer(_MemAddr); + u8* dst = m_pL1Cache + (_CacheAddr & 0x3FFFF); if ((dst != nullptr) && (src != nullptr) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) { @@ -312,7 +312,7 @@ std::string GetString(u32 em_address, size_t size) // 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) +u8* GetPointer(const u32 _Address) { switch (_Address >> 28) { diff --git a/Source/Core/Core/HW/Memmap.h b/Source/Core/Core/HW/Memmap.h index 93494487f9..b00e79270f 100644 --- a/Source/Core/Core/HW/Memmap.h +++ b/Source/Core/Core/HW/Memmap.h @@ -27,14 +27,14 @@ namespace Memory // In 64-bit, this might point to "high memory" (above the 32-bit limit), // so be sure to load it into a 64-bit register. -extern u8 *base; +extern u8* base; // These are guaranteed to point to "low memory" addresses (sub-32-bit). -extern u8 *m_pRAM; -extern u8 *m_pEXRAM; -extern u8 *m_pL1Cache; -extern u8 *m_pVirtualFakeVMEM; -extern u8 *m_pFakeVMEM; +extern u8* m_pRAM; +extern u8* m_pEXRAM; +extern u8* m_pL1Cache; +extern u8* m_pVirtualFakeVMEM; +extern u8* m_pFakeVMEM; extern bool bFakeVMEM; enum From a6671645d69fb054bb07b3ba2d782b5abce764bf Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Tue, 28 Oct 2014 23:58:54 +1300 Subject: [PATCH 2/3] Remove commented out EFB arena code. --- Source/Core/Core/HW/Memmap.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index 52290a4dbd..4c59a642ce 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -69,7 +69,6 @@ u8* m_pRAM; u8* m_pL1Cache; u8* m_pEXRAM; u8* m_pFakeVMEM; -//u8* m_pEFB; // 64-bit: Pointers to high-mem mirrors // 32-bit: Same as above @@ -79,7 +78,6 @@ static u8* m_pVirtualUncachedRAM; static u8* m_pPhysicalEXRAM; // wii only static u8* m_pVirtualCachedEXRAM; // wii only static u8* m_pVirtualUncachedEXRAM; // wii only -//u8* m_pVirtualEFB; static u8* m_pVirtualL1Cache; u8* m_pVirtualFakeVMEM; @@ -126,9 +124,7 @@ static const MemoryView views[] = // Don't map any memory for the EFB. We want all access to this area to go // through the hardware access handlers. -#if _ARCH_32 -// {&m_pEFB, &m_pVirtualEFB, 0xC8000000, EFB_SIZE, 0}, -#endif + {&m_pL1Cache, &m_pVirtualL1Cache, 0xE0000000, L1_CACHE_SIZE, 0}, {&m_pFakeVMEM, &m_pVirtualFakeVMEM, 0x7E000000, FAKEVMEM_SIZE, MV_FAKE_VMEM}, @@ -170,7 +166,6 @@ void DoState(PointerWrap &p) { bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii; p.DoArray(m_pPhysicalRAM, RAM_SIZE); - //p.DoArray(m_pVirtualEFB, EFB_SIZE); p.DoArray(m_pVirtualL1Cache, L1_CACHE_SIZE); p.DoMarker("Memory RAM"); if (bFakeVMEM) From 1fbf4ae58a5fc30c9beb7a94822590321bfd35bd Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Wed, 29 Oct 2014 00:01:02 +1300 Subject: [PATCH 3/3] Round up 7 nibble constants to 8 nibbles, for readablity. --- Source/Core/Core/HW/Memmap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/HW/Memmap.h b/Source/Core/Core/HW/Memmap.h index b00e79270f..e10eec6cbf 100644 --- a/Source/Core/Core/HW/Memmap.h +++ b/Source/Core/Core/HW/Memmap.h @@ -43,17 +43,17 @@ enum // 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, + REALRAM_SIZE = 0x01800000, RAM_SIZE = ROUND_UP_POW2(REALRAM_SIZE), RAM_MASK = RAM_SIZE - 1, - FAKEVMEM_SIZE = 0x2000000, + FAKEVMEM_SIZE = 0x02000000, FAKEVMEM_MASK = FAKEVMEM_SIZE - 1, L1_CACHE_SIZE = 0x40000, L1_CACHE_MASK = L1_CACHE_SIZE - 1, EFB_SIZE = 0x200000, EFB_MASK = EFB_SIZE - 1, IO_SIZE = 0x10000, - EXRAM_SIZE = 0x4000000, + EXRAM_SIZE = 0x04000000, EXRAM_MASK = EXRAM_SIZE - 1, ADDR_MASK_HW_ACCESS = 0x0c000000,