[En-Nut-Discussion] arm port (RFC: Changing ARM mode)
harald.kipp at egnite.de
Tue Jan 13 10:08:16 CET 2009
Harald Kipp wrote:
> Rocendo Bracamontes del toro wrote:
>> While debugging some interrupts I noticed that the threads runs in
>> Supervisor mode. I was expecting to see the threads in User mode and the
>> kernel in Supervisor mode.
>> Any particular reason why the threads runs under Supervisor mode?
> There's no such thing like a privileged kernel in Nut/OS. In fact the
> system calls are normal C functions, linked to the applications. The
> only special part is thread switching.
After running into trouble while implementing Duane's exception handler
I recognized that it is a bad idea to run Nut/OS in supervisor mode.
Looking to the original port for the Gameboy, I see that this one runs
in user mode. Probably there had been problems (not being able to
enable/disable IRQs) and the switch to user mode had been simply
commented out, leaving the CPU in supervisor mode (overwriting sp_svc
The user mode may indeed cause problems, because our simple OS doesn't
provide something like 'enter kernel routine'. Thus, my suggestion is to
run the application and system routines in system mode, which is the
privileged mode that uses the user mode register bank.
More information about the En-Nut-Discussion