SPARC BSP: Global Register usage
joel.sherrill at oarcorp.com
Tue Apr 4 20:26:55 UTC 2006
Antonio da Silva Fariña wrote:
> Hi all
> I need to write some assembler routines in a RTEMS application
> and I wonder about RTEMS global register usage.
> Does RTEMS make a specific use of any Sparc Global Registers ?
It shouldn't beyond that defined by the ABI.
> In V8 ABI G1 register is defined as Scratch. This makes the register
> volatile across function calls. But, what about context switch ? Is
> G1 saved and later restored inside task context.
Depends on your perspective. A voluntary task switch is essentially
a subroutine call and G1 does not have to be preserved.
But a preemption from an ISR requires that all registers for the interrupted
thread be saved so it is preserved.
If you are using G1 in a subroutine as a scratch register, you are OK.
If you think it is going to always hold specific application data, you will
quickly be surprised.
More information about the users