diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/process.h | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index f18789a60..bb2673732 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -110,15 +110,15 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) { | |||
| 110 | 110 | ||
| 111 | void Process::Run(VAddr entry_point, s32 main_thread_priority, u64 stack_size) { | 111 | void Process::Run(VAddr entry_point, s32 main_thread_priority, u64 stack_size) { |
| 112 | // The kernel always ensures that the given stack size is page aligned. | 112 | // The kernel always ensures that the given stack size is page aligned. |
| 113 | stack_size = Common::AlignUp(stack_size, Memory::PAGE_SIZE); | 113 | main_thread_stack_size = Common::AlignUp(stack_size, Memory::PAGE_SIZE); |
| 114 | 114 | ||
| 115 | // Allocate and map the main thread stack | 115 | // Allocate and map the main thread stack |
| 116 | // 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 |
| 117 | // of the user address space. | 117 | // of the user address space. |
| 118 | const VAddr mapping_address = vm_manager.GetTLSIORegionEndAddress() - main_thread_stack_size; | ||
| 118 | vm_manager | 119 | vm_manager |
| 119 | .MapMemoryBlock(vm_manager.GetTLSIORegionEndAddress() - stack_size, | 120 | .MapMemoryBlock(mapping_address, std::make_shared<std::vector<u8>>(main_thread_stack_size), |
| 120 | std::make_shared<std::vector<u8>>(stack_size, 0), 0, stack_size, | 121 | 0, main_thread_stack_size, MemoryState::Stack) |
| 121 | MemoryState::Stack) | ||
| 122 | .Unwrap(); | 122 | .Unwrap(); |
| 123 | 123 | ||
| 124 | vm_manager.LogLayout(); | 124 | vm_manager.LogLayout(); |
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index db14dd4b4..ee559fe4c 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -247,6 +247,9 @@ private: | |||
| 247 | /// Memory manager for this process. | 247 | /// Memory manager for this process. |
| 248 | Kernel::VMManager vm_manager; | 248 | Kernel::VMManager vm_manager; |
| 249 | 249 | ||
| 250 | /// Size of the main thread's stack in bytes. | ||
| 251 | u64 main_thread_stack_size = 0; | ||
| 252 | |||
| 250 | /// Current status of the process | 253 | /// Current status of the process |
| 251 | ProcessStatus status; | 254 | ProcessStatus status; |
| 252 | 255 | ||