kernel: add vrfy hooks to support userspace with condvar
Add needed vrfy hooks for userspace support. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
930789dbe7
commit
989ebf6c35
2 changed files with 39 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <toolchain.h>
|
||||
#include <ksched.h>
|
||||
#include <wait_q.h>
|
||||
#include <syscall_handler.h>
|
||||
|
||||
static struct k_spinlock lock;
|
||||
|
||||
|
@ -19,6 +20,15 @@ int z_impl_k_condvar_init(struct k_condvar *condvar)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
int z_vrfy_k_condvar_init(struct k_condvar *condvar)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_OBJ_INIT(condvar, K_OBJ_CONDVAR));
|
||||
return z_impl_k_condvar_init(condvar);
|
||||
}
|
||||
#include <syscalls/k_condvar_init_mrsh.c>
|
||||
#endif
|
||||
|
||||
int z_impl_k_condvar_signal(struct k_condvar *condvar)
|
||||
{
|
||||
k_spinlock_key_t key = k_spin_lock(&lock);
|
||||
|
@ -34,6 +44,15 @@ int z_impl_k_condvar_signal(struct k_condvar *condvar)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
int z_vrfy_k_condvar_signal(struct k_condvar *condvar)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_OBJ(condvar, K_OBJ_CONDVAR));
|
||||
return z_impl_k_condvar_signal(condvar);
|
||||
}
|
||||
#include <syscalls/k_condvar_signal_mrsh.c>
|
||||
#endif
|
||||
|
||||
int z_impl_k_condvar_broadcast(struct k_condvar *condvar)
|
||||
{
|
||||
struct k_thread *pending_thread;
|
||||
|
@ -54,6 +73,14 @@ int z_impl_k_condvar_broadcast(struct k_condvar *condvar)
|
|||
|
||||
return woken;
|
||||
}
|
||||
#ifdef CONFIG_USERSPACE
|
||||
int z_vrfy_k_condvar_broadcast(struct k_condvar *condvar)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_OBJ(condvar, K_OBJ_CONDVAR));
|
||||
return z_impl_k_condvar_broadcast(condvar);
|
||||
}
|
||||
#include <syscalls/k_condvar_broadcast_mrsh.c>
|
||||
#endif
|
||||
|
||||
int z_impl_k_condvar_wait(struct k_condvar *condvar, struct k_mutex *mutex,
|
||||
k_timeout_t timeout)
|
||||
|
@ -69,3 +96,13 @@ int z_impl_k_condvar_wait(struct k_condvar *condvar, struct k_mutex *mutex,
|
|||
|
||||
return ret;
|
||||
}
|
||||
#ifdef CONFIG_USERSPACE
|
||||
int z_vrfy_k_condvar_wait(struct k_condvar *condvar, struct k_mutex *mutex,
|
||||
k_timeout_t timeout)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_OBJ(condvar, K_OBJ_CONDVAR));
|
||||
Z_OOPS(Z_SYSCALL_OBJ(mutex, K_OBJ_MUTEX));
|
||||
return z_impl_k_condvar_wait(condvar, mutex, timeout);
|
||||
}
|
||||
#include <syscalls/k_condvar_wait_mrsh.c>
|
||||
#endif
|
||||
|
|
|
@ -105,7 +105,8 @@ kobjects = OrderedDict([
|
|||
("NET_SOCKET", (None, False, False)),
|
||||
("net_if", (None, False, False)),
|
||||
("sys_mutex", (None, True, False)),
|
||||
("k_futex", (None, True, False))
|
||||
("k_futex", (None, True, False)),
|
||||
("k_condvar", (None, False, True))
|
||||
])
|
||||
|
||||
def kobject_to_enum(kobj):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue