Is it correct to store MSR in context switch?

Joel Sherrill joel.sherrill at OARcorp.com
Wed Jan 23 19:17:12 UTC 2002



leonp wrote:
> 
> Hello, all.
>         I encountered the following problem (MPC860, RTEMS 20001201 but this seems
> to be not touched):
>         The Machine Status Register is saved each time the context switch is
> performed. This leads to the following unexpected result - if in one task the
> _ISR_Disable(arg) is used, it may be neutralized by the task switch. One can
> say, that this is very unusual thing to disable interrupts in the running
> system still doing task switching. But this is not an impossible case - I
> need it :-)).

This is the way RTEMS was spec'ed, designed, and implemented. :)
Interrupt level is maintained per task (see rtems_task_mode()).

>         Will it cause any harm if the MSR register will not be saved in context
> switches? It does not seem to contain any task specific information...

Interrupt disable level and FPU enable are maintained on a per task
basis.

The PPC port has to treat all tasks as FP because we have caught uses
of FPU registers in code that you would not have expected it in.
I recall that printf() was the culprit.

> leonp at plris.com

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list