kernel: add k_thread_create() API
Unline k_thread_spawn(), the struct k_thread can live anywhere and not in the thread's stack region. This will be useful for memory protection scenarios where private kernel structures for a thread are not accessible by that thread, or we want to allow the thread to use all the stack space we gave it. This requires a change to the internal _new_thread() API as we need to provide a separate pointer for the k_thread. By default, we still create internal threads with the k_thread in stack memory. Forthcoming patches will change this, but we first need to make it easier to define k_thread memory of variable size depending on whether we need to store coprocessor state or not. Change-Id: I533bbcf317833ba67a771b356b6bbc6596bf60f5 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
2a0d16593a
commit
d26cf2dc33
16 changed files with 147 additions and 100 deletions
|
@ -49,7 +49,7 @@
|
|||
* @return N/A
|
||||
*/
|
||||
|
||||
void _new_thread(char *pStackMem, size_t stackSize,
|
||||
void _new_thread(struct k_thread *thread, char *pStackMem, size_t stackSize,
|
||||
_thread_entry_t pEntry,
|
||||
void *parameter1, void *parameter2, void *parameter3,
|
||||
int priority, unsigned int options)
|
||||
|
@ -62,9 +62,8 @@ void _new_thread(char *pStackMem, size_t stackSize,
|
|||
|
||||
char *stackEnd = pStackMem + stackSize;
|
||||
struct __esf *pInitCtx;
|
||||
struct k_thread *thread = (struct k_thread *) pStackMem;
|
||||
|
||||
thread = _new_thread_init(pStackMem, stackSize, priority, options);
|
||||
_new_thread_init(thread, pStackMem, stackSize, priority, options);
|
||||
|
||||
/* carve the thread entry struct from the "base" of the stack */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue