mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 17:57:58 -05:00
added GSP heap memory allocation
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "common/common.h"
|
||||
|
||||
#include "core/mem_map.h"
|
||||
@ -10,6 +12,8 @@
|
||||
|
||||
namespace Memory {
|
||||
|
||||
std::map<u32, HeapBlock> g_heap_gsp_map;
|
||||
|
||||
/// Convert a physical address to virtual address
|
||||
u32 _AddressPhysicalToVirtual(const u32 addr) {
|
||||
// Our memory interface read/write functions assume virtual addresses. Put any physical address
|
||||
@ -116,6 +120,28 @@ u8 *GetPointer(const u32 addr) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a block of memory on the GSP heap
|
||||
* @param size Size of block in bytes
|
||||
* @param flags Memory allocation flags
|
||||
*/
|
||||
u32 MapBlock_HeapGSP(u32 size, u32 operation, u32 permissions) {
|
||||
HeapBlock block;
|
||||
|
||||
block.base_address = HEAP_GSP_VADDR;
|
||||
block.size = size;
|
||||
block.operation = operation;
|
||||
block.permissions = permissions;
|
||||
|
||||
if (g_heap_gsp_map.size() > 0) {
|
||||
const HeapBlock last_block = g_heap_gsp_map.rbegin()->second;
|
||||
block.address = last_block.address + last_block.size;
|
||||
}
|
||||
g_heap_gsp_map[block.GetVirtualAddress()] = block;
|
||||
|
||||
return block.GetVirtualAddress();
|
||||
}
|
||||
|
||||
u8 Read8(const u32 addr) {
|
||||
u8 _var = 0;
|
||||
_Read<u8>(_var, addr);
|
||||
|
Reference in New Issue
Block a user