mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 02:41:49 -05:00
added memory read/write to GSP heap
This commit is contained in:
parent
09ffe87360
commit
a9dba388eb
3 changed files with 16 additions and 7 deletions
|
@ -16,9 +16,8 @@ u8* g_base = NULL; ///< The base pointer to the aut
|
|||
|
||||
MemArena g_arena; ///< The MemArena class
|
||||
|
||||
u8* g_bootrom = NULL; ///< Bootrom physical memory
|
||||
u8* g_heap_gsp = NULL;
|
||||
u8* g_heap = NULL;
|
||||
u8* g_heap_gsp = NULL; ///< GSP heap (main memory)
|
||||
u8* g_heap = NULL; ///< Application heap (main memory)
|
||||
u8* g_vram = NULL; ///< Video memory (VRAM) pointer
|
||||
|
||||
u8* g_physical_bootrom = NULL; ///< Bootrom physical memory
|
||||
|
|
|
@ -34,6 +34,7 @@ enum {
|
|||
VRAM_MASK = 0x007FFFFF,
|
||||
FCRAM_MASK = (FCRAM_SIZE - 1), ///< FCRAM mask
|
||||
SCRATCHPAD_MASK = (SCRATCHPAD_SIZE - 1), ///< Scratchpad memory mask
|
||||
HEAP_GSP_MASK = (HEAP_GSP_SIZE - 1),
|
||||
HEAP_MASK = (HEAP_SIZE - 1),
|
||||
|
||||
FCRAM_PADDR = 0x20000000, ///< FCRAM physical address
|
||||
|
@ -62,7 +63,8 @@ extern u8 *g_base;
|
|||
// These are guaranteed to point to "low memory" addresses (sub-32-bit).
|
||||
// 64-bit: Pointers to low-mem (sub-0x10000000) mirror
|
||||
// 32-bit: Same as the corresponding physical/virtual pointers.
|
||||
extern u8* g_heap; ///< Main memory
|
||||
extern u8* g_heap_gsp; ///< GSP heap (main memory)
|
||||
extern u8* g_heap; ///< Application heap (main memory)
|
||||
extern u8* g_vram; ///< Video memory (VRAM)
|
||||
|
||||
void Init();
|
||||
|
|
|
@ -40,6 +40,10 @@ inline void _Read(T &var, const u32 addr) {
|
|||
} else if ((vaddr & 0xFF000000) == 0x10000000 || (vaddr & 0xFF000000) == 0x1E000000) {
|
||||
HW::Read<T>(var, vaddr);
|
||||
|
||||
// FCRAM - GSP heap
|
||||
} else if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) {
|
||||
var = *((const T*)&g_heap_gsp[vaddr & HEAP_GSP_MASK]);
|
||||
|
||||
// FCRAM - application heap
|
||||
} else if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) {
|
||||
var = *((const T*)&g_heap[vaddr & HEAP_MASK]);
|
||||
|
@ -68,8 +72,8 @@ inline void _Write(u32 addr, const T data) {
|
|||
HW::Write<T>(vaddr, data);
|
||||
|
||||
// FCRAM - GSP heap
|
||||
//} else if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_VADDR_GSP_END)) {
|
||||
// *(T*)&g_heap_gsp[vaddr & FCRAM_MASK] = data;
|
||||
} else if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) {
|
||||
*(T*)&g_heap_gsp[vaddr & HEAP_GSP_MASK] = data;
|
||||
|
||||
// FCRAM - application heap
|
||||
} else if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) {
|
||||
|
@ -98,8 +102,12 @@ inline void _Write(u32 addr, const T data) {
|
|||
u8 *GetPointer(const u32 addr) {
|
||||
const u32 vaddr = _AddressPhysicalToVirtual(addr);
|
||||
|
||||
// FCRAM - GSP heap
|
||||
if ((vaddr > HEAP_GSP_VADDR) && (vaddr < HEAP_GSP_VADDR_END)) {
|
||||
return g_heap_gsp + (vaddr & HEAP_GSP_MASK);
|
||||
|
||||
// FCRAM - application heap
|
||||
if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) {
|
||||
} else if ((vaddr > HEAP_VADDR) && (vaddr < HEAP_VADDR_END)) {
|
||||
return g_heap + (vaddr & HEAP_MASK);
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue