Compare commits
No commits in common. "739fa56ece9aeb0cef17af75d00a9e7b59cc83e8" and "d2fb4a68cad4913d8dffd3ed805bc8601aaaa81a" have entirely different histories.
739fa56ece
...
d2fb4a68ca
@ -24,8 +24,4 @@ pub fn halt() -> ! {
|
|||||||
|
|
||||||
pub fn wait_for_interrupt() -> () {
|
pub fn wait_for_interrupt() -> () {
|
||||||
unsafe { asm!("hlt"); }
|
unsafe { asm!("hlt"); }
|
||||||
}
|
|
||||||
|
|
||||||
pub fn breakpoint() -> () {
|
|
||||||
unsafe { asm!("int3"); }
|
|
||||||
}
|
}
|
@ -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);
|
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()
|
pub fn load()
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
IDT.breakpoint.set_handler_fn(breakpoint_handler);
|
IDT.breakpoint.set_handler_fn(breakpoint_handler);
|
||||||
IDT.page_fault.set_handler_fn(page_fault_handler);
|
IDT.page_fault.set_handler_fn(page_fault_handler);
|
||||||
IDT.double_fault.set_handler_fn(double_fault_handler);
|
|
||||||
IDT.load();
|
IDT.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ mod log;
|
|||||||
use arch::cpu;
|
use arch::cpu;
|
||||||
use arch::interrupts;
|
use arch::interrupts;
|
||||||
|
|
||||||
|
use x86_64::instructions::interrupts::int3;
|
||||||
|
|
||||||
use video::Color;
|
use video::Color;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -33,7 +35,7 @@ pub extern "C" fn _start() -> ! {
|
|||||||
|
|
||||||
interrupts::enable();
|
interrupts::enable();
|
||||||
|
|
||||||
cpu::breakpoint();
|
int3();
|
||||||
|
|
||||||
println!("Still here!");
|
println!("Still here!");
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
use crate::try_println;
|
use crate::println;
|
||||||
use crate::arch::io::SERIAL;
|
|
||||||
use crate::arch::cpu;
|
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
unsafe { SERIAL.force_unlock(); } // since we're panicking, this is not relevant anymore.
|
println!("Kernel {}", info);
|
||||||
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.
|
loop {}
|
||||||
cpu::halt();
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user