diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-08-06 02:39:53 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-08-16 06:03:48 +0200 |
commit | 14eca982f4da2bfd4d2c105bc33722e88e59da5f (patch) | |
tree | d812de676c6e2d056ac43abec89251aa36162165 /src/core/hle/kernel/process.cpp | |
parent | Kernel: Add more infrastructure to support different memory layouts (diff) | |
download | yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.gz yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.bz2 yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.lz yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.xz yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.tar.zst yuzu-14eca982f4da2bfd4d2c105bc33722e88e59da5f.zip |
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r-- | src/core/hle/kernel/process.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 1f45e6cf8..124047a53 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -110,6 +110,7 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) { auto vma = vm_manager.MapMemoryBlock(segment.addr, codeset->memory, segment.offset, segment.size, memory_state).Unwrap(); vm_manager.Reprotect(vma, permissions); + misc_memory_used += segment.size; }; // Map CodeSet segments @@ -121,6 +122,7 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) { vm_manager.MapMemoryBlock(Memory::HEAP_VADDR_END - stack_size, std::make_shared<std::vector<u8>>(stack_size, 0), 0, stack_size, MemoryState::Locked ).Unwrap(); + misc_memory_used += stack_size; vm_manager.LogLayout(Log::Level::Debug); Kernel::SetupMainThread(codeset->entrypoint, main_thread_priority); @@ -162,6 +164,8 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u32 size, VMAPermission per CASCADE_RESULT(auto vma, vm_manager.MapMemoryBlock(target, heap_memory, target - heap_start, size, MemoryState::Private)); vm_manager.Reprotect(vma, perms); + heap_used += size; + return MakeResult<VAddr>(heap_end - size); } @@ -173,6 +177,8 @@ ResultCode Process::HeapFree(VAddr target, u32 size) { ResultCode result = vm_manager.UnmapRange(target, size); if (result.IsError()) return result; + heap_used -= size; + return RESULT_SUCCESS; } @@ -206,6 +212,8 @@ ResultVal<VAddr> Process::LinearAllocate(VAddr target, u32 size, VMAPermission p CASCADE_RESULT(auto vma, vm_manager.MapMemoryBlock(target, linheap_memory, offset, size, MemoryState::Continuous)); vm_manager.Reprotect(vma, perms); + linear_heap_used += size; + return MakeResult<VAddr>(target); } @@ -226,6 +234,8 @@ ResultCode Process::LinearFree(VAddr target, u32 size) { ResultCode result = vm_manager.UnmapRange(target, size); if (result.IsError()) return result; + linear_heap_used -= size; + if (target + size == heap_end) { // End of linear heap has been freed, so check what's the last allocated block in it and // reduce the size. |