Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARM Assembly - Branch Instruction

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.

like image 753
waffleman Avatar asked May 12 '10 10:05

waffleman


People also ask

What is a branch instruction in assembly?

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.

What are branching instructions with ARM?

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.

What is branch instruction with example?

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…

What does branch instruction mean?

a machine-language or assembly-language instruction that causes the computer to branch to another instruction.


1 Answers

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 .]

like image 84
Paul R Avatar answered Nov 06 '22 07:11

Paul R