diff --git a/os/src/batch.rs b/os/src/batch.rs index 816e8b78..7f29b21b 100644 --- a/os/src/batch.rs +++ b/os/src/batch.rs @@ -1,6 +1,7 @@ use lazy_static::*; use crate::trap::TrapContext; use crate::sync::UPSafeCell; +use core::arch::asm; const USER_STACK_SIZE: usize = 4096 * 2; const KERNEL_STACK_SIZE: usize = 4096 * 2; diff --git a/os/src/main.rs b/os/src/main.rs index a01c22f0..3cea360f 100644 --- a/os/src/main.rs +++ b/os/src/main.rs @@ -1,9 +1,9 @@ #![no_std] #![no_main] -#![feature(global_asm)] -#![feature(asm)] #![feature(panic_info_message)] +use core::arch::global_asm; + #[macro_use] mod console; mod lang_items; diff --git a/os/src/sbi.rs b/os/src/sbi.rs index 935fe24e..aa12b7f3 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/trap/mod.rs b/os/src/trap/mod.rs index e42b05fb..98ae35cf 100644 --- a/os/src/trap/mod.rs +++ b/os/src/trap/mod.rs @@ -12,6 +12,7 @@ use riscv::register::{ }; use crate::syscall::syscall; use crate::batch::run_next_app; +use core::arch::global_asm; global_asm!(include_str!("trap.S")); @@ -47,4 +48,4 @@ pub fn trap_handler(cx: &mut TrapContext) -> &mut TrapContext { cx } -pub use context::TrapContext; \ No newline at end of file +pub use context::TrapContext; 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/bin/00hello_world.rs b/user/src/bin/00hello_world.rs index 242749ac..f4f0332e 100644 --- a/user/src/bin/00hello_world.rs +++ b/user/src/bin/00hello_world.rs @@ -1,10 +1,11 @@ #![no_std] #![no_main] -#![feature(asm)] #[macro_use] extern crate user_lib; +use core::arch::asm; + #[no_mangle] fn main() -> i32 { println!("Hello, world!"); @@ -12,4 +13,4 @@ fn main() -> i32 { asm!("sret"); } 0 -} \ No newline at end of file +} diff --git a/user/src/lib.rs b/user/src/lib.rs index c06f9245..baa59e81 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)] @@ -35,4 +34,4 @@ fn clear_bss() { use syscall::*; pub fn write(fd: usize, buf: &[u8]) -> isize { sys_write(fd, buf) } -pub fn exit(exit_code: i32) -> isize { sys_exit(exit_code) } \ No newline at end of file +pub fn exit(exit_code: i32) -> isize { sys_exit(exit_code) } diff --git a/user/src/syscall.rs b/user/src/syscall.rs index bb7582f2..3889d305 100644 --- a/user/src/syscall.rs +++ b/user/src/syscall.rs @@ -1,3 +1,5 @@ +use core::arch::asm; + const SYSCALL_WRITE: usize = 64; const SYSCALL_EXIT: usize = 93;