diff --git a/src/e820.s b/src/e820.s index 59d9c78b..cb07e8e1 100644 --- a/src/e820.s +++ b/src/e820.s @@ -51,4 +51,5 @@ do_e820: stc # "function unsupported" error exit ret +.global mmap_ent mmap_ent: .word 0 diff --git a/src/main.rs b/src/main.rs index 7b552ca9..f63c65ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ #![feature(lang_items)] #![feature(global_asm)] -#![feature(llvm_asm)] +#![feature(asm)] #![no_std] #![no_main] @@ -10,6 +10,7 @@ compile_error!("The bootloader crate must be compiled for the `x86_64-bootloader extern crate rlibc; use bootloader::bootinfo::{BootInfo, FrameRange}; +use core::arch::asm; use core::{arch::global_asm, convert::TryInto, panic::PanicInfo}; use core::{mem, slice}; use fixedvec::alloc_stack; @@ -41,8 +42,8 @@ global_asm!(include_str!("video_mode/vga_320x200.s")); global_asm!(include_str!("video_mode/vga_text_80x25.s")); unsafe fn context_switch(boot_info: VirtAddr, entry_point: VirtAddr, stack_pointer: VirtAddr) -> ! { - llvm_asm!("call $1; ${:private}.spin.${:uid}: jmp ${:private}.spin.${:uid}" :: - "{rsp}"(stack_pointer), "r"(entry_point), "{rdi}"(boot_info) :: "intel"); + asm!("mov rsp, {1}; call {0}; 2: jmp 2b", + in(reg) entry_point.as_u64(), in(reg) stack_pointer.as_u64(), in("rdi") boot_info.as_u64()); ::core::hint::unreachable_unchecked() } @@ -87,8 +88,12 @@ extern "C" { #[no_mangle] pub unsafe extern "C" fn stage_4() -> ! { // Set stack segment - llvm_asm!("mov bx, 0x0 - mov ss, bx" ::: "bx" : "intel"); + asm!( + "push rbx + mov bx, 0x0 + mov ss, bx + pop rbx" + ); let kernel_start = 0x400000; let kernel_size = &_kernel_size as *const _ as u64;