I'm looking at some assembly for the start up of some firmware that runs on an ARM processor. The following exception vector table is defined:
LDR pc, =resetHandler
LDR pc, Undefined_Addr
LDR pc, SWI_Addr
LDR pc, Prefetch_Addr
LDR pc, Abort_Addr
B .
LDR pc, =irqHandler
LDR pc, FIQ_Addr
Does anyone know what the "." after the branch ("B") instruction does? In the disassembly window of the debugger, the instruction branches to itself. According to the data sheet, the entry is reserved, so I am guessing this just does an endless loop and waits for a watch-dog reset.
The branch instructions are used to change the sequence of instruction execution. Use branch instructions to change the sequence of instruction execution. Since all branch instructions are on word boundaries, the processor performing the branch ignores bits 30 and 31 of the generated branch target address.
In the ARM instruction set, a data-processing instruction that targets the PC behaves as a branch instruction. For more information, see Data-processing instructions. In the ARM and Thumb instruction sets, a load instruction that targets the PC behaves as a branch instruction.
For example, a branch instruction might be “If the result of the last ALU operation is negative, jump to location A in the program; otherwise, continue with the following instruction.” Such instructions allow…
a machine-language or assembly-language instruction that causes the computer to branch to another instruction.
In many assemblers .
means the current location counter, so yes, it's just an infinite loop, i.e. "branch to here".
[Note that some assemblers use $
or *
rather than .
]
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