mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-23 15:22:45 +01:00
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.
This commit is contained in:
parent
16dc3a1dd5
commit
2aca7b9e1e
1 changed files with 4 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
@ -108,6 +109,9 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size) {
|
void Process::Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size) {
|
||||||
|
// The kernel always ensures that the given stack size is page aligned.
|
||||||
|
stack_size = Common::AlignUp(stack_size, Memory::PAGE_SIZE);
|
||||||
|
|
||||||
// Allocate and map the main thread stack
|
// Allocate and map the main thread stack
|
||||||
// TODO(bunnei): This is heap area that should be allocated by the kernel and not mapped as part
|
// TODO(bunnei): This is heap area that should be allocated by the kernel and not mapped as part
|
||||||
// of the user address space.
|
// of the user address space.
|
||||||
|
|
Loading…
Reference in a new issue