diff options
author | Brian Gianforcaro <b.gianfo@gmail.com> | 2020-08-09 15:45:51 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-10 12:52:15 +0200 |
commit | 0e627b02737c2536cb16a085efd0e7b929193e8b (patch) | |
tree | baed0bdafececa110d98d4a28e7aeaac25e99117 /Kernel | |
parent | d3847b3489a96ed1c70c6368b2a0ef535853d357 (diff) | |
download | serenity-0e627b02737c2536cb16a085efd0e7b929193e8b.zip |
Kernel: Use Userspace<T> for the exit_thread syscall
Userspace<void*> is a bit strange here, as it would appear to the
user that we intend to de-refrence the pointer in kernel mode.
However I think it does a good join of illustrating that we are
treating the void* as a value type, instead of a pointer type.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Process.h | 2 | ||||
-rw-r--r-- | Kernel/Syscall.cpp | 2 | ||||
-rw-r--r-- | Kernel/Syscalls/thread.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h index 7d2caa8d6b..9a72ca13ff 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -305,7 +305,7 @@ public: 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*), Userspace<const Syscall::SC_create_thread_params*>); - void sys$exit_thread(void*); + void sys$exit_thread(Userspace<void*>); int sys$join_thread(pid_t tid, Userspace<void**> exit_value); int sys$detach_thread(pid_t tid); int sys$set_thread_name(pid_t tid, Userspace<const char*> buffer, size_t buffer_size); diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index 43370594e5..97d7fc5013 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -95,7 +95,7 @@ int handle(RegisterState& regs, u32 function, u32 arg1, u32 arg2, u32 arg3) if (function == SC_exit) process.sys$exit((int)arg1); else - process.sys$exit_thread((void*)arg1); + process.sys$exit_thread(arg1); ASSERT_NOT_REACHED(); return 0; } diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index e67bfc0d96..39e59baff9 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -90,12 +90,12 @@ int Process::sys$create_thread(void* (*entry)(void*), Userspace<const Syscall::S return thread->tid().value(); } -void Process::sys$exit_thread(void* exit_value) +void Process::sys$exit_thread(Userspace<void*> exit_value) { REQUIRE_PROMISE(thread); cli(); auto current_thread = Thread::current(); - current_thread->m_exit_value = exit_value; + current_thread->m_exit_value = reinterpret_cast<void*>(exit_value.ptr()); current_thread->set_should_die(); big_lock().force_unlock_if_locked(); current_thread->die_if_needed(); |