【问题标题】:What .byte start_of_setup-1f means in linux kernel code.byte start_of_setup-1f 在 linux 内核代码中的含义
【发布时间】:2016-07-21 02:53:40
【问题描述】:

我想了解linux内核中x86实模式入口点的含义:

_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

特别是最后一行.byte start_of_setup-1f

【问题讨论】:

    标签: assembly linux-kernel


    【解决方案1】:

    1:local label

    1f 是对标签1 的引用,位于当前行的前面。 (一个文件可以包含多个数字标签。这对于可以在多个位置插入相同代码块的内联汇编或汇编宏非常有用。)

    所以

    .byte   start_of_setup - 1f
    

    是两个标签之间的距离(以字节为单位),截断(如有必要)到一个字节。

    另请参阅 标签 wiki 以获取更多文档和指南链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-01
      相关资源
      最近更新 更多