123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- # Symbol from main.rs
- .extern rust_entry
- .code32
- .section .multiboot_header, "a", @progbits
- /*
- * Multiboot v1 Header.
- * Required so that we can be booted by QEMU via the "-kernel" parameter.
- */
- .align 8
- .global multiboot_header
- multiboot_header:
- .long 0x1badb002
- .long 0x0
- .long -0x1badb002
- .section .text
- .global start
- start:
- # Prepare Multiboot2-handoff parameters for Rust
- mov %eax, %edi
- mov %ebx, %esi
- # Prepare stack + align it to 16 byte (for SSE registers)
- mov $stack_end, %eax
- sub $16, %eax
- # x86 quirk: stack is n-aligned at address x when %esp+$8 is n-aligned
- add $8, %eax
- # Set stack
- mov %eax, %esp
- mov %eax, %ebp
- # Enable SSE.
- # Strictly speaking, this is not necessary, but I activated SSE in the
- # compiler spec json file. Rustc/LLVM produces SSE coe for example from the
- # core::fmt code.
- mov %cr0, %eax
- and $0xFFFB, %ax # clear coprocessor emulation CR0.EM
- or $0x2, %ax # set coprocessor monitoring CR0.MP
- mov %eax, %cr0
- mov %cr4, %eax
- or $(3 << 9), %ax # set CR4.OSFXSR and CR4.OSXMMEXCPT
- mov %eax, %cr4
- push %ebp
- mov %esp, %ebp
- # x86 SystemV calling convention: Push arguments in reverse order to stack
- push %esi
- push %edi
- call rust_entry
- ud2
- .section .data
- # 16K natural-aligned stack.
- .align 16384
- stack_begin:
- .zero 16384
- stack_end:
|