EmbDev.net

Forum: ARM programming with GCC/GNU tools User Mode and System Mode


von Stephen R. (stereo)


Rate this post
useful
not useful
Hi,

I'm relatively new to ARM devices and to date have only written
bare-metal programs using a generic strartup script.  I've started doing
more research on ARM devices and came accross the numerous modes (User,
System, FIQ, IRQ etc)  I've used the two interrupt modes before and upon
examining my startup script I can see that I've been running my programs
in System mode.

Unfortunetly I can't appear to find any useful information on the net to
what the differneces between User and System Mode are.  Most resources
simply state that User Mode is where the user programs should be run and
system mode is used by the OS.  Can anyone please enlighten me to the
differences of the two modes??

--
Thanks,

Stephen

von Spencer O. (ntfreak)


Rate this post
useful
not useful
> Unfortunetly I can't appear to find any useful information on the net to
> what the differneces between User and System Mode are.  Most resources
> simply state that User Mode is where the user programs should be run and
> system mode is used by the OS.  Can anyone please enlighten me to the
> differences of the two modes??
>

The short and sweet version is once you are in user mode you cannot
change to any other mode - or enable/disable interrupts at core level.
user mode is classed as non privileged.

To answer fully look at the arm arch ref manual - search google for
ddi0100e_arm_arm.pdf

Cheers
Spen

von Clifford S. (clifford)


Rate this post
useful
not useful
The definitive place for such information is the ARM Architecture
Reference Manual (ARM-ARM):
http://www.altera.com/literature/third-party/ddi0100e_arm_arm.pdf See
section 2.2 (page A2-3)

The "Insider's Guides" available at http://www.hitex.co.uk/download.html
are also a good introduction to such things - if you are not using
precisely one of the parts listed, that does not matter much for the ARM
specific stuff - just select an ARM7 or ARM9 as appropriate.

The primary feature of the ARM modes is that some registers are specific
to a particular mode while others are shared. Which ones are shared
differs depending on the mode. Most importantly each mode has its own
stack pointer register. System and User modes share the same register
set (including SP), but User mode has resource access restrictions. In
practice, the restrictions are dependent on the specific part the
ARM-ARM says of User Mode:

* User mode cannot switch to another mode other than by causing an
exception that results in a mode switch.

* Memory system and co-processors may restrict User mode access.

So unless you are using a part with an MMU for example, there is little
advantage in User Mode over System Mode. Unless you are running an RTOS
you probably need not worry too much about Supervisor Mode either, and
even then you might not.

Clifford.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.