Reputation: 61
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
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 x86 tag wiki for more links to docs and guides.
Upvotes: 3