From a45f691d120eef57b1a187a33b229b90ac455851 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Fri, 22 May 2015 15:05:51 -0400 Subject: [PATCH] Remove runtime stack alignment from _NewContext() Runtime alignment of a context's stack is no longer necessary in _NewContext() as the memory is aligned (via the __stack tag) before calling _NewContext(). Change-Id: I31b7fd883ea3f1dcdb378e8ff508430bc75afcde Signed-off-by: Peter Mitsis --- arch/arc/core/context.c | 4 ++-- arch/arm/core/nanocontext.c | 4 ++-- arch/x86/core/nanocontext.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arc/core/context.c b/arch/arc/core/context.c index cec380c02ce..773e918485f 100644 --- a/arch/arc/core/context.c +++ b/arch/arc/core/context.c @@ -109,7 +109,7 @@ static ALWAYS_INLINE void context_monitor_init(struct s_CCS *pCcs /* context */ */ void *_NewContext( - char *pStackMem, /* pointer to stack memory */ + char *pStackMem, /* pointer to aligned stack memory */ unsigned stackSize, /* stack size in bytes */ _ContextEntry pEntry, /* context (thread) entry point routine */ void *parameter1, /* first param to entry point */ @@ -122,7 +122,7 @@ void *_NewContext( char *stackEnd = pStackMem + stackSize; struct init_stack_frame *pInitCtx; - tCCS *pCcs = (void *)ROUND_UP(pStackMem, sizeof(uint32_t)); + tCCS *pCcs = (tCCS *) pStackMem; /* carve the context entry struct from the "base" of the stack */ diff --git a/arch/arm/core/nanocontext.c b/arch/arm/core/nanocontext.c index 8d0c8b3ad99..c3781fa1af1 100644 --- a/arch/arm/core/nanocontext.c +++ b/arch/arm/core/nanocontext.c @@ -103,7 +103,7 @@ static ALWAYS_INLINE void _context_monitor_init(struct s_CCS *pCcs /* context */ */ void *_NewContext( - char *pStackMem, /* stack memory */ + char *pStackMem, /* aligned stack memory */ unsigned stackSize, /* stack size in bytes */ _ContextEntry pEntry, /* entry point */ void *parameter1, /* entry point first param */ @@ -115,7 +115,7 @@ void *_NewContext( { char *stackEnd = pStackMem + stackSize; struct __esf *pInitCtx; - tCCS *pCcs = (void *)ROUND_UP(pStackMem, sizeof(uint32_t)); + tCCS *pCcs = (tCCS *) pStackMem; /* carve the context entry struct from the "base" of the stack */ diff --git a/arch/x86/core/nanocontext.c b/arch/x86/core/nanocontext.c index cdffba645b9..0761a84d8c2 100644 --- a/arch/x86/core/nanocontext.c +++ b/arch/x86/core/nanocontext.c @@ -289,7 +289,7 @@ __asm__("\t.globl _context_entry\n" */ void *_NewContext( - char *pStackMem, /* pointer to context stack memory */ + char *pStackMem, /* pointer to aligned stack memory */ unsigned stackSize, /* size of stack in bytes */ _ContextEntry pEntry, /* context entry point function */ void *parameter1, /* first parameter to context entry point function */ @@ -354,7 +354,7 @@ void *_NewContext( * stack */ - ccs = (tCCS *)ROUND_UP(pStackMem, STACK_ALIGN); + ccs = (tCCS *) pStackMem; _NewContextInternal(ccs, pStackMem, stackSize, priority, options);