diff options
| author | 2019-03-24 15:24:52 -0400 | |
|---|---|---|
| committer | 2019-03-24 16:17:31 -0400 | |
| commit | 586cab617270346c39ecfb340127e0b8edb863d3 (patch) | |
| tree | 47daaae2ad06629fc4c636746cc39b6818441425 /src/core/hle/kernel/svc.cpp | |
| parent | Merge pull request #2221 from DarkLordZach/firmware-version (diff) | |
| download | yuzu-586cab617270346c39ecfb340127e0b8edb863d3.tar.gz yuzu-586cab617270346c39ecfb340127e0b8edb863d3.tar.xz yuzu-586cab617270346c39ecfb340127e0b8edb863d3.zip | |
kernel/vm_manager: Tidy up heap allocation code
Another holdover from citra that can be tossed out is the notion of the
heap needing to be allocated in different addresses. On the switch, the
base address of the heap will always be managed by the memory allocator
in the kernel, so this doesn't need to be specified in the function's
interface itself.
The heap on the switch is always allocated with read/write permissions,
so we don't need to add specifying the memory permissions as part of the
heap allocation itself either.
This also corrects the error code returned from within the function.
If the size of the heap is larger than the entire heap region, then the
kernel will report an out of memory condition.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index a6a17efe7..59bc8d9f8 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -174,10 +174,8 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | |||
| 174 | return ERR_INVALID_SIZE; | 174 | return ERR_INVALID_SIZE; |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | auto& vm_manager = Core::CurrentProcess()->VMManager(); | 177 | auto& vm_manager = Core::System::GetInstance().Kernel().CurrentProcess()->VMManager(); |
| 178 | const VAddr heap_base = vm_manager.GetHeapRegionBaseAddress(); | 178 | const auto alloc_result = vm_manager.HeapAllocate(heap_size); |
| 179 | const auto alloc_result = | ||
| 180 | vm_manager.HeapAllocate(heap_base, heap_size, VMAPermission::ReadWrite); | ||
| 181 | 179 | ||
| 182 | if (alloc_result.Failed()) { | 180 | if (alloc_result.Failed()) { |
| 183 | return alloc_result.Code(); | 181 | return alloc_result.Code(); |