userspace: add K_THREAD_ACCCESS_GRANT()
It's possible to declare static threads that start up as K_USER, but these threads can't do much since they start with permissions on no kernel objects other than their own thread object. Rather than do some run-time synchronization to have some other thread grant the necessary permissions, we introduce macros to conveniently assign object permissions to these threads when they are brought up at boot by the kernel. The tables generated here are constant and live in ROM when possible. Example usage: K_THREAD_DEFINE(my_thread, STACK_SIZE, my_thread_entry, NULL, NULL, NULL, 0, K_USER, K_NO_WAIT); K_THREAD_ACCESS_GRANT(my_thread, &my_sem, &my_mutex, &my_pipe); Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
493852bac3
commit
877f82e847
4 changed files with 63 additions and 2 deletions
|
@ -24,7 +24,17 @@
|
|||
__init_array_end = .;
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/* Build-time assignment of permissions to kernel objects to
|
||||
* threads declared with K_THREAD_DEFINE()
|
||||
*/
|
||||
SECTION_PROLOGUE(object_access, (OPTIONAL),)
|
||||
{
|
||||
__object_access_start = .;
|
||||
KEEP(*(".object_access.*"))
|
||||
__object_access_end = .;
|
||||
}
|
||||
#endif
|
||||
SECTION_PROLOGUE (devconfig, (OPTIONAL),)
|
||||
{
|
||||
__devconfig_start = .;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue