mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-24 10:26:25 +04:00
update code, now '-bios none' can get the same result as ch9
This commit is contained in:
parent
7c9a58192a
commit
772d532563
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user