fix ch3
This commit is contained in:
parent
78d0a70221
commit
2f9711a3f1
4 changed files with 12 additions and 7 deletions
3
os/src/boards/qemu.rs
Normal file
3
os/src/boards/qemu.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
//! Constants used in rCore for qemu
|
||||
|
||||
pub const CLOCK_FREQ: usize = 12500000;
|
|
@ -22,6 +22,10 @@
|
|||
#![feature(panic_info_message)]
|
||||
|
||||
use core::arch::global_asm;
|
||||
|
||||
#[path = "boards/qemu.rs"]
|
||||
mod board;
|
||||
|
||||
#[macro_use]
|
||||
mod console;
|
||||
mod config;
|
||||
|
|
|
@ -6,11 +6,9 @@ pub fn console_putchar(c: usize) {
|
|||
sbi_rt::legacy::console_putchar(c);
|
||||
}
|
||||
|
||||
/// use sbi call to getchar from console (qemu uart handler)
|
||||
#[allow(unused)]
|
||||
pub fn console_getchar() -> usize {
|
||||
#[allow(deprecated)]
|
||||
sbi_rt::legacy::console_getchar()
|
||||
/// use sbi call to set timer
|
||||
pub fn set_timer(timer: usize) {
|
||||
sbi_rt::set_timer(timer as _);
|
||||
}
|
||||
|
||||
/// use sbi call to shutdown the kernel
|
||||
|
|
|
@ -17,6 +17,7 @@ mod task;
|
|||
|
||||
use crate::config::MAX_APP_NUM;
|
||||
use crate::loader::{get_num_app, init_app_cx};
|
||||
use crate::sbi::shutdown;
|
||||
use crate::sync::UPSafeCell;
|
||||
use lazy_static::*;
|
||||
use switch::__switch;
|
||||
|
@ -134,8 +135,7 @@ impl TaskManager {
|
|||
// go back to user mode
|
||||
} else {
|
||||
println!("All applications completed!");
|
||||
use crate::board::QEMUExit;
|
||||
crate::board::QEMU_EXIT_HANDLE.exit_success();
|
||||
shutdown(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue