Skip to content

Commit 64e26c9

Browse files
committed
Use new inline assembly syntax
1 parent 794c5b8 commit 64e26c9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(lang_items)]
22
#![feature(global_asm)]
3-
#![feature(llvm_asm)]
3+
#![feature(asm)]
44
#![no_std]
55
#![no_main]
66

@@ -42,8 +42,9 @@ global_asm!(include_str!("video_mode/vga_320x200.s"));
4242
global_asm!(include_str!("video_mode/vga_text_80x25.s"));
4343

4444
unsafe fn context_switch(boot_info: VirtAddr, entry_point: VirtAddr, stack_pointer: VirtAddr) -> ! {
45-
llvm_asm!("call $1; ${:private}.spin.${:uid}: jmp ${:private}.spin.${:uid}" ::
46-
"{rsp}"(stack_pointer), "r"(entry_point), "{rdi}"(boot_info) :: "intel");
45+
asm!("movq {1}, %rsp; callq *{0}; 0: jmp 0b",
46+
in(reg) entry_point.as_u64(), in(reg) stack_pointer.as_u64(), in("rdi") boot_info.as_u64(),
47+
options(att_syntax));
4748
::core::hint::unreachable_unchecked()
4849
}
4950

@@ -88,8 +89,12 @@ extern "C" {
8889
#[no_mangle]
8990
pub unsafe extern "C" fn stage_4() -> ! {
9091
// Set stack segment
91-
llvm_asm!("mov bx, 0x0
92-
mov ss, bx" ::: "bx" : "intel");
92+
asm!(
93+
"push rbx
94+
mov bx, 0x0
95+
mov ss, bx
96+
pop rbx"
97+
);
9398

9499
let kernel_start = 0x400000;
95100
let kernel_size = &_kernel_size as *const _ as u64;

0 commit comments

Comments
 (0)