From 11b492d6ce98dc8c7b583050188c553a227ca65e Mon Sep 17 00:00:00 2001 From: Erin Date: Thu, 8 Dec 2022 20:35:42 +0100 Subject: [PATCH] fixed segments, timer doesn't double-fault anymore --- kernel/src/arch/x86_64/gdt.rs | 4 +++- kernel/src/arch/x86_64/interrupts.rs | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/src/arch/x86_64/gdt.rs b/kernel/src/arch/x86_64/gdt.rs index 63ef734..f5b6d1f 100644 --- a/kernel/src/arch/x86_64/gdt.rs +++ b/kernel/src/arch/x86_64/gdt.rs @@ -10,7 +10,7 @@ use x86_64::{ pub const DOUBLE_FAULT_IX: u16 = 0; pub unsafe fn init() { - use x86_64::instructions::segmentation::{Segment, CS, DS}; + use x86_64::instructions::segmentation::{Segment, CS, DS, ES, SS}; use x86_64::instructions::tables::load_tss; log::info!("Initialising GDT"); @@ -18,6 +18,8 @@ pub unsafe fn init() { unsafe { CS::set_reg(GDT.1.kcode); DS::set_reg(GDT.1.kdata); + ES::set_reg(GDT.1.kdata); + SS::set_reg(GDT.1.kdata); load_tss(GDT.1.tss); } } diff --git a/kernel/src/arch/x86_64/interrupts.rs b/kernel/src/arch/x86_64/interrupts.rs index ee7c2d2..b3accc8 100644 --- a/kernel/src/arch/x86_64/interrupts.rs +++ b/kernel/src/arch/x86_64/interrupts.rs @@ -55,7 +55,6 @@ extern "x86-interrupt" fn page_fault( } extern "x86-interrupt" fn timer(_: InterruptStackFrame) { - panic!("make timer not double fault"); unsafe { LAPIC.lock().end_of_interrupt() }; }