如何解决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_setup
和 jmp 0x08,protected_mode_setup
就像描述的 here 没有成功。
重现问题的最小来源:https://github.com/Luis-Hebendanz/rust_asm_error
我打开了一个问题:https://github.com/rust-lang/rust/issues/84676
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。