Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Atmel ARM7TDMI datasheet.1999.pdf
Скачиваний:
31
Добавлен:
23.08.2013
Размер:
1.45 Mб
Скачать

Software Interrupt (SWI)

The instruction is only executed if the condition is true. The various conditions are defined in Table 6. The instruction encoding is shown in Figure 37, below.

The software interrupt instruction is used to enter Supervisor mode in a controlled manner. The instruction causes the software interrupt trap to be taken, which effects the

mode change. The PC is then forced to a fixed value (0x08) and the CPSR is saved in SPSR_svc. If the SWI vector address is suitably protected (by external memory management hardware) from modification by the user, a fully protected operating system may be constructed.

Figure 33. Software Interrupt Instruction

31

28

27

24

23

0

 

Cond

 

1111

 

Comment field (ignored by Processor)

 

 

 

 

 

 

Condition field

Return from the supervisor

The PC is saved in R14_svc upon entering the software interrupt trap, with the PC adjusted to point to the word after the SWI instruction. MOVS PC,R14_svc will return to the calling program and restore the CPSR.

Note that the link mechanism is not re-entrant, so if the supervisor code wishes to use software interrupts within itself it must first save a copy of the return address and SPSR.

Comment field

The bottom 24 bits of the instruction are ignored by the processor, and may be used to communicate information to the supervisor code. For instance, the supervisor may look

at this field and use it to index into an array of entry points for routines which perform the various supervisor functions.

Instruction cycle times

Software interrupt instructions take 2S + 1N incremental cycles to execute, where S and N are as defined in Cycle Types

Assembler syntax

SWI{cond} <expression>

{cond} two character condition mnemonic, Table 6.

<expression> is evaluated and placed in the comment field (which is ignored by ARM7TDMI).

64 Instruction Set

Соседние файлы в предмете Электротехника