From 7d6c2a0dd1c61a13c9536a2b69efc9346cc4e293 Mon Sep 17 00:00:00 2001 From: Morten Delenk Date: Mon, 24 Jul 2017 12:36:45 +0100 Subject: [PATCH] fixed a bug where uninitialized memory was used --- kernel/arch/x86_64/interrupt.cpp | 5 ++++- kernel/src/pmm.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/arch/x86_64/interrupt.cpp b/kernel/arch/x86_64/interrupt.cpp index d912a9d..db4eda0 100644 --- a/kernel/arch/x86_64/interrupt.cpp +++ b/kernel/arch/x86_64/interrupt.cpp @@ -26,14 +26,17 @@ extern "C" cpu_state *handleINT(cpu_state *state) { *out << "Interrupt "; out->puti(state->intr); *out << " occurred!\n"; + cpu_state *new_cpu=state; if (state->intr < 32) { out->setColor(Color::RED); print_regdump(state); *out << "KERNEL PANIC: Unhandled CPU exception\n"; for (;;) ; + } else if(state->intr < 48) { + new_cpu=(cpu_state*)irqs->handleIRQ(new_cpu); } - return state; + return new_cpu; } extern "C" void panic2(cpu_state *state) { state->rsp = (uintptr_t)state; diff --git a/kernel/src/pmm.cpp b/kernel/src/pmm.cpp index 5885e73..474428c 100644 --- a/kernel/src/pmm.cpp +++ b/kernel/src/pmm.cpp @@ -11,7 +11,7 @@ auto PMM::isFree(phys_t addr) -> bool { return false; return true; } -PMM::PMM(phys_t page_size): page_size(page_size), head(nullptr) {} +PMM::PMM(phys_t page_size): page_size(page_size), head(nullptr), lowest_page(~0), highest_page(0) {} void PMM::fill() { for(phys_t i=lowest_page; i