diff options
| author | 2018-03-31 15:03:28 -0400 | |
|---|---|---|
| committer | 2018-03-31 16:06:45 -0400 | |
| commit | b27ab46bde8bd0c376747284435fcfa2b35aea75 (patch) | |
| tree | 7cc608033e61e4697bad475699d74c35c8bd5370 | |
| parent | Merge pull request #293 from N00byKing/drkthm (diff) | |
| download | yuzu-b27ab46bde8bd0c376747284435fcfa2b35aea75.tar.gz yuzu-b27ab46bde8bd0c376747284435fcfa2b35aea75.tar.xz yuzu-b27ab46bde8bd0c376747284435fcfa2b35aea75.zip | |
memory: Fix stack region.
| -rw-r--r-- | src/core/hle/kernel/process.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 2 | ||||
| -rw-r--r-- | src/core/loader/elf.cpp | 2 | ||||
| -rw-r--r-- | src/core/loader/nro.cpp | 2 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 2 | ||||
| -rw-r--r-- | src/core/memory.h | 9 |
6 files changed, 12 insertions, 10 deletions
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index 3694afc60..2cffec198 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -121,8 +121,9 @@ void Process::Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size) { | |||
| 121 | // TODO(bunnei): This is heap area that should be allocated by the kernel and not mapped as part | 121 | // TODO(bunnei): This is heap area that should be allocated by the kernel and not mapped as part |
| 122 | // of the user address space. | 122 | // of the user address space. |
| 123 | vm_manager | 123 | vm_manager |
| 124 | .MapMemoryBlock(Memory::STACK_VADDR, std::make_shared<std::vector<u8>>(stack_size, 0), 0, | 124 | .MapMemoryBlock(Memory::STACK_AREA_VADDR_END - stack_size, |
| 125 | stack_size, MemoryState::Mapped) | 125 | std::make_shared<std::vector<u8>>(stack_size, 0), 0, stack_size, |
| 126 | MemoryState::Mapped) | ||
| 126 | .Unwrap(); | 127 | .Unwrap(); |
| 127 | misc_memory_used += stack_size; | 128 | misc_memory_used += stack_size; |
| 128 | memory_region->used += stack_size; | 129 | memory_region->used += stack_size; |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 145f50887..f3a8aa4aa 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -342,7 +342,7 @@ SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority, | |||
| 342 | 342 | ||
| 343 | // Initialize new "main" thread | 343 | // Initialize new "main" thread |
| 344 | auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0, | 344 | auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0, |
| 345 | Memory::STACK_VADDR_END, owner_process); | 345 | Memory::STACK_AREA_VADDR_END, owner_process); |
| 346 | 346 | ||
| 347 | SharedPtr<Thread> thread = std::move(thread_res).Unwrap(); | 347 | SharedPtr<Thread> thread = std::move(thread_res).Unwrap(); |
| 348 | 348 | ||
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 0ba8c6fd2..e9f462196 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp | |||
| @@ -414,7 +414,7 @@ ResultStatus AppLoader_ELF::Load(Kernel::SharedPtr<Kernel::Process>& process) { | |||
| 414 | process->resource_limit = | 414 | process->resource_limit = |
| 415 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); | 415 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); |
| 416 | 416 | ||
| 417 | process->Run(codeset->entrypoint, 48, Memory::STACK_SIZE); | 417 | process->Run(codeset->entrypoint, 48, Memory::DEFAULT_STACK_SIZE); |
| 418 | 418 | ||
| 419 | is_loaded = true; | 419 | is_loaded = true; |
| 420 | return ResultStatus::Success; | 420 | return ResultStatus::Success; |
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 6dcd1ce48..b5133e4d6 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -137,7 +137,7 @@ ResultStatus AppLoader_NRO::Load(Kernel::SharedPtr<Kernel::Process>& process) { | |||
| 137 | process->address_mappings = default_address_mappings; | 137 | process->address_mappings = default_address_mappings; |
| 138 | process->resource_limit = | 138 | process->resource_limit = |
| 139 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); | 139 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); |
| 140 | process->Run(base_addr, 48, Memory::STACK_SIZE); | 140 | process->Run(base_addr, 48, Memory::DEFAULT_STACK_SIZE); |
| 141 | 141 | ||
| 142 | is_loaded = true; | 142 | is_loaded = true; |
| 143 | return ResultStatus::Success; | 143 | return ResultStatus::Success; |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 100aa022e..3bc10ed0d 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -165,7 +165,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) { | |||
| 165 | process->address_mappings = default_address_mappings; | 165 | process->address_mappings = default_address_mappings; |
| 166 | process->resource_limit = | 166 | process->resource_limit = |
| 167 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); | 167 | Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION); |
| 168 | process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Memory::STACK_SIZE); | 168 | process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Memory::DEFAULT_STACK_SIZE); |
| 169 | 169 | ||
| 170 | is_loaded = true; | 170 | is_loaded = true; |
| 171 | return ResultStatus::Success; | 171 | return ResultStatus::Success; |
diff --git a/src/core/memory.h b/src/core/memory.h index 413a7b4e8..e9b8ca873 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -162,12 +162,13 @@ enum : VAddr { | |||
| 162 | TLS_AREA_VADDR = NEW_LINEAR_HEAP_VADDR_END, | 162 | TLS_AREA_VADDR = NEW_LINEAR_HEAP_VADDR_END, |
| 163 | TLS_ENTRY_SIZE = 0x200, | 163 | TLS_ENTRY_SIZE = 0x200, |
| 164 | TLS_AREA_SIZE = 0x10000000, | 164 | TLS_AREA_SIZE = 0x10000000, |
| 165 | TLS_ADREA_VADDR_END = TLS_AREA_VADDR + TLS_AREA_SIZE, | 165 | TLS_AREA_VADDR_END = TLS_AREA_VADDR + TLS_AREA_SIZE, |
| 166 | 166 | ||
| 167 | /// Application stack | 167 | /// Application stack |
| 168 | STACK_VADDR = TLS_ADREA_VADDR_END, | 168 | STACK_AREA_VADDR = TLS_AREA_VADDR_END, |
| 169 | STACK_SIZE = 0x10000, | 169 | STACK_AREA_SIZE = 0x10000000, |
| 170 | STACK_VADDR_END = STACK_VADDR + STACK_SIZE, | 170 | STACK_AREA_VADDR_END = STACK_AREA_VADDR + STACK_AREA_SIZE, |
| 171 | DEFAULT_STACK_SIZE = 0x100000, | ||
| 171 | 172 | ||
| 172 | /// Application heap | 173 | /// Application heap |
| 173 | /// Size is confirmed to be a static value on fw 3.0.0 | 174 | /// Size is confirmed to be a static value on fw 3.0.0 |