Ref asm&global_asm from core::arch.

This commit is contained in:
Yifan Wu 2022-01-21 10:11:07 -08:00
parent 2cad6d291e
commit f495dbb1e6
8 changed files with 10 additions and 5 deletions

View file

@ -1,4 +1,5 @@
use core::panic::PanicInfo; use core::panic::PanicInfo;
use core::arch::asm;
use crate::sbi::shutdown; use crate::sbi::shutdown;
use crate::task::current_kstack_top; use crate::task::current_kstack_top;

View file

@ -1,7 +1,5 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(global_asm)]
#![feature(asm)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
#![feature(alloc_error_handler)] #![feature(alloc_error_handler)]
@ -10,6 +8,8 @@ extern crate alloc;
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
use core::arch::global_asm;
#[macro_use] #[macro_use]
mod console; mod console;
mod lang_items; mod lang_items;

View file

@ -14,6 +14,7 @@ use crate::config::{
TRAMPOLINE, TRAMPOLINE,
MMIO, MMIO,
}; };
use core::arch::asm;
extern "C" { extern "C" {
fn stext(); fn stext();

View file

@ -14,7 +14,7 @@ const SBI_SHUTDOWN: usize = 8;
fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize { fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
let mut ret; let mut ret;
unsafe { unsafe {
asm!( core::arch::asm!(
"ecall", "ecall",
inlateout("x10") arg0 => ret, inlateout("x10") arg0 => ret,
in("x11") arg1, in("x11") arg1,

View file

@ -1,3 +1,5 @@
use core::arch::global_asm;
global_asm!(include_str!("switch.S")); global_asm!(include_str!("switch.S"));
use super::TaskContext; use super::TaskContext;

View file

@ -1,5 +1,6 @@
mod context; mod context;
use core::arch::{asm, global_asm};
use riscv::register::{ use riscv::register::{
mtvec::TrapMode, mtvec::TrapMode,
stvec, stvec,

View file

@ -1 +1 @@
nightly-2021-10-15 nightly-2022-01-19

View file

@ -25,7 +25,7 @@ const SYSCALL_SEMAPHORE_DOWN: usize = 1022;
fn syscall(id: usize, args: [usize; 3]) -> isize { fn syscall(id: usize, args: [usize; 3]) -> isize {
let mut ret: isize; let mut ret: isize;
unsafe { unsafe {
asm!( core::arch::asm!(
"ecall", "ecall",
inlateout("x10") args[0] => ret, inlateout("x10") args[0] => ret,
in("x11") args[1], in("x11") args[1],