apaz
apaz

Reputation: 61

What .byte start_of_setup-1f means in linux kernel code

I want understand the meaning of x86 real mode entry point in linux kernel:

_start:
        # Explicitly enter this as bytes, or the assembler
        # tries to generate a 3-byte jump here, which causes
        # everything else to push off to the wrong offset.
        .byte   0xeb        # short (2-byte) jump
        .byte   start_of_setup-1f

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/boot/header.S#n298

Specifically the last line .byte start_of_setup-1f

Upvotes: 5

Views: 412

Answers (1)

Peter Cordes
Peter Cordes

Reputation: 363980

1: is a local label.

1f is a reference to label 1 Forward of the current line. (A file can contain multiple numeric labels. This is mostly useful for inline-asm or assembler macros which can insert the same block of code in multiple locations.)

So

.byte   start_of_setup - 1f

is the distance (in bytes) between the two labels, truncated (if necessary) down to one byte.

See also the tag wiki for more links to docs and guides.

Upvotes: 3

Related Questions