Revise post and add new introduction

This commit is contained in:
Philipp Oppermann
2019-01-10 16:05:38 +01:00
parent c285ac7c4f
commit 6d5ebf56a4
3 changed files with 148 additions and 78 deletions

View File

@@ -10,6 +10,7 @@ use pic8259_simple::ChainedPics;
use spin;
use x86_64::structures::idt::{ExceptionStackFrame, InterruptDescriptorTable, PageFaultErrorCode};
pub const PIC_1_OFFSET: u8 = 32;
pub const PIC_2_OFFSET: u8 = PIC_1_OFFSET + 8;
@@ -58,6 +59,19 @@ extern "x86-interrupt" fn page_fault_handler(
hlt_loop();
}
extern "x86-interrupt" fn page_fault_handler(
stack_frame: &mut ExceptionStackFrame,
_error_code: PageFaultErrorCode,
) {
use crate::hlt_loop;
use x86_64::registers::control::Cr2;
println!("EXCEPTION: PAGE FAULT");
println!("Accessed Address: {:?}", Cr2::read());
println!("{:#?}", stack_frame);
hlt_loop();
}
extern "x86-interrupt" fn double_fault_handler(
stack_frame: &mut ExceptionStackFrame,
_error_code: u64,

View File

@@ -5,12 +5,14 @@
use core::panic::PanicInfo;
use blog_os::println;
use bootloader::bootinfo::BootInfo;
/// This function is the entry point, since the linker looks for a function
/// named `_start` by default.
#[cfg(not(test))]
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn _start() -> ! {
pub extern "C" fn _start(boot_info: &BootInfo) -> ! {
use blog_os::interrupts::PICS;
use x86_64::structures::paging::PageTable;