summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHesham ALMatary <heshamelmatary@gmail.com>2014-09-19 09:55:09 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-09-29 14:36:52 -0500
commit5464752f79983a84d81ba9022da1ee588a2f839c (patch)
tree25a8b245ff68e47c7abd92d2634d882cf4287270
parentbsp/genmcf548x: Use inline cache implementation (diff)
downloadrtems-5464752f79983a84d81ba9022da1ee588a2f839c.tar.bz2
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.
-rw-r--r--cpukit/score/cpu/or1k/or1k-context-initialize.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpukit/score/cpu/or1k/or1k-context-initialize.c b/cpukit/score/cpu/or1k/or1k-context-initialize.c
index 1c9cdd7b5e..a7205e39f5 100644
--- a/cpukit/score/cpu/or1k/or1k-context-initialize.c
+++ b/cpukit/score/cpu/or1k/or1k-context-initialize.c
@@ -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;
}