summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-03-28 18:30:58 -0400
committerGravatar Lioncash2019-03-28 18:45:06 -0400
commit5d4ab5ec2fe36fa06d3adccb66261a4a8077c74e (patch)
tree54b555ab1521f9776d1247b0a108485030594a34 /src
parentkernel/process: Make Run's stack size parameter a u64 (diff)
downloadyuzu-5d4ab5ec2fe36fa06d3adccb66261a4a8077c74e.tar.gz
yuzu-5d4ab5ec2fe36fa06d3adccb66261a4a8077c74e.tar.xz
yuzu-5d4ab5ec2fe36fa06d3adccb66261a4a8077c74e.zip
kernel/process: Store the main thread stack size to a data member
This will be necessary in order to properly report memory usage within svcGetInfo.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/process.cpp8
-rw-r--r--src/core/hle/kernel/process.h3
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
111void Process::Run(VAddr entry_point, s32 main_thread_priority, u64 stack_size) { 111void 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