You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Julian Ingram <Ju...@imgtec.com> on 2017/09/14 10:33:37 UTC

task stack initialisation change proposal

Hi All,

Currently the stack top and size are initialised just after the architecture specific initialisation of the stack, I propose moving the architecture specific initialisation so they can be modified within it and not overwritten.

The PIC32 port needs the stack to be 8 aligned, currently that is achieved by constructing the stack from uint64_ts however this is not guaranteed by the C spec to be effective. A solution would be to align the stack within os_arch_task_stack_init (in case the former method is not effective). The lazy FPU context is stored at the stack top, so this needs to be coherent.

As discussed:

https://github.com/apache/mynewt-core/pull/474#discussion_r131878603

I have made a PR with these changes:

https://github.com/apache/mynewt-core/pull/548/commits/37e4b27eb2736cd8221b63ff8a88b1bf566d94e0

Any comments would be appreciated.

Thanks,

Julian Ingram
Software Design Engineer
MIPS Platforms
Imagination Technologies Limited
t: +44 (0)113 2429814
www.imgtec.com<http://www.imgtec.com/>


Re: task stack initialisation change proposal

Posted by marko kiiskila <ma...@runtime.io>.
+1 from me. After merging this, I’d also want to change the native target stack
initialization to do same thing (as that has similar alignment restrictions).


> On Sep 14, 2017, at 3:33 AM, Julian Ingram <Ju...@imgtec.com> wrote:
> 
> Hi All,
> 
> Currently the stack top and size are initialised just after the architecture specific initialisation of the stack, I propose moving the architecture specific initialisation so they can be modified within it and not overwritten.
> 
> The PIC32 port needs the stack to be 8 aligned, currently that is achieved by constructing the stack from uint64_ts however this is not guaranteed by the C spec to be effective. A solution would be to align the stack within os_arch_task_stack_init (in case the former method is not effective). The lazy FPU context is stored at the stack top, so this needs to be coherent.
> 
> As discussed:
> 
> https://github.com/apache/mynewt-core/pull/474#discussion_r131878603
> 
> I have made a PR with these changes:
> 
> https://github.com/apache/mynewt-core/pull/548/commits/37e4b27eb2736cd8221b63ff8a88b1bf566d94e0
> 
> Any comments would be appreciated.
> 
> Thanks,
> 
> Julian Ingram
> Software Design Engineer
> MIPS Platforms
> Imagination Technologies Limited
> t: +44 (0)113 2429814
> www.imgtec.com<http://www.imgtec.com/>
>