mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	kernel: Move stack region outside of application heap.
This commit is contained in:
		@@ -33,10 +33,6 @@ enum class HandleType : u32 {
 | 
			
		||||
    ServerSession,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
    DEFAULT_STACK_SIZE = 0x10000,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum class ResetType {
 | 
			
		||||
    OneShot,
 | 
			
		||||
    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
 | 
			
		||||
    // of the user address space.
 | 
			
		||||
    vm_manager
 | 
			
		||||
        .MapMemoryBlock(Memory::HEAP_VADDR_END - stack_size,
 | 
			
		||||
                        std::make_shared<std::vector<u8>>(stack_size, 0), 0, stack_size,
 | 
			
		||||
                        MemoryState::Mapped)
 | 
			
		||||
        .MapMemoryBlock(Memory::STACK_VADDR, std::make_shared<std::vector<u8>>(stack_size, 0), 0,
 | 
			
		||||
                        stack_size, MemoryState::Mapped)
 | 
			
		||||
        .Unwrap();
 | 
			
		||||
    misc_memory_used += stack_size;
 | 
			
		||||
    memory_region->used += stack_size;
 | 
			
		||||
 
 | 
			
		||||
@@ -357,7 +357,7 @@ SharedPtr<Thread> SetupMainThread(VAddr entry_point, u32 priority,
 | 
			
		||||
 | 
			
		||||
    // Initialize new "main" thread
 | 
			
		||||
    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();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user