Compare commits

..

No commits in common. "739fa56ece9aeb0cef17af75d00a9e7b59cc83e8" and "d2fb4a68cad4913d8dffd3ed805bc8601aaaa81a" have entirely different histories.

4 changed files with 6 additions and 16 deletions

View File

@ -24,8 +24,4 @@ pub fn halt() -> ! {
pub fn wait_for_interrupt() -> () {
unsafe { asm!("hlt"); }
}
pub fn breakpoint() -> () {
unsafe { asm!("int3"); }
}

View File

@ -14,16 +14,11 @@ extern "x86-interrupt" fn page_fault_handler(stack_frame: InterruptStackFrame, f
try_println!("Page fault at {:#?}\n{:#?}", faulting_address, stack_frame);
}
extern "x86-interrupt" fn double_fault_handler(stack_frame: InterruptStackFrame, _error_code: u64) -> ! {
panic!("Double fault!\n{:#?}", stack_frame);
}
pub fn load()
{
unsafe {
IDT.breakpoint.set_handler_fn(breakpoint_handler);
IDT.page_fault.set_handler_fn(page_fault_handler);
IDT.double_fault.set_handler_fn(double_fault_handler);
IDT.load();
}
}

View File

@ -15,6 +15,8 @@ mod log;
use arch::cpu;
use arch::interrupts;
use x86_64::instructions::interrupts::int3;
use video::Color;
#[no_mangle]
@ -33,7 +35,7 @@ pub extern "C" fn _start() -> ! {
interrupts::enable();
cpu::breakpoint();
int3();
println!("Still here!");

View File

@ -1,12 +1,9 @@
use core::panic::PanicInfo;
use crate::try_println;
use crate::arch::io::SERIAL;
use crate::arch::cpu;
use crate::println;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
unsafe { SERIAL.force_unlock(); } // since we're panicking, this is not relevant anymore.
try_println!("Kernel {}", info); // we probably should succeed, unless another CPU locked the serial port just after we unlocked it but before try_println attempts to lock it.
cpu::halt();
println!("Kernel {}", info);
loop {}
}