[PATCH] or1k fix bug: Initialize thread context with higher stack address.
Hesham Moustafa
heshamelmatary at gmail.com
Mon Sep 29 05:53:19 UTC 2014
Hi,
Please do not miss this patch, it fixes a critical bug in the new or1k port.
Regards,
Hesham
On Fri, Sep 19, 2014 at 4:55 PM, Hesham ALMatary <heshamelmatary at gmail.com>
wrote:
> 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.
> ---
> cpukit/score/cpu/or1k/or1k-context-initialize.c | 5 +++--
> 1 file 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 1c9cdd7..a7205e3 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;
> }
> --
> 1.9.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20140929/3c3a2a04/attachment-0002.html>
More information about the devel
mailing list