From abd9d361e4da0035e87b76a093400cf9627b713f Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Sat, 1 Jan 2022 03:07:09 -0800 Subject: [PATCH] Bump to rust nightly-2022-01-01, feature global_asm,asm->stable --- os/src/lang_items.rs | 1 + os/src/main.rs | 4 ++-- os/src/mm/memory_set.rs | 1 + os/src/sbi.rs | 2 ++ os/src/task/switch.rs | 5 +++-- os/src/trap/mod.rs | 1 + rust-toolchain | 2 +- user/src/lib.rs | 1 - user/src/syscall.rs | 2 ++ 9 files changed, 13 insertions(+), 6 deletions(-) diff --git a/os/src/lang_items.rs b/os/src/lang_items.rs index eedbd83d..daf86320 100644 --- a/os/src/lang_items.rs +++ b/os/src/lang_items.rs @@ -1,4 +1,5 @@ use core::panic::PanicInfo; +use core::arch::asm; use crate::sbi::shutdown; use crate::task::current_kstack_top; diff --git a/os/src/main.rs b/os/src/main.rs index d4b0934e..3a960a65 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)] @@ -24,6 +22,8 @@ mod mm; mod fs; mod drivers; +use core::arch::global_asm; + global_asm!(include_str!("entry.asm")); fn clear_bss() { diff --git a/os/src/mm/memory_set.rs b/os/src/mm/memory_set.rs index 575f5a34..30bc7689 100644 --- a/os/src/mm/memory_set.rs +++ b/os/src/mm/memory_set.rs @@ -14,6 +14,7 @@ use crate::config::{ TRAMPOLINE, MMIO, }; +use core::arch::asm; extern "C" { fn stext(); 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 5fd95f5b..f0f60afe 100644 --- a/os/src/trap/mod.rs +++ b/os/src/trap/mod.rs @@ -22,6 +22,7 @@ use crate::task::{ }; use crate::timer::{set_next_trigger, check_timer}; use crate::config::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 4fe0e2a2..50b6439e 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)] diff --git a/user/src/syscall.rs b/user/src/syscall.rs index 8d5b6f5b..e85fbbb9 100644 --- a/user/src/syscall.rs +++ b/user/src/syscall.rs @@ -1,3 +1,5 @@ +use core::arch::asm; + const SYSCALL_DUP: usize = 24; const SYSCALL_OPEN: usize = 56; const SYSCALL_CLOSE: usize = 57;