diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h index ef8d5ced682..e952a10a0b0 100644 --- a/Kernel/API/Syscall.h +++ b/Kernel/API/Syscall.h @@ -355,7 +355,7 @@ struct SC_create_thread_params { unsigned int m_guard_page_size = 0; // Rounded up to PAGE_SIZE unsigned int m_reported_guard_page_size = 0; // The lie we tell callers unsigned int m_stack_size = 4 * MB; // Default PTHREAD_STACK_MIN - void* m_stack_location = nullptr; // nullptr means any, o.w. process virtual address + Userspace m_stack_location; // nullptr means any, o.w. process virtual address }; struct SC_realpath_params { diff --git a/Kernel/Process.h b/Kernel/Process.h index c3af14adbbe..bdb7d000fbf 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -296,7 +296,7 @@ public: int sys$getpeername(const Syscall::SC_getpeername_params*); int sys$sched_setparam(pid_t pid, Userspace); int sys$sched_getparam(pid_t pid, Userspace); - int sys$create_thread(void* (*)(void*), const Syscall::SC_create_thread_params*); + int sys$create_thread(void* (*)(void*), Userspace); void sys$exit_thread(void*); int sys$join_thread(int tid, void** exit_value); int sys$detach_thread(int tid); diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index a458072f975..572d67495d2 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -33,7 +33,7 @@ namespace Kernel { -int Process::sys$create_thread(void* (*entry)(void*), const Syscall::SC_create_thread_params* user_params) +int Process::sys$create_thread(void* (*entry)(void*), Userspace user_params) { REQUIRE_PROMISE(thread); if (!validate_read((const void*)entry, sizeof(void*))) @@ -45,13 +45,13 @@ int Process::sys$create_thread(void* (*entry)(void*), const Syscall::SC_create_t unsigned detach_state = params.m_detach_state; int schedule_priority = params.m_schedule_priority; - void* stack_location = params.m_stack_location; + Userspace stack_location = params.m_stack_location; unsigned stack_size = params.m_stack_size; if (!validate_write(stack_location, stack_size)) return -EFAULT; - u32 user_stack_address = reinterpret_cast(stack_location) + stack_size; + u32 user_stack_address = reinterpret_cast(stack_location.ptr()) + stack_size; if (!MM.validate_user_stack(*this, VirtualAddress(user_stack_address - 4))) return -EFAULT; diff --git a/Libraries/LibPthread/pthread.cpp b/Libraries/LibPthread/pthread.cpp index f3a17849b63..ebf50f78c81 100644 --- a/Libraries/LibPthread/pthread.cpp +++ b/Libraries/LibPthread/pthread.cpp @@ -383,7 +383,7 @@ int pthread_attr_getstack(const pthread_attr_t* attributes, void** p_stack_ptr, if (!attributes_impl || !p_stack_ptr || !p_stack_size) return EINVAL; - *p_stack_ptr = attributes_impl->m_stack_location; + *p_stack_ptr = attributes_impl->m_stack_location.ptr(); *p_stack_size = attributes_impl->m_stack_size; return 0;