mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
Kernel: Allow userspace stacks to grow up to 4 MB by default
Make userspace stacks lazily allocated and allow them to grow up to 4 megabytes. This avoids a lot of silly crashes we were running into with software expecting much larger stacks. :^)
This commit is contained in:
parent
6bd1879189
commit
904c871727
Notes:
sideshowbarker
2024-07-19 11:29:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/904c871727c
@ -502,7 +502,7 @@ void Thread::push_value_on_stack(u32 value)
|
||||
|
||||
void Thread::make_userspace_stack_for_main_thread(Vector<String> arguments, Vector<String> environment)
|
||||
{
|
||||
auto* region = m_process.allocate_region(VirtualAddress(), default_userspace_stack_size, "Stack (Main thread)");
|
||||
auto* region = m_process.allocate_region(VirtualAddress(), default_userspace_stack_size, "Stack (Main thread)", PROT_READ | PROT_WRITE, false);
|
||||
ASSERT(region);
|
||||
m_tss.esp = region->vaddr().offset(default_userspace_stack_size).get();
|
||||
|
||||
@ -537,7 +537,7 @@ void Thread::make_userspace_stack_for_main_thread(Vector<String> arguments, Vect
|
||||
|
||||
void Thread::make_userspace_stack_for_secondary_thread(void* argument)
|
||||
{
|
||||
m_userspace_stack_region = m_process.allocate_region(VirtualAddress(), default_userspace_stack_size, String::format("Stack (Thread %d)", tid()));
|
||||
m_userspace_stack_region = m_process.allocate_region(VirtualAddress(), default_userspace_stack_size, String::format("Stack (Thread %d)", tid()), PROT_READ | PROT_WRITE, false);
|
||||
ASSERT(m_userspace_stack_region);
|
||||
m_tss.esp = m_userspace_stack_region->vaddr().offset(default_userspace_stack_size).get();
|
||||
|
||||
|
@ -313,7 +313,7 @@ public:
|
||||
}
|
||||
|
||||
static constexpr u32 default_kernel_stack_size = 65536;
|
||||
static constexpr u32 default_userspace_stack_size = 65536;
|
||||
static constexpr u32 default_userspace_stack_size = 4 * MB;
|
||||
|
||||
private:
|
||||
IntrusiveListNode m_runnable_list_node;
|
||||
|
Loading…
Reference in New Issue
Block a user