mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 20:30:08 +00:00
kernel: Move stack region outside of application heap.
This commit is contained in:
parent
69ee9edd8d
commit
8581404482
@ -33,10 +33,6 @@ enum class HandleType : u32 {
|
|||||||
ServerSession,
|
ServerSession,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
DEFAULT_STACK_SIZE = 0x10000,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class ResetType {
|
enum class ResetType {
|
||||||
OneShot,
|
OneShot,
|
||||||
Sticky,
|
Sticky,
|
||||||
|
@ -121,9 +121,8 @@ void Process::Run(VAddr entry_point, s32 main_thread_priority, u32 stack_size) {
|
|||||||
// 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.
|
||||||
vm_manager
|
vm_manager
|
||||||
.MapMemoryBlock(Memory::HEAP_VADDR_END - stack_size,
|
.MapMemoryBlock(Memory::STACK_VADDR, std::make_shared<std::vector<u8>>(stack_size, 0), 0,
|
||||||
std::make_shared<std::vector<u8>>(stack_size, 0), 0, stack_size,
|
stack_size, MemoryState::Mapped)
|
||||||
MemoryState::Mapped)
|
|
||||||
.Unwrap();
|
.Unwrap();
|
||||||
misc_memory_used += stack_size;
|
misc_memory_used += stack_size;
|
||||||
memory_region->used += stack_size;
|
memory_region->used += stack_size;
|
||||||
|
@ -357,7 +357,7 @@ SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority,
|
|||||||
|
|
||||||
// Initialize new "main" thread
|
// Initialize new "main" thread
|
||||||
auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0,
|
auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0,
|
||||||
Memory::HEAP_VADDR_END, owner_process);
|
Memory::STACK_VADDR_END, owner_process);
|
||||||
|
|
||||||
SharedPtr<Thread> thread = std::move(thread_res).Unwrap();
|
SharedPtr<Thread> thread = std::move(thread_res).Unwrap();
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ ResultStatus AppLoader_ELF::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
|||||||
process->resource_limit =
|
process->resource_limit =
|
||||||
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
||||||
|
|
||||||
process->Run(codeset->entrypoint, 48, Kernel::DEFAULT_STACK_SIZE);
|
process->Run(codeset->entrypoint, 48, Memory::STACK_SIZE);
|
||||||
|
|
||||||
is_loaded = true;
|
is_loaded = true;
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
|
@ -137,7 +137,7 @@ ResultStatus AppLoader_NRO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
|||||||
process->address_mappings = default_address_mappings;
|
process->address_mappings = default_address_mappings;
|
||||||
process->resource_limit =
|
process->resource_limit =
|
||||||
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
||||||
process->Run(base_addr, 48, Kernel::DEFAULT_STACK_SIZE);
|
process->Run(base_addr, 48, Memory::STACK_SIZE);
|
||||||
|
|
||||||
is_loaded = true;
|
is_loaded = true;
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
|
@ -165,7 +165,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
|||||||
process->address_mappings = default_address_mappings;
|
process->address_mappings = default_address_mappings;
|
||||||
process->resource_limit =
|
process->resource_limit =
|
||||||
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
|
||||||
process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Kernel::DEFAULT_STACK_SIZE);
|
process->Run(Memory::PROCESS_IMAGE_VADDR, 48, Memory::STACK_SIZE);
|
||||||
|
|
||||||
is_loaded = true;
|
is_loaded = true;
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
|
Loading…
Reference in New Issue
Block a user