diff options
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index f500fd2e7..a3d169e46 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -39,6 +39,12 @@ namespace Kernel { | |||
| 39 | /// Set the process heap to a given Size. It can both extend and shrink the heap. | 39 | /// Set the process heap to a given Size. It can both extend and shrink the heap. |
| 40 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | 40 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { |
| 41 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); | 41 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); |
| 42 | |||
| 43 | // Size must be a multiple of 0x200000 (2MB) and be equal to or less than 4GB. | ||
| 44 | if ((heap_size & 0xFFFFFFFE001FFFFF) != 0) { | ||
| 45 | return ERR_INVALID_SIZE; | ||
| 46 | } | ||
| 47 | |||
| 42 | auto& process = *Core::CurrentProcess(); | 48 | auto& process = *Core::CurrentProcess(); |
| 43 | CASCADE_RESULT(*heap_addr, | 49 | CASCADE_RESULT(*heap_addr, |
| 44 | process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); | 50 | process.HeapAllocate(Memory::HEAP_VADDR, heap_size, VMAPermission::ReadWrite)); |