diff --git a/os/src/main.rs b/os/src/main.rs index 85b51438..51f2ec02 100644 --- a/os/src/main.rs +++ b/os/src/main.rs @@ -1,7 +1,5 @@ #![no_std] #![no_main] -#![feature(global_asm)] -#![feature(asm)] #![feature(panic_info_message)] #![feature(alloc_error_handler)] @@ -23,6 +21,8 @@ mod timer; mod sync; mod mm; +use core::arch::global_asm; + global_asm!(include_str!("entry.asm")); global_asm!(include_str!("link_app.S")); diff --git a/os/src/mm/memory_set.rs b/os/src/mm/memory_set.rs index 582a2f8e..84262537 100644 --- a/os/src/mm/memory_set.rs +++ b/os/src/mm/memory_set.rs @@ -15,6 +15,7 @@ use crate::config::{ TRAP_CONTEXT, USER_STACK_SIZE }; +use core::arch::asm; extern "C" { fn stext(); @@ -341,4 +342,4 @@ pub fn remap_test() { false, ); println!("remap_test passed!"); -} \ No newline at end of file +} diff --git a/os/src/sbi.rs b/os/src/sbi.rs index 276c199d..c8ecbf1d 100644 --- a/os/src/sbi.rs +++ b/os/src/sbi.rs @@ -1,5 +1,7 @@ #![allow(unused)] +use core::arch::asm; + const SBI_SET_TIMER: usize = 0; const SBI_CONSOLE_PUTCHAR: usize = 1; const SBI_CONSOLE_GETCHAR: usize = 2; diff --git a/os/src/task/switch.rs b/os/src/task/switch.rs index fa75be1a..dd3a2d3e 100644 --- a/os/src/task/switch.rs +++ b/os/src/task/switch.rs @@ -1,6 +1,7 @@ -global_asm!(include_str!("switch.S")); - use super::TaskContext; +use core::arch::global_asm; + +global_asm!(include_str!("switch.S")); extern "C" { pub fn __switch( diff --git a/os/src/trap/mod.rs b/os/src/trap/mod.rs index 5bb54abb..113b34d8 100644 --- a/os/src/trap/mod.rs +++ b/os/src/trap/mod.rs @@ -21,6 +21,7 @@ use crate::task::{ }; use crate::timer::set_next_trigger; use crate::config::{TRAP_CONTEXT, TRAMPOLINE}; +use core::arch::{global_asm, asm}; global_asm!(include_str!("trap.S")); diff --git a/rust-toolchain b/rust-toolchain index c9f86822..a8a61591 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2021-12-15 +nightly-2022-01-01 diff --git a/user/src/lib.rs b/user/src/lib.rs index d5d891cf..378dbca7 100644 --- a/user/src/lib.rs +++ b/user/src/lib.rs @@ -1,5 +1,4 @@ #![no_std] -#![feature(asm)] #![feature(linkage)] #![feature(panic_info_message)] #![feature(alloc_error_handler)] @@ -72,4 +71,4 @@ pub fn sleep(period_ms: usize) { while sys_get_time() < start + period_ms as isize { sys_yield(); } -} \ No newline at end of file +} diff --git a/user/src/syscall.rs b/user/src/syscall.rs index 800a1788..dfe3966e 100644 --- a/user/src/syscall.rs +++ b/user/src/syscall.rs @@ -1,3 +1,5 @@ +use core::arch::asm; + const SYSCALL_READ: usize = 63; const SYSCALL_WRITE: usize = 64; const SYSCALL_EXIT: usize = 93; @@ -57,4 +59,4 @@ pub fn sys_exec(path: &str) -> isize { pub fn sys_waitpid(pid: isize, exit_code: *mut i32) -> isize { syscall(SYSCALL_WAITPID, [pid as usize, exit_code as usize, 0]) -} \ No newline at end of file +}