or1k fix bug: Initialize thread context with higher stack address.

Since or1k architecture stack grows down, threads should be initialized
with high stack addresses instead of lower ones. This is done in
_CPU_Context_Initialize function.
This commit is contained in:
Hesham ALMatary
2014-09-29 14:36:52 -05:00
committed by Joel Sherrill
parent 79bbb1cb67
commit 5464752f79
@@ -32,13 +32,14 @@ void _CPU_Context_Initialize(
/* Decrement 200 byte to account for red-zone */
uint32_t stack = ((uint32_t) stack_area_begin) - 200;
uint32_t sr;
uint32_t stack_high = stack + stack_area_size;
sr = _OR1K_mfspr(CPU_OR1K_SPR_SR);
memset(context, 0, sizeof(*context));
context->r1 = stack;
context->r2 = stack;
context->r1 = stack_high;
context->r2 = stack_high;
context->r9 = (uint32_t) entry_point;
context->sr = sr;
}