diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index cedb1042884..31dd0560ad5 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -77,7 +77,13 @@ ErrorOr Process::sys$create_thread(void* (*entry)(void*), Userspacepage_directory().satp(); }); + + // Set up the argument registers expected by pthread_create_helper. + regs.x[9] = (FlatPtr)params.entry; + regs.x[10] = (FlatPtr)params.entry_argument; + regs.x[11] = (FlatPtr)params.stack_location; + regs.x[12] = (FlatPtr)params.stack_size; #else # error Unknown architecture #endif