This commit is contained in:
Jack Halford 2018-03-19 15:24:26 +01:00
parent 5c7daabdd0
commit 098d222fc1
5 changed files with 43 additions and 7 deletions

View file

@ -11,3 +11,7 @@ rlibc = "1.0"
bitflags = "1.0.1"
multiboot2 = { path = "multiboot2-elf64" }
x86 = { path = "x86" }
[dependencies.lazy_static]
version = "1.0.0"
features = ["spin_no_std"]

View file

@ -0,0 +1,21 @@
use x86::structures::idt::*;
lazy_static! {
static ref IDT: Idt = {
let mut idt = Idt::new();
idt.breakpoint.set_handler_fn(breakpoint_handler);
idt
};
}
pub fn init() {
IDT.load();
}
extern "x86-interrupt" fn breakpoint_handler(
stack_frame: &mut ExceptionStackFrame)
{
println!("EXCEPTION: BREAKPOINT\n");
flush!();
loop{}
}

View file

@ -5,13 +5,16 @@
#![feature(const_fn)]
#![feature(ptr_internals)]
#![feature(asm)]
#![feature(alloc)]
#![feature(allocator_api)]
#![feature(global_allocator)]
#![feature(abi_x86_interrupt)]
extern crate rlibc;
extern crate multiboot2;
// #[macro_use] extern crate bitflags;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate alloc;
extern crate x86;
@ -27,22 +30,28 @@ pub mod cpuio;
pub mod acpi;
/// physical frame allocator + paging module + heap allocator
pub mod memory;
// x86 interruptions
// pub mod interrupts;
/// x86 interruptions
pub mod interrupts;
fn init_kernel(multiboot_info_addr: usize) -> Result <(), &'static str> {
let boot_info = unsafe { multiboot2::load(multiboot_info_addr)};
if let Some(rsdp) = boot_info.rsdp_v2_tag() {
acpi::load(rsdp)?;
} else if let Some(rsdp) = boot_info.rsdp_tag() {
acpi::load(rsdp)?;
}
else {
} else {
acpi::init()?;
}
enable_paging();
enable_write_protect_bit();
memory::init(&boot_info);
interrupts::init();
vga::init();
Ok(())
}
@ -53,6 +62,8 @@ pub extern fn kmain(multiboot_info_addr: usize) -> ! {
cpuio::halt();
}
x86::instructions::interrupts::int3();
loop { keyboard::kbd_callback(); }
}

View file

@ -1,6 +1,6 @@
use memory::*;
use x86::structures::paging::*;
use x86::ux::*;
// use x86::ux::*;
pub trait RecTable
{

@ -1 +1 @@
Subproject commit 7b8227e36afe68ed2d518a2c7cede0466878ca9d
Subproject commit da544c834b3f3d8b53f456c48b3aafa58d09198a