diff --git a/arch/x86_64/src/interrupt/syscall.rs b/arch/x86_64/src/interrupt/syscall.rs index 7dfaf38..7133906 100644 --- a/arch/x86_64/src/interrupt/syscall.rs +++ b/arch/x86_64/src/interrupt/syscall.rs @@ -13,17 +13,16 @@ pub unsafe extern fn syscall() { let d; let e; let f; - asm!("xchg bx, bx" : "={rax}"(a), "={rbx}"(b), "={rcx}"(c), "={rdx}"(d), "={rsi}"(e), "={rdi}"(f) + asm!("" : "={rax}"(a), "={rbx}"(b), "={rcx}"(c), "={rdx}"(d), "={rsi}"(e), "={rdi}"(f) : : : "intel", "volatile"); a = syscall(a, b, c, d, e, f); } - asm!("xchg bx, bx" : : "{rax}"(a) : : "intel", "volatile"); + asm!("" : : "{rax}"(a) : : "intel", "volatile"); } - asm!("xchg bx, bx - push fs + asm!("push fs push rax mov rax, 0x18 mov fs, ax @@ -33,8 +32,7 @@ pub unsafe extern fn syscall() { inner(); // Interrupt return - asm!("xchg bx, bx - pop fs + asm!("pop fs iretq" : : : : "intel", "volatile"); } diff --git a/arch/x86_64/src/lib.rs b/arch/x86_64/src/lib.rs index fdcea65..61fb547 100644 --- a/arch/x86_64/src/lib.rs +++ b/arch/x86_64/src/lib.rs @@ -48,8 +48,7 @@ macro_rules! interrupt { } // Push scratch registers - asm!("xchg bx, bx - push rax + asm!("push rax push rcx push rdx push rdi @@ -67,8 +66,7 @@ macro_rules! interrupt { inner(); // Pop scratch registers and return - asm!("xchg bx, bx - pop fs + asm!("pop fs pop r11 pop r10 pop r9 @@ -95,8 +93,7 @@ macro_rules! interrupt_error { } // Push scratch registers - asm!("xchg bx, bx - push rax + asm!("push rax push rcx push rdx push rdi @@ -114,8 +111,7 @@ macro_rules! interrupt_error { inner(); // Pop scratch registers, error code, and return - asm!("xchg bx, bx - pop fs + asm!("pop fs pop r11 pop r10 pop r9 diff --git a/arch/x86_64/src/start.rs b/arch/x86_64/src/start.rs index c99dd64..d382f28 100644 --- a/arch/x86_64/src/start.rs +++ b/arch/x86_64/src/start.rs @@ -204,8 +204,7 @@ pub unsafe extern fn kstart_ap(stack_start: usize, stack_end: usize) -> ! { pub unsafe fn usermode(ip: usize, sp: usize) { // Test usermode - asm!("xchg bx, bx - mov rax, 0x2B + asm!("mov rax, 0x2B mov ds, ax mov es, ax mov fs, ax