Rust gnu-asm,实模式远跳

问题描述

.intel_Syntax noprefix
smp_trampoline:
    # clear the direction flag (e.g. go forward in memory when using
    # instructions like lodsb)
    cld
    # disable interrupts
    cli

    # zero data segment
    xor ax,ax
    mov ds,ax

    # Set the A20 line
    in    al,0x92
    or    al,2
    out 0x92,al

    # Load 32-bit GDT
    lgdt gdt32_pointer

    # Enable protected mode
    mov eax,cr0
    or  eax,(1 << 0)
    mov cr0,eax
    # normally this should be jmp 0x8:mylabel
    jmp 0x08:protected_mode_setup

我正在尝试用 Rust 编写一个引导加载程序,并通过 global_asm!("start.s") 包含程序集。这意味着我只能使用 GNU Asm。现在我想在加载 GDT 后从 16 位模式跳到保护模式。在 nasm 中,这将是 GNU Asm 中的 jmp 0x08:mylabel,这似乎不存在?

error: unexpected token in argument list
   |
note: instantiated into assembly here
  --> <inline asm>:48:12
   |
48 |     jmp 0x8:protected_mode_setup
   |            ^

error: aborting due to prevIoUs error

我也试过 jmp far 0x08:protected_mode_setupjmp 0x08,protected_mode_setup 就像描述的 here 没有成功。

重现问题的最小来源:https://github.com/Luis-Hebendanz/rust_asm_error

我打开了一个问题:https://github.com/rust-lang/rust/issues/84676

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)