userspace: assign thread IDs at build time
Kernel object metadata had an extra data field added recently to store bounds for stack objects. Use this data field to assign IDs to thread objects at build time. This has numerous advantages: * Threads can be granted permissions on kernel objects before the thread is initialized. Previously, it was necessary to call k_thread_create() with a K_FOREVER delay, assign permissions, then start the thread. Permissions are still completely cleared when a thread exits. * No need for runtime logic to manage thread IDs * Build error if CONFIG_MAX_THREAD_BYTES is set too low Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
56cab64d70
commit
818a96d3af
7 changed files with 59 additions and 109 deletions
|
@ -118,11 +118,6 @@ struct _kernel {
|
|||
struct k_thread *threads; /* singly linked list of ALL threads */
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
/* 0 bits for ids currently in use, 1 for free ids */
|
||||
u8_t free_thread_ids[CONFIG_MAX_THREAD_BYTES];
|
||||
#endif
|
||||
|
||||
/* arch-specific part of _kernel */
|
||||
struct _kernel_arch arch;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue