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:
Andrew Boie 2017-03-30 13:07:02 -07:00 committed by Anas Nashif
commit d26cf2dc33
16 changed files with 147 additions and 100 deletions

View file

@ -100,15 +100,15 @@ tagged as an SSE user, or if the application wants to avoid the exception
handling overhead involved in auto-tagging threads, it is possible to
pre-tag a thread using one of the techniques listed below.
* A statically-spawned x86 thread can be pre-tagged by passing the
* A statically-created x86 thread can be pre-tagged by passing the
:c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
:c:macro:`K_THREAD_DEFINE`.
* A dynamically-spawned x86 thread can be pre-tagged by passing the
* A dynamically-created x86 thread can be pre-tagged by passing the
:c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
:cpp:func:`k_thread_spawn()`.
:cpp:func:`k_thread_create()`.
* An already-spawned x86 thread can pre-tag itself once it has started
* An already-created x86 thread can pre-tag itself once it has started
by passing the :c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
:cpp:func:`k_float_enable()`.