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

This commit is contained in:
Yu Chen 2023-01-03 10:05:40 +08:00
parent 7c9a58192a
commit 772d532563
3 changed files with 16 additions and 16 deletions

View File

@ -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 \

View File

@ -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();

View File

@ -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
}