diff options
-rw-r--r-- | Kernel/API/Syscall.h | 2 | ||||
-rw-r--r-- | Kernel/Process.h | 2 | ||||
-rw-r--r-- | Kernel/Syscalls/thread.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibPthread/pthread.cpp | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h index ef8d5ced68..e952a10a0b 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<void*> 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 c3af14adbb..bdb7d000fb 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<const struct sched_param*>); int sys$sched_getparam(pid_t pid, Userspace<struct sched_param*>); - int sys$create_thread(void* (*)(void*), const Syscall::SC_create_thread_params*); + int sys$create_thread(void* (*)(void*), Userspace<const Syscall::SC_create_thread_params*>); 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 a458072f97..572d67495d 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<const Syscall::SC_create_thread_params*> 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<void*> 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<u32>(stack_location) + stack_size; + u32 user_stack_address = reinterpret_cast<u32>(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 f3a17849b6..ebf50f78c8 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; |