-converted tabs to spaces
-moved scratchpad memory out of MemArena
This commit is contained in:
parent
81b61ee720
commit
e05be0145c
2 changed files with 144 additions and 148 deletions
|
@ -37,32 +37,22 @@ u8* g_base = NULL; ///< The base pointer to the auto-mirrored arena.
|
||||||
|
|
||||||
MemArena g_arena; ///< The MemArena class
|
MemArena g_arena; ///< The MemArena class
|
||||||
|
|
||||||
u8* g_bootrom = NULL; ///< Bootrom memory (super secret code/data @ 0x8000) pointer
|
u8* g_bootrom = NULL; ///< Bootrom physical memory
|
||||||
u8* g_fcram = NULL; ///< Main memory (FCRAM) pointer
|
u8* g_fcram = NULL; ///< Main memory (FCRAM) pointer
|
||||||
u8* g_vram = NULL; ///< Video memory (VRAM) pointer
|
u8* g_vram = NULL; ///< Video memory (VRAM) pointer
|
||||||
u8* g_scratchpad = NULL; ///< [Hack] Seperate mem for stack space because I don't know where this goes
|
u8* g_scratchpad = NULL; ///< Scratchpad memory - Used for main thread stack
|
||||||
|
|
||||||
u8* g_physical_bootrom = NULL; ///< Bootrom physical memory (super secret code/data @ 0x8000)
|
u8* g_physical_bootrom = NULL; ///< Bootrom physical memory
|
||||||
u8* g_uncached_bootrom = NULL;
|
u8* g_uncached_bootrom = NULL;
|
||||||
|
|
||||||
u8* g_physical_fcram = NULL; ///< Main physical memory (FCRAM)
|
u8* g_physical_fcram = NULL; ///< Main physical memory (FCRAM)
|
||||||
u8* g_physical_vram = NULL; ///< Video physical memory (VRAM)
|
u8* g_physical_vram = NULL; ///< Video physical memory (VRAM)
|
||||||
u8* g_physical_scratchpad = NULL; ///< Scratchpad memory used for main thread stack
|
u8* g_physical_scratchpad = NULL; ///< Scratchpad memory used for main thread stack
|
||||||
|
|
||||||
|
|
||||||
// We don't declare the IO region in here since its handled by other means.
|
// We don't declare the IO region in here since its handled by other means.
|
||||||
static MemoryView g_views[] =
|
static MemoryView g_views[] = {
|
||||||
{
|
{ &g_vram, &g_physical_vram, MEM_VRAM_VADDR, MEM_VRAM_SIZE, 0 },
|
||||||
{&g_scratchpad, &g_physical_scratchpad, 0x00000000, MEM_SCRATCHPAD_SIZE, 0 },
|
{ &g_fcram, &g_physical_fcram, MEM_FCRAM_VADDR, MEM_FCRAM_SIZE, MV_IS_PRIMARY_RAM },
|
||||||
// {&g_bootrom, &g_physical_bootrom, 0x00000000, MEM_BOOTROM_SIZE, 0},
|
|
||||||
// {NULL, &g_uncached_bootrom, 0x00010000, MEM_BOOTROM_SIZE, MV_MIRROR_PREVIOUS},
|
|
||||||
// {NULL, NULL, 0x17E00000, MEM_MPCORE_PRIV_SIZE, 0},
|
|
||||||
{&g_vram, &g_physical_vram, MEM_VRAM_VADDR, MEM_VRAM_SIZE, MV_IS_PRIMARY_RAM},
|
|
||||||
// {NULL, NULL, 0x1FF00000, MEM_DSP_SIZE, 0},
|
|
||||||
// {NULL, NULL, 0x1FF80000, MEM_AXI_WRAM_SIZE, 0},
|
|
||||||
|
|
||||||
{&g_fcram, &g_physical_fcram, MEM_FCRAM_VADDR, MEM_FCRAM_SIZE, MV_IS_PRIMARY_RAM},
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*static MemoryView views[] =
|
/*static MemoryView views[] =
|
||||||
|
@ -91,6 +81,8 @@ void Init() {
|
||||||
|
|
||||||
g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &g_arena);
|
g_base = MemoryMap_Setup(g_views, kNumMemViews, flags, &g_arena);
|
||||||
|
|
||||||
|
g_scratchpad = new u8[MEM_SCRATCHPAD_SIZE];
|
||||||
|
|
||||||
NOTICE_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirror at 0 @ %p)", g_fcram,
|
NOTICE_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirror at 0 @ %p)", g_fcram,
|
||||||
g_physical_fcram);
|
g_physical_fcram);
|
||||||
}
|
}
|
||||||
|
@ -98,8 +90,13 @@ void Init() {
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
u32 flags = 0;
|
u32 flags = 0;
|
||||||
MemoryMap_Shutdown(g_views, kNumMemViews, flags, &g_arena);
|
MemoryMap_Shutdown(g_views, kNumMemViews, flags, &g_arena);
|
||||||
|
|
||||||
g_arena.ReleaseSpace();
|
g_arena.ReleaseSpace();
|
||||||
|
delete[] g_scratchpad;
|
||||||
|
|
||||||
g_base = NULL;
|
g_base = NULL;
|
||||||
|
g_scratchpad = NULL;
|
||||||
|
|
||||||
NOTICE_LOG(MEMMAP, "Memory system shut down.");
|
NOTICE_LOG(MEMMAP, "Memory system shut down.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,7 @@
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void ReadFromHardware(T &var, const u32 addr)
|
inline void ReadFromHardware(T &var, const u32 addr) {
|
||||||
{
|
|
||||||
// TODO: Figure out the fastest order of tests for both read and write (they are probably different).
|
// TODO: Figure out the fastest order of tests for both read and write (they are probably different).
|
||||||
// TODO: Make sure this represents the mirrors in a correct way.
|
// TODO: Make sure this represents the mirrors in a correct way.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue