Merge pull request #1424 from phire/memmapPtrCleanup
Memmap pointer cleanup.
This commit is contained in:
commit
6698bfe58e
|
@ -65,23 +65,21 @@ 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;
|
||||
|
||||
// 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
|
||||
static u8* m_pVirtualL1Cache;
|
||||
u8* m_pVirtualFakeVMEM;
|
||||
|
||||
// MMIO mapping object.
|
||||
MMIO::Mapping* mmio_mapping;
|
||||
|
@ -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)
|
||||
|
@ -231,7 +226,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 +240,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 +254,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 +273,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 +307,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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue