Q about stack alignment on PowerPC.

Sergei Organov osv at javad.ru
Wed Sep 27 18:11:23 UTC 2000


Joel Sherrill <joel.sherrill at oarcorp.com> writes:

> Eric V... question for you are the bottom...
> 

[...]
> 
> The old_exception_code clearly still uses a software interrupt stack.
> See c/src/lib/libcpu/powerpc/old_exception_processing/cpu.c and search
> for _CPU_Install_interrupt_stack.
> 
> I cannot find the equivalent code in the new exception processing. Eric
> V,
> does the new exception code on the PPC use a software interrupt stack?

I believe I've figured this out myself. Corresponding code is in the

lib/libbsp/powerpc/shared/startup/bspstart.c:206

The interrupt stack pointer is loaded into the SPRG1 there and is calculated
using __rtems_end symbol that is to be defined by linker.

Corresponding linker script is

./lib/libbsp/powerpc/motorola_powerpc/startup/linkcmds

and the __rtems_end there is aligned to the 16 bytes boundary.

Thus there should be no problems with both initial and interrupt stacks until
this script is used to link application. However, if custom linker script is
used, the problem with stack alignment could appear again. Therefore I think
it'd be better to review powerpc code and explicitly ensure right stack
alignment in all places where stack pointers are initialized.

BTW, _CPU_Interrupt_stack_low and _CPU_Interrupt_stack_high variables seem to 
be not used (nor initialized) when new exception code is active. What is the
reason for new exception processing to violate rule of allocating of interrupt
stack by RTEMS core and then passing it to BSP using these variables?


BR,
Sergei.




More information about the users mailing list