To compare ARM processor modes with x86 modes of operation (ring0 to ring 3), user mode looks just like ring3, in which user space programs run. However I am not able to relate ring0 with either system mode or supervisor mode. Depending on the source of information, it seems that both modes can very well do the job of running a kernel in privileged mode. The only differences between the two modes that I could find out are the follwoing:
can you please explain me the differences between the modes, which a person coming from x86 background can understand ?
Also how does the subtle architectural differences between the modes, like number of banked registers, make one better than the other?
I think the ARM ARM makes it pretty clear (see below), dont think X86 just think about what this processors modes allow you to do or not do. And what you would need in an operating system and which modes are useful or not.
You have user and system and then the exception modes. Their restrictions are documented AFAIK. The newer ARMs have even more features/restrictions/protections, etc.
From the ARM ARM
Most application programs execute in User mode. When the processor is in User mode, the program being executed is unable to access some protected system resources or to change mode, other than by causing an exception to occur (see Exceptions on page A2-16). This allows a suitably-written operating system to control the use of system resources. The modes other than User mode are known as privileged modes. They have full access to system resources and can change mode freely. Five of them are known as exception modes:
-FIQ
-IRQ
-Supervisor
-Abort
-Undefined.
These are entered when specific exceptions occur. Each of them has some additional registers to avoid corrupting User mode state when the exception occurs (see Registers on page A2-4 for details).
The remaining mode is System mode, which is not entered by any exception and has exactly the same registers available as User mode. However, it is a privileged mode and is therefore not subject to the User mode restrictions. It is intended for use by operating system tasks that need access to system resources, but wish to avoid using the additional registers associated with the exception modes. Avoiding such use ensures that the task state is not corrupted by the occurrence of any exception.
Superviser mode is what you hit when you make the svc or sys call (same instruction I think they changed the name from svc). Similar to an int 21h in the dos days, this is how you, from user mode without any permissions, ask the operating system do do something. That switches control to supervisor mode then once in supervisor mode you can handle it there or switch modes, etc...Once you switch to user though you cant switch out. So for example if you want to setup the user stack you cant easily do that in user mode and then get back to operating system tasks. so you need a privileged mode that if nothing else has user register access.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With