[Barrelfish-users] problem in arm context switching

Simon Peter speter at inf.ethz.ch
Sun Jul 14 01:42:48 CEST 2013


Hi,

While conducting the XScale port a few years ago, I remember discovering 
that the original Barrelfish ARM code (which was written for the 
QEMU-simulated ARMv5) executed in system mode, instead of protected 
mode. This went undiscovered due to the QEMU emulation, which was not 
impacted by this error.

I fixed it for the XScale port and the successive ARMv7 port. The 
original ARMv5 version was left unmodified. In case you are basing your 
code on that version, you might have run into this problem.

  -- Simon

On 13-07-12 05:08 AM, Wang Nan wrote:
> Hi,
>
> CPU driver does context switching at do_resume(), it saves user mode's cpsr to spsr, then use
>
> "ldmia  %[regs], {r0-r15}^"
>
> to restore cpsr and all registers.
>
> However, the code is executed in SYSTEM mode, and SYSTEM mode does't have spsr.
>
> According to arm manual, do "ldmia  %[regs], {r0-r15}^" in system mode causes unpredictable behaviors.
>
> Could anyone provide a solution to it?
>
> I think the arm context switching code should be reviewed carefully.
>
> Thany you!
>
>
> _______________________________________________
> Barrelfish-users mailing list
> Barrelfish-users at lists.inf.ethz.ch
> https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users




More information about the Barrelfish-users mailing list