mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
CPU: Simplify handle_interrupt() function
This commit is contained in:
parent
800a46ace9
commit
86395810a9
Notes:
sideshowbarker
2024-07-19 08:58:43 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/86395810a95 Pull-request: https://github.com/SerenityOS/serenity/pull/1323 Reviewed-by: https://github.com/awesomekling
1 changed files with 7 additions and 9 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/Interrupts/InterruptManagement.h>
|
||||
#include <Kernel/Interrupts/SharedIRQHandler.h>
|
||||
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
|
||||
#include <Kernel/Interrupts/UnhandledInterruptHandler.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
@ -245,7 +246,8 @@ void page_fault_handler(RegisterState regs)
|
|||
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
u32 fault_page_directory = read_cr3();
|
||||
dbg() << (current ? Process::current->name().characters() : "(none)") << "(" << (current ? Process::current->pid() : 0) << "): ring" << (regs.cs & 3) << " " << (regs.exception_code & 1 ? "PV" : "NP") << " page fault in PD=" << String::format("%x", fault_page_directory) << ", " << (regs.exception_code & 8 ? "reserved-bit " : "") << regs.exception_code & 2 ? "write" : "read" <<" V" << String::format("%08x", fault_address);
|
||||
dbg() << (current ? Process::current->name().characters() : "(none)") << "(" << (current ? Process::current->pid() : 0) << "): ring" << (regs.cs & 3) << " " << (regs.exception_code & 1 ? "PV" : "NP") << " page fault in PD=" << String::format("%x", fault_page_directory) << ", " << (regs.exception_code & 8 ? "reserved-bit " : "") << regs.exception_code & 2 ? "write" : "read"
|
||||
<< " V" << String::format("%08x", fault_address);
|
||||
#endif
|
||||
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
|
@ -661,14 +663,10 @@ void handle_interrupt(RegisterState regs)
|
|||
++g_in_irq;
|
||||
ASSERT(regs.isr_number >= 0x50 && regs.isr_number <= 0x5f);
|
||||
u8 irq = (u8)(regs.isr_number - 0x50);
|
||||
if (s_interrupt_handler[irq]) {
|
||||
s_interrupt_handler[irq]->handle_interrupt(regs);
|
||||
s_interrupt_handler[irq]->increment_invoking_counter();
|
||||
s_interrupt_handler[irq]->eoi();
|
||||
} else {
|
||||
dbg() << "No IRQ " << irq << " Handler installed!";
|
||||
hang();
|
||||
}
|
||||
ASSERT(s_interrupt_handler[irq]);
|
||||
s_interrupt_handler[irq]->handle_interrupt(regs);
|
||||
s_interrupt_handler[irq]->increment_invoking_counter();
|
||||
s_interrupt_handler[irq]->eoi();
|
||||
--g_in_irq;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue