1


.section ".text.boot"  // Make sure the linker puts this at the start of the kernel image

.global _start  // Execution starts here

_start:
    // Check processor ID is zero (executing on main core), else hang
    mrs     x1, mpidr_el1
    and     x1, x1, #3
    cbz     x1, 2f
    // We're not on the main core, so hang in an infinite wait loop
1:  wfe
    b       1b
2:  // We're on the main core!

    // Set stack to start below our code
    ldr     x1, =_start
    mov     sp, x1

    // Clean the BSS section
    ldr     x1, =__bss_start     // Start address
    ldr     w2, =__bss_size      // Size of the section
3:  cbz     w2, 4f               // Quit loop if zero
    str     xzr, [x1], #8
    sub     w2, w2, #1
    cbnz    w2, 3b               // Loop if non-zero

    // Jump to our main() routine in C (make sure it doesn't return)
4:  bl      main
    // In case it does return, halt the master core too
    b       1b


I am looking some bare metal code for Raspberry PI 4B,this is a bootloader file named start.s. I don't konw the mean of

b 1b

what exactly is "1b"? It doesn's seem like the lable "1:". Is it a physical address?

I'm not a complete beginner in assembly, I just never came across this before. Please help me, if u konow the answer. Thanks.

I google it, but no answer.

DanielSun
  • 33
  • 4
  • 1
    That's indeed the label `1:`. The `b` stands for "back". If google doesn't help maybe try the [manual](https://sourceware.org/binutils/docs/as/Symbol-Names.html), section "Local labels". – Jester Nov 02 '22 at 13:54
  • To Jester, thank you very much. I get it . – DanielSun Nov 02 '22 at 14:01

0 Answers0