1.
First, you know
Arm
General registers and program counters in the corresponding state. The green color is the private register in the corresponding mode.
That is to say, the program runs in system and user mode and uses General registers in system and user mode. When an exception occurs, for example
FIQ
, The system will switch
FIQ
Mode, the corresponding
FIQ
Registers in the mode, where the green color is only
FIQ
Registers used only in the mode.
2.
During mode switching, the General Register status of the system and user mode should be protected so that the program can return normally after the Exception Processing is complete. Because
FIQ
Mode
R8-R14
For its private registers, so during the switching process
R8-R14
Therefore, it reduces the need for register access and enables quick access.
FIQ
Processing is called
FIQ
.
3.
Exception Handling action
. Of course, this is all done by the kernel itself. To
FIQ
For example.
When the system enters
FIQ
Mode
,
First, save the next instruction address of the original execution program
LR
Is
R14
Save
R14_fiq
.
Second, copy
CPSR
To
Spsr_fiq
.
Third, change
CPSR
Change the value of the mode bit
FIQ
Mode.
Fourth, change
PC
Value to point to the next instruction specified by the Exception Processing vector.
Leave Exception Handling
,
First, Set
LR
(
R14_fiq
)
PC
.
Second, Set
Spsr
(
Spsr_fiq
) Copy
CPSR
.
Third, clear the interruption prohibition mark (if it is set at the start time ).
4
. Abnormal interrupt vector
Abnormal interrupt vector address
Address
Exception interrupt type
Operating mode of the processor at entry
Zero X 00000000
Reset
Superuser
Zero X 00000004
Undefined command
Undefined
Zero X 00000008
Software interruption
Superuser
0x0000000c
Abort (prefetch refers)
Abort
Zero X 00000010
Abort (data)
Abort
Zero X 00000014
Retained
Retained
0x00000018 I
RQ IRQ
0x0000001c FIQ
FIQ
Exception interrupt priority
Interrupted
Priority
Reset
Highest
Data Exception
FIQ
IRQ
Prefetch refers to an abnormal interruption.
Undefined commands and software interruptions
Lowest
5
. When
IRQ
Interrupted
First
, The mode enters
IRQ
.
Second
,
PC
Jump
Zero X 00000018
. Because this is
IRQ
.
Third
,
Pass
Zero X 00000018
:
LDR
PC, irq_addr
. Jump to the corresponding interrupted service program. There is a problem with determining the interrupt source. Then there is a priority issue. Each interrupt source has its own interrupt service program.
Fourth
The interrupt source can be implemented by hardware or software. For example
Lpc21xx
In order to utilize the advantages of vector interrupt controller,
IRQ
The code at the interrupt vector entry is modified
Zero X 00000018
:
LDR
PC, [PC, #-0xff0]
.
This command maps addresses from memory
0xfffff030
Obtain data and load it
PC
In this way, you can directly obtain the interrupt source from the hardware. This reduces the interruption latency.
. Remember, Samsung's
Jx44b0
It seems that the interrupt source is determined by software, so an interrupt vector table should be created. I don't need it for a long time. I can't remember it.
Fifth
To get the interrupt source, you will know which interrupt service program to jump.
This is generally the definition.
Timer0_handler
Handler
Timer0
. This format calls a macro definition to protect the scene and jump to the interrupted service program.