Optimizations to _NewContext() and _NewContextInternal()

Since the address of the new context is known before _NewContext() is invoked
(due to it being passed a properly aligned stack), there is no longer any
need for _NewContext to return the pointer to the context.

Furthermore, as a direct result of the properly aligned stack, the pointer to
the new context does not need to be passed as a separate parameter since it
will always match the passed stack pointer.

Change-Id: Ie57a9c4ad17f6f13e8b3f659cd701d4f8950ea97
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Peter Mitsis 2015-05-25 10:21:57 -04:00 committed by Anas Nashif
commit 40b5200c73
9 changed files with 24 additions and 34 deletions

View file

@ -205,7 +205,6 @@ void start_task(struct k_proc *X, /* ptr to task control block */
)
{
unsigned int contextOptions;
void *pNewContext;
/* Note: the field X->worksize now represents the task size in bytes */
@ -225,17 +224,16 @@ void start_task(struct k_proc *X, /* ptr to task control block */
* the context is a task, rather than a fiber.
*/
pNewContext = (tCCS *)_NewContext((char *)X->workspace, /* pStackMem */
X->worksize, /* stackSize */
(_ContextEntry)func, /* pEntry */
(void *)0, /* parameter1 */
(void *)0, /* parameter2 */
(void *)0, /* parameter3 */
-1, /* priority */
contextOptions /* options */
);
_NewContext((char *)X->workspace, /* pStackMem */
X->worksize, /* stackSize */
(_ContextEntry)func, /* pEntry */
(void *)0, /* parameter1 */
(void *)0, /* parameter2 */
(void *)0, /* parameter3 */
-1, /* priority */
contextOptions /* options */
);
X->workspace = (char *)pNewContext;
X->fabort = NULL;
reset_state_bit(X, TF_STOP | TF_TERM);