Rust gnu-asm, far jump in real mode

89 views Asked by At
.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

I'm trying to write a bootloader in Rust with the assembly being included through global_asm!("start.s"). This means I'm limited to using GNU Asm. Now I want to make a far jump from 16bit mode to protected mode after loading the GDT. In nasm this would be a jmp 0x08:mylabel in GNU Asm this does not seem to exist?

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

I also tried jmp far 0x08:protected_mode_setup and jmp 0x08, protected_mode_setup like described here without success.

Minimal source to reproduce the issue: https://github.com/Luis-Hebendanz/rust_asm_error

I opened an issue: https://github.com/rust-lang/rust/issues/84676

0

There are 0 answers