diff options
author | bunnei <ericbunnie@gmail.com> | 2014-04-18 05:05:31 +0200 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-04-18 05:05:31 +0200 |
commit | b2baafaf8ba760ce2b975391fd04db52ad386e29 (patch) | |
tree | db16aba20508121cd0d6d7cd489d1e1963b67525 /src/core/mem_map_funcs.cpp | |
parent | fixed bug in Memory::GetPointer (diff) | |
download | yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar.gz yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar.bz2 yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar.lz yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar.xz yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.tar.zst yuzu-b2baafaf8ba760ce2b975391fd04db52ad386e29.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/mem_map_funcs.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index 8e97ef111..af4cfacbd 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -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); |