mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
Kernel+LibPthread+LibC: Create secondary thread stacks in userspace
Have pthread_create() allocate a stack and passing it to the kernel instead of this work happening in the kernel. The more of this we can do in userspace, the better. This patch also unexposes the raw create_thread() and exit_thread() syscalls since they are now only used by LibPthread anyway.
This commit is contained in:
@@ -601,18 +601,6 @@ void Thread::make_userspace_stack_for_main_thread(Vector<String> arguments, Vect
|
||||
push_value_on_stack(0);
|
||||
}
|
||||
|
||||
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()), PROT_READ | PROT_WRITE, false);
|
||||
ASSERT(m_userspace_stack_region);
|
||||
m_userspace_stack_region->set_stack(true);
|
||||
m_tss.esp = m_userspace_stack_region->vaddr().offset(default_userspace_stack_size).get();
|
||||
|
||||
// NOTE: The stack needs to be 16-byte aligned.
|
||||
push_value_on_stack((u32)argument);
|
||||
push_value_on_stack(0);
|
||||
}
|
||||
|
||||
Thread* Thread::clone(Process& process)
|
||||
{
|
||||
auto* clone = new Thread(process);
|
||||
|
||||
Reference in New Issue
Block a user