What is SVC mode?

Source: Internet
Author: User

The ARM processor has twenty-seven registers, some of which are used under certain conditions, so only sixteen registers can be used at a time...

Register 0 to register 7 is a general register and can be used for any purpose. Unlike the 80x86 processor, a specific register is required to be accessed as a stack, or the results of mathematical computation are placed in a accumulator like 6502, arm processors are highly flexible in register usage.
Registers 8 to 12 are General registers, but their shadow registers are used when switching to the FIQ mode.
Register 13 is typically used as an OS Stack pointer, but can be used as a general register. This is an operating system issue, not a processor issue. If you do not use the stack, you can use it freely in your code as long as you restore it later. Each processor mode has a shadow register for this register.
Register 14 is dedicated to holding the return point address to facilitate writing child routines. When you execute a branch with a connection, store the return address in R14. When the program runs for the first time, save the exit address in R14. All R14 instances must be saved to other registers (not actually valid) or a stack. This register has a shadow Register in each processor mode. Once the connection address has been saved, this register can be used as a general register.
Register 15 is the program counter. In addition to holding the 26-digit number of the address currently used by the instruction program, it also holds the status of the processor.
Provide the following charts for clarity:

User Mode SVC mode IRQ mode FIQ mode APCs

R0 ------- R0 ------- R0 ------- R0 A1
R1 ------- R1 ------- R1 ------- R1 A2
R2 ------- R2 ------- R2 ------- R2 A3
R3 ------- R3 ------- R3 ------- R3 A4
R4 ------- R4 ------- R4 ------- R4 V1
R5 ------- R5 ------- R5 ------- R5 v2
R6 ------- R6 ------- R6 ------- R6 v3
R7 ------- R7 ------- R7 ------- R7 v4
R8 ------- R8 ------- R8 r8_fiq V5
R9 ------- R9 ------- R9 r9_fiq v6
R10 ------ R10 ------ R10 r10_fiq SL
R11 ------ R11 ------ R11 r11_fiq fp
R12 ------ R12 ------ R12 r12_fiq IP
R13 r13_svc r13_irq r13_fiq sp
R14 r14_svc r14_irq r14_fiq lR
------------- R15/PC ------------- PC

The rightmost column is the name used by the APCs Code. For details about APCs, see here.
The program counter structure is as follows:

Bits 31 30 29 28 27 26 25------------2 1 0

N z c v I f Cheng Shen S0

For details about R15, see psr.html.
The following is the "Mode" you want to know, such as the "FIQ" Mode mentioned above.

User Mode: the normal mode of running the application. Restrict your memory access and you cannot directly read hardware devices.
Super User Mode (SVC mode) is mainly used for SWI (software interruption) and OS (operating system ). This mode has additional privileges that allow you to further control the computer. For example, you must enter the superuser mode to read a plug-in (podule ). This cannot be completed in user mode.
Interrupt mode (IRQ mode) is used to process peripherals that initiate an interrupt. This mode is also privileged. The devices that cause IRQ include the keyboard, vsync (when screen refreshing occurs), IOC timer, serial port, hard disk, floppy disk, and so on...
The FIQ mode is used to process peripherals that initiate a fast interrupt. This mode is privileged. As a result, FIQ devices have floppy disks, serial ports (such as the a5000 on the 82c71x machine), and econet.
The difference between IRQ and FIQ is that for FIQ, you must handle your affairs as soon as possible and leave this mode. IRQ can be interrupted by FIQ, but IRQ cannot be interrupted by FIQ. To make FIQ faster, more shadow registers are available. FIQ cannot call SWI. FIQ must also disable interruption. If a FIQ routine must re-enable interrupt, it is too slow and should be IRQ rather than FIQ.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.