[En-Nut-Discussion] arm port (RFC: Changing ARM mode)

Rocendo Bracamontes del toro rocendob at gmail.com
Tue Jan 13 23:33:36 CET 2009


On Tue, Jan 13, 2009 at 2:26 PM, Adam Dybkowski <adybkows at wp.pl> wrote:

> Alain M. wrote:
>
> >>   void NutSleep (uint32_t ms)
> >>    {
> >>        ENTRY_KERNEL_MODE(); // change mode to supervisor when applicable
> >>
> >>       ..... code execute at kernel level here ....
> >>
> >>        EXIT_KERNEL_MODE(); exit supervisor mode, enter user mode when
> >> applicable
> >>   }
> >
> > I am no expert in the matter, but in my undertanding this is not very
> > good. The problem is that SWI is a CALL, not a command has one parameter
> > for the function and parametters have to be fetch from the user stack.
> > This calls for an entire different achitecture.
>
> I think this is not a real problem because SWI call works similar to
> interrupt - CPU suddenly jumps to address 0x08, switches to Supervisor
> and ARM mode (if it was in Thumb). The SWI handler could extract the
> return address and jump there in priviledged Supervisor mode (extra
> bonus: own system stack) or switch into System mode (the same as User
> mode but priviledged). EXIT_KERNEL_MODE will be much easier because we
> have only to switch to User mode (restore CPSR as it was before
> ENTRY_KERNEL_MODE), without using SWI to do it.
>

 Agree ...



>
> --
> Adam Dybkowski
>                adybkows at wp.pl
>                http://dybkowski.net/
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>


More information about the En-Nut-Discussion mailing list