SPARC Context Switch Code

Sebastian Huber sebastian.huber at
Thu Feb 6 11:33:42 UTC 2014

On 2014-02-06 12:17, Ingolf Steinbach wrote:
> My original reply (which was also sent to Sebastian directly) bounced
> from the list, so here we are again.
> 2014-02-06 Sebastian Huber <sebastian.huber at>:
>> what do the RTEMS SPARC user think about the attached patch?  Why did the
>> SPARC context switch code save and restore volatile registers?
> According to the SPARC ABI, volatility of a register means that there
> is no guarantee that the register will retain its state across a
> function call.


> I understand that the _CPU_Context_switch can be
> invoked at arbitrary places within a user program (at least when using
> preemptive scheduling), so it must make sure that *all* registers are
> saved and restored. Otherwise it would render %g1 pretty much useless
> as (from a user POV) its content might change in an unpredictable way
> in the middle of a sequence of instructions.

Why do you think that _CPU_Context_switch() is invoked at arbitrary places?

The only valid invocation places for _CPU_Context_switch() are 
_Thread_Dispatch() and _Thread_Start_multitasking().

Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the users mailing list