Memmap: Remove unused global pointers to memory areas
This commit is contained in:
parent
0a60aa75c2
commit
88365a23e7
|
@ -21,18 +21,9 @@
|
||||||
|
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
|
|
||||||
u8* g_exefs_code; ///< ExeFS:/.code is loaded here
|
|
||||||
u8* g_heap; ///< Application heap (main memory)
|
|
||||||
u8* g_shared_mem; ///< Shared memory
|
|
||||||
u8* g_heap_linear; ///< Linear heap
|
|
||||||
u8* g_vram; ///< Video memory (VRAM) pointer
|
|
||||||
u8* g_dsp_mem; ///< DSP memory
|
|
||||||
u8* g_tls_mem; ///< TLS memory
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct MemoryArea {
|
struct MemoryArea {
|
||||||
u8** ptr;
|
|
||||||
u32 base;
|
u32 base;
|
||||||
u32 size;
|
u32 size;
|
||||||
const char* name;
|
const char* name;
|
||||||
|
@ -40,13 +31,13 @@ struct MemoryArea {
|
||||||
|
|
||||||
// We don't declare the IO regions in here since its handled by other means.
|
// We don't declare the IO regions in here since its handled by other means.
|
||||||
static MemoryArea memory_areas[] = {
|
static MemoryArea memory_areas[] = {
|
||||||
{&g_exefs_code, PROCESS_IMAGE_VADDR, PROCESS_IMAGE_MAX_SIZE, "Process Image"},
|
{PROCESS_IMAGE_VADDR, PROCESS_IMAGE_MAX_SIZE, "Process Image"}, // ExeFS:/.code is loaded here
|
||||||
{&g_heap, HEAP_VADDR, HEAP_SIZE, "Heap"},
|
{HEAP_VADDR, HEAP_SIZE, "Heap"}, // Application heap (main memory)
|
||||||
{&g_shared_mem, SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE, "Shared Memory"},
|
{SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE, "Shared Memory"}, // Shared memory
|
||||||
{&g_heap_linear, LINEAR_HEAP_VADDR, LINEAR_HEAP_SIZE, "Linear Heap"},
|
{LINEAR_HEAP_VADDR, LINEAR_HEAP_SIZE, "Linear Heap"}, // Linear heap (main memory)
|
||||||
{&g_vram, VRAM_VADDR, VRAM_SIZE, "VRAM"},
|
{VRAM_VADDR, VRAM_SIZE, "VRAM"}, // Video memory (VRAM)
|
||||||
{&g_dsp_mem, DSP_RAM_VADDR, DSP_RAM_SIZE, "DSP RAM"},
|
{DSP_RAM_VADDR, DSP_RAM_SIZE, "DSP RAM"}, // DSP memory
|
||||||
{&g_tls_mem, TLS_AREA_VADDR, TLS_AREA_SIZE, "TLS Area"},
|
{TLS_AREA_VADDR, TLS_AREA_SIZE, "TLS Area"}, // TLS memory
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Represents a block of memory mapped by ControlMemory/MapMemoryBlock
|
/// Represents a block of memory mapped by ControlMemory/MapMemoryBlock
|
||||||
|
@ -150,7 +141,6 @@ void Init() {
|
||||||
|
|
||||||
for (MemoryArea& area : memory_areas) {
|
for (MemoryArea& area : memory_areas) {
|
||||||
auto block = std::make_shared<std::vector<u8>>(area.size);
|
auto block = std::make_shared<std::vector<u8>>(area.size);
|
||||||
*area.ptr = block->data(); // TODO(yuriks): Remove
|
|
||||||
address_space.MapMemoryBlock(area.base, std::move(block), 0, area.size, MemoryState::Private).Unwrap();
|
address_space.MapMemoryBlock(area.base, std::move(block), 0, area.size, MemoryState::Private).Unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,19 +152,14 @@ void Init() {
|
||||||
(u8*)&SharedPage::shared_page, SHARED_PAGE_SIZE, MemoryState::Shared).MoveFrom();
|
(u8*)&SharedPage::shared_page, SHARED_PAGE_SIZE, MemoryState::Shared).MoveFrom();
|
||||||
address_space.Reprotect(shared_page_vma, VMAPermission::Read);
|
address_space.Reprotect(shared_page_vma, VMAPermission::Read);
|
||||||
|
|
||||||
LOG_DEBUG(HW_Memory, "initialized OK, RAM at %p", g_heap);
|
LOG_DEBUG(HW_Memory, "initialized OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
heap_map.clear();
|
heap_map.clear();
|
||||||
heap_linear_map.clear();
|
heap_linear_map.clear();
|
||||||
|
|
||||||
address_space.Reset();
|
address_space.Reset();
|
||||||
|
|
||||||
for (MemoryArea& area : memory_areas) {
|
|
||||||
*area.ptr = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_DEBUG(HW_Memory, "shutdown OK");
|
LOG_DEBUG(HW_Memory, "shutdown OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,6 @@
|
||||||
|
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
|
|
||||||
extern u8* g_exefs_code; ///< ExeFS:/.code is loaded here
|
|
||||||
extern u8* g_heap; ///< Application heap (main memory)
|
|
||||||
extern u8* g_shared_mem; ///< Shared memory
|
|
||||||
extern u8* g_heap_linear; ///< Linear heap (main memory)
|
|
||||||
extern u8* g_vram; ///< Video memory (VRAM)
|
|
||||||
extern u8* g_dsp_mem; ///< DSP memory
|
|
||||||
extern u8* g_tls_mem; ///< TLS memory
|
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue