userspace: add _k_object_uninit()

API to assist with re-using objects, such as terminated threads or
kernel objects returned to a pool.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-10-05 12:21:36 -07:00 committed by Andrew Boie
commit 4a9a4240c6
2 changed files with 23 additions and 0 deletions

View file

@ -105,6 +105,16 @@ extern void _thread_perms_clear(struct _k_object *ko, struct k_thread *thread);
*/
extern void _thread_perms_all_set(struct _k_object *ko);
/**
* Clear initialization state of a kernel object
*
* Intended for thread objects upon thread exit, or for other kernel objects
* that were released back to an object pool.
*
* @param object Address of the kernel object
*/
void _k_object_uninit(void *obj);
/**
* @brief Runtime expression check for system call arguments
*

View file

@ -260,6 +260,19 @@ void _k_object_init(void *object)
ko->flags |= K_OBJ_FLAG_INITIALIZED;
}
void _k_object_uninit(void *object)
{
struct _k_object *ko;
/* See comments in _k_object_init() */
ko = _k_object_find(object);
if (!ko) {
return;
}
ko->flags &= ~K_OBJ_FLAG_INITIALIZED;
}
static u32_t _handler_bad_syscall(u32_t bad_id, u32_t arg2, u32_t arg3,
u32_t arg4, u32_t arg5, u32_t arg6, void *ssf)
{