So I'm looking into the source code for Redox OS (An operating system made with Rust) just to see if I can learn something.
I'm reading the assembly file start.s in the bootloader
folder. In the interrupt_vector_table
label we have:
interrupt_vector_table:
b . @ Reset
b .
b . @ SWI instruction
b .
b .
b .
b .
b .
What exactly is b .
?
I'm not a complete beginner in assembly, I just never came across this before.
The B instruction causes a branchto label . The BL instruction copies the address of the next instruction into r14 (lr, the link register), and causes a branch to label . Machine-level B and BL instructions have a range of ±32Mb from the address of the current instruction.
The b instruction for the ARM CPU is nearly the same as the jmp instruction for the x86 CPU: A jump instruction. Using the GNU tool chain . means: Address of the instruction itself.
b label Branch instruction Unconditionally branch to the instruction at the label. beq Rsrc1, Src2, label Branch on Equal Conditionally branch to the instruction at the label if the contents of register Rsrc1 equals Src2.
Symbol definition. An ordinary symbol is defined in: The name entry in a machine or assembler instruction of the assembler language. One of the operands of an EXTRN or WXTRN instruction.
The b
instruction for the ARM CPU is nearly the same as the jmp
instruction for the x86 CPU: A jump instruction
Using the GNU tool chain .
means: Address of the instruction itself.
So b .
is equal to:
temporaryLabel:
b temporaryLabel
or (for x86 CPUs):
temporaryLabel:
jmp temporaryLabel
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