提交 772d5325 编写于 作者: chyyuu1972's avatar chyyuu1972

update code, now '-bios none' can get the same result as ch9

上级 7c9a5819
......@@ -71,7 +71,7 @@ disasm-vim: kernel
@nvim $(DISASM_TMP)
@rm $(DISASM_TMP)
run: run-inner-none
run: run-inner
run-inner-none: build
@qemu-system-riscv64 \
......
......@@ -260,9 +260,9 @@ pub fn rust_main() -> ! {
println!("KERN: init gpu");
let _gpu = GPU_DEVICE.clone();
println!("KERN: init keyboard");
// let _keyboard = KEYBOARD_DEVICE.clone();
//println!("KERN: init mouse");
//let _mouse = MOUSE_DEVICE.clone();
let _keyboard = KEYBOARD_DEVICE.clone();
println!("KERN: init mouse");
let _mouse = MOUSE_DEVICE.clone();
println!("KERN: init trap");
trap::init();
//trap::enable_timer_interrupt();
......
......@@ -95,18 +95,18 @@ pub fn trap_handler() -> ! {
Trap::Exception(Exception::IllegalInstruction) => {
current_add_signal(SignalFlags::SIGILL);
}
Trap::Interrupt(Interrupt::SupervisorTimer) => {
set_next_trigger();
check_timer();
suspend_current_and_run_next();
}
// Trap::Interrupt(Interrupt::SupervisorTimer) => {
// set_next_trigger();
// check_timer();
// suspend_current_and_run_next();
// }
Trap::Interrupt(Interrupt::SupervisorSoft) => {
//set_next_trigger();
const SSIP: usize = 1 << 1;
unsafe {
asm!("csrc sip, {}", in(reg) SSIP);
}
println!("TRAP: ssoft in Kern");
//println!("TRAP: ssoft in Kern");
check_timer();
// do not schedule now
}
......@@ -161,18 +161,18 @@ pub fn trap_from_kernel(_trap_cx: &TrapContext) {
Trap::Interrupt(Interrupt::SupervisorExternal) => {
crate::board::irq_handler();
}
Trap::Interrupt(Interrupt::SupervisorTimer) => {
//set_next_trigger();
check_timer();
// do not schedule now
}
// Trap::Interrupt(Interrupt::SupervisorTimer) => {
// //set_next_trigger();
// check_timer();
// // do not schedule now
// }
Trap::Interrupt(Interrupt::SupervisorSoft) => {
//set_next_trigger();
const SSIP: usize = 1 << 1;
unsafe {
asm!("csrc sip, {}", in(reg) SSIP);
}
println!("TRAP: ssoft in Kern");
//println!("TRAP: ssoft in Kern");
check_timer();
// do not schedule now
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册