![](https://csdnimg.cn/release/download_crawler_static/4932413/bg13.jpg)
Programmer's Model
15
To return normally from IRQ, use SUBS PC,R14_irq,#4 which will restore both the PC and the CPSR and
resume execution of the interrupted code.
3.4.3 Abort
An ABORT can be signalled by the external ABORT input. ABORT indicates that the current memory
access cannot be completed. For instance, in a virtual memory system the data corresponding to the current
address may have been moved out of memory onto a disc, and considerable processor activity may be
required to recover the data before the access can be performed successfully. ARM7 checks for ABORT
during memory access cycles. When successfully aborted ARM7 will respond in one of two ways:
(1) If the abort occurred during an instruction prefetch (a Prefetch Abort), the prefetched instruction is
marked as invalid but the abort exception does not occur immediately. If the instruction is not
executed, for example as a result of a branch being taken while it is in the pipeline, no abort will
occur. An abort will take place if the instruction reaches the head of the pipeline and is about to be
executed.
(2) If the abort occurred during a data access (a Data Abort), the action depends on the instruction type.
(a) Single data transfer instructions (LDR, STR) will write back modified base registers and the Abort
handler must be aware of this.
(b) The swap instruction (SWP) is aborted as though it had not executed, though externally the read
access may take place.
(c) Block data transfer instructions (LDM, STM) complete, and if write-back is set, the base is updated.
If the instruction would normally have overwritten the base with data (i.e. LDM with the base in
the transfer list), this overwriting is prevented. All register overwriting is prevented after the Abort
is indicated, which means in particular that R15 (which is always last to be transferred) is preserved
in an aborted LDM instruction.
When either a prefetch or data abort occurs, ARM7 performs the following:
(1) Saves the address of the aborted instruction plus 4 (for prefetch aborts) or 8 (for data aborts) in
R14_abt; saves CPSR in SPSR_abt.
(2) Forces M[4:0]=10111 (Abort mode) and sets the I bit in the CPSR.
(3) Forces the PC to fetch the next instruction from either address 0x0C (prefetch abort) or address 0x10
(data abort).
To return after fixing the reason for the abort, use SUBS PC,R14_abt,#4 (for a prefetch abort) or SUBS
PC,R14_abt,#8 (for a data abort). This will restore both the PC and the CPSR and retry the aborted
instruction.
The abort mechanism allows a demand paged virtual memory system to be implemented when suitable
memory management software is available. The processor is allowed to generate arbitrary addresses, and
when the data at an address is unavailable the MMU signals an abort. The processor traps into system
software which must work out the cause of the abort, make the requested data available, and retry the
aborted instruction. The application program needs no knowledge of the amount of memory available to
it, nor is its state in any way affected by the abort.