Replace llvm_asm! with asm

This commit is contained in:
Yifan Wu 2021-07-18 18:59:54 +08:00
parent 7b815ac2f5
commit fd00e8de3a
3 changed files with 8 additions and 7 deletions

View file

@ -57,7 +57,7 @@ pub fn load_apps() {
core::slice::from_raw_parts(num_app_ptr.add(1), num_app + 1) core::slice::from_raw_parts(num_app_ptr.add(1), num_app + 1)
}; };
// clear i-cache first // clear i-cache first
unsafe { llvm_asm!("fence.i" :::: "volatile"); } unsafe { asm!("fence.i"); }
// load apps // load apps
for i in 0..num_app { for i in 0..num_app {
let base_i = get_base_i(i); let base_i = get_base_i(i);

View file

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#![feature(global_asm)] #![feature(global_asm)]
#![feature(llvm_asm)] #![feature(asm)]
#![feature(panic_info_message)] #![feature(panic_info_message)]
#[macro_use] #[macro_use]

View file

@ -14,11 +14,12 @@ 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 {
llvm_asm!("ecall" asm!(
: "={x10}" (ret) "ecall",
: "{x10}" (arg0), "{x11}" (arg1), "{x12}" (arg2), "{x17}" (which) inlateout("x10") arg0 => ret,
: "memory" in("x11") arg1,
: "volatile" in("x12") arg2,
in("x17") which,
); );
} }
ret ret