context gone

This commit is contained in:
Jack Halford 2018-04-12 15:32:11 +02:00
parent 0849f24628
commit b0548384e7
5 changed files with 23 additions and 52 deletions

View file

@ -2,27 +2,27 @@ use x86::structures::gdt;
use x86::structures::tss; use x86::structures::tss;
use x86::instructions::segmentation::set_cs; use x86::instructions::segmentation::set_cs;
use x86::instructions::tables::load_tss; use x86::instructions::tables::load_tss;
// use spin::Once; use spin::Once;
// static GDT: Once<gdt::Gdt> = Once::new(); static GDT: Once<gdt::Gdt> = Once::new();
// static TSS: Once<tss::TaskStateSegment> = Once::new(); static TSS: Once<tss::TaskStateSegment> = Once::new();
pub fn init() { pub fn init() {
// let tss = tss::TaskStateSegment::new(); let tss = tss::TaskStateSegment::new();
// let tss = TSS.call_once(|| { let tss = TSS.call_once(|| {
// let mut tss = tss::TaskStateSegment::new(); let mut tss = tss::TaskStateSegment::new();
// tss tss
// }); });
// let mut code_selector = gdt::SegmentSelector(0); let mut code_selector = gdt::SegmentSelector(0);
// let mut tss_selector = gdt::SegmentSelector(0); let mut tss_selector = gdt::SegmentSelector(0);
// let gdt = GDT.call_once(|| { let gdt = GDT.call_once(|| {
// let mut gdt = gdt::Gdt::new(); let mut gdt = gdt::Gdt::new();
// code_selector = gdt.add_entry(gdt::Descriptor::kernel_code_segment()); code_selector = gdt.add_entry(gdt::Descriptor::kernel_code_segment());
// tss_selector = gdt.add_entry(gdt::Descriptor::tss_segment(&tss)); tss_selector = gdt.add_entry(gdt::Descriptor::tss_segment(&tss));
// gdt gdt
// }); });
// gdt.load(); // gdt.load();
// unsafe { // unsafe {

View file

@ -69,9 +69,6 @@ pub extern "x86-interrupt" fn page_fault(
println!("Error code: {:?}", code); println!("Error code: {:?}", code);
println!("{:#?}", stack_frame); println!("{:#?}", stack_frame);
flush!(); flush!();
unsafe {
asm!("hlt");
}
} }
exception!(x87_fpu, {}); exception!(x87_fpu, {});

View file

@ -6,7 +6,7 @@ pub mod interrupt;
pub mod device; pub mod device;
pub mod pti; pub mod pti;
// pub mod gdt; pub mod gdt;
pub mod idt; pub mod idt;
use multiboot2; use multiboot2;
@ -39,15 +39,15 @@ pub unsafe extern "C" fn x86_rust_start(multiboot_info_addr: usize) {
// load idt (exceptions + irqs) // load idt (exceptions + irqs)
idt::init(); idt::init();
// fill and load gdt
gdt::init();
// set up heap // set up heap
::allocator::init(&mut active_table); ::allocator::init(&mut active_table);
// set up pic & apic // set up pic & apic
device::init(&mut active_table); device::init(&mut active_table);
// fill and load gdt
// gdt::init();
// primary CPU entry point // primary CPU entry point
::kmain(); ::kmain();
} }

View file

@ -1,26 +0,0 @@
use multiboot2;
use memory;
use vga;
pub static mut CONTEXT: Option<Context> = None;
pub struct Context {
pub current_term: u8,
pub vga1: vga::Writer,
pub vga2: vga::Writer,
}
impl Context
{
pub fn new(multiboot_start: usize) -> Context {
Context {
current_term: 0,
boot_info,
vga1,
vga2,
}
}
}

View file

@ -48,10 +48,10 @@ pub mod arch;
/// kernel entry point. arch module is responsible for /// kernel entry point. arch module is responsible for
/// calling this once the core has loaded /// calling this once the core has loaded
pub fn kmain() -> ! { pub fn kmain() -> ! {
// heap avalaible for tracking free'd frames // heap avalaible for tracking freed frames
memory::init_noncore(); memory::init_noncore();
x86::instructions::interrupts::int3(); // x86::instructions::interrupts::int3();
// fn stack_overflow() { stack_overflow(); } // fn stack_overflow() { stack_overflow(); }
// stack_overflow(); // stack_overflow();
@ -60,7 +60,7 @@ pub fn kmain() -> ! {
// *(0xdead as *mut u32) = 42; // *(0xdead as *mut u32) = 42;
// }; // };
// vga is *not* cpu specific, chipset specific? // vga is *not* cpu specific
vga::init(); vga::init();
loop {} loop {}