如何翻译 GAS 1: in NASM assembly?

How to translate GAS 1: in NASM assembly?

我想写一个小的OS来提高我的编程技能,这在一定程度上起到了作用。现在我尝试了解 linux 0.01 源代码以了解更多信息。要编译它,我需​​要将某个文件 (head.s) 翻译成 nasm 语法,因为我的工具链不喜欢 gas 文件。这没什么大不了的(我想)直到我意识到我忘记了什么。

一段代码:

_pg_dir:
startup_32:
    movl [=11=]x10,%eax
    mov %ax,%ds
    mov %ax,%es
    mov %ax,%fs
    mov %ax,%gs
    lss _stack_start,%esp
    call setup_idt
    call setup_gdt
    movl [=11=]x10,%eax     # reload all the segment registers
    mov %ax,%ds     # after changing gdt. CS was already
    mov %ax,%es     # reloaded in 'setup_gdt'
    mov %ax,%fs
    mov %ax,%gs
    lss _stack_start,%esp
    xorl %eax,%eax
1:  incl %eax       # check that A20 really IS enabled  ~~~
    movl %eax,0x000000
    cmpl %eax,0x100000
    je 1b                                             ~~~
    movl %cr0,%eax      # check math chip
    andl [=11=]x80000011,%eax   # Save PG,ET,PE
    testl [=11=]x10,%eax
    jne 1f          # ET is set - 387 is present      ~~~
    orl ,%eax     # else set emulate bit
1:  movl %eax,%cr0                                    ~~~
jmp after_page_tables

"~~~" 标记了我不完全理解的行。 1b 和 1f 不是标签。至少不像我从英特尔语法中知道的那样。我必须如何翻译标签和条件跳转?

这些是 local labels,一个 gas-specific 功能。

这里1f指的是1标签的next实例(forward)和1b指的是前一个实例 (backward).

所以代码像

1:  blah blah
    jmp 1b
    blah blah
    jmp 1f
    blah blah
1:  blah blah

可以改写为

xx: blah blah
    jmp xx
    blah blah
    jmp yy
    blah blah
yy: blah blah