summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/process.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-03-28 18:24:56 -0400
committerGravatar Lioncash2019-03-28 18:25:00 -0400
commit2aca7b9e1e6255cf740afec5dd390d0e6726c1e3 (patch)
treeed17be9c99b64d95c7433f69b741344d110d28c3 /src/core/hle/kernel/process.cpp
parentMerge pull request #2284 from lioncash/heap-alloc (diff)
downloadyuzu-2aca7b9e1e6255cf740afec5dd390d0e6726c1e3.tar.gz
yuzu-2aca7b9e1e6255cf740afec5dd390d0e6726c1e3.tar.xz
yuzu-2aca7b9e1e6255cf740afec5dd390d0e6726c1e3.zip
kernel/process: Ensure that given stack size is always page-aligned
The kernel always makes sure that the given stack size is aligned to page boundaries.
Diffstat (limited to 'src/core/hle/kernel/process.cpp')
-rw-r--r--src/core/hle/kernel/process.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index 0d782e4ba..73b4ff961 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -5,6 +5,7 @@
5#include <algorithm> 5#include <algorithm>
6#include <memory> 6#include <memory>
7#include <random> 7#include <random>
8#include "common/alignment.h"
8#include "common/assert.h" 9#include "common/assert.h"
9#include "common/logging/log.h" 10#include "common/logging/log.h"
10#include "core/core.h" 11#include "core/core.h"
@@ -108,6 +109,9 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) {
108} 109}
109 110
110void Process::Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size) { 111void Process::Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size) {
112 // The kernel always ensures that the given stack size is page aligned.
113 stack_size = Common::AlignUp(stack_size, Memory::PAGE_SIZE);
114
111 // Allocate and map the main thread stack 115 // Allocate and map the main thread stack
112 // TODO(bunnei): This is heap area that should be allocated by the kernel and not mapped as part 116 // TODO(bunnei): This is heap area that should be allocated by the kernel and not mapped as part
113 // of the user address space. 117 // of the user address space.