mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Kernel/Interrupts: Enumerate nested handlers in a shared handler
When asked to enumerate all interrupt handlers, display all shared handlers within it instead of just returning the responsible handler of them.
This commit is contained in:
parent
dcb55db99b
commit
030999d269
3 changed files with 15 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <Kernel/Interrupts/IOAPIC.h>
|
#include <Kernel/Interrupts/IOAPIC.h>
|
||||||
#include <Kernel/Interrupts/InterruptManagement.h>
|
#include <Kernel/Interrupts/InterruptManagement.h>
|
||||||
#include <Kernel/Interrupts/PIC.h>
|
#include <Kernel/Interrupts/PIC.h>
|
||||||
|
#include <Kernel/Interrupts/SharedIRQHandler.h>
|
||||||
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
|
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
|
||||||
#include <Kernel/Interrupts/UnhandledInterruptHandler.h>
|
#include <Kernel/Interrupts/UnhandledInterruptHandler.h>
|
||||||
#include <Kernel/VM/TypedMapping.h>
|
#include <Kernel/VM/TypedMapping.h>
|
||||||
|
@ -49,6 +50,10 @@ void InterruptManagement::enumerate_interrupt_handlers(Function<void(GenericInte
|
||||||
{
|
{
|
||||||
for (int i = 0; i < GENERIC_INTERRUPT_HANDLERS_COUNT; i++) {
|
for (int i = 0; i < GENERIC_INTERRUPT_HANDLERS_COUNT; i++) {
|
||||||
auto& handler = get_interrupt_handler(i);
|
auto& handler = get_interrupt_handler(i);
|
||||||
|
if (handler.type() == HandlerType::SharedIRQHandler) {
|
||||||
|
static_cast<SharedIRQHandler&>(handler).enumerate_handlers(callback);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (handler.type() != HandlerType::UnhandledInterruptHandler)
|
if (handler.type() != HandlerType::UnhandledInterruptHandler)
|
||||||
callback(handler);
|
callback(handler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,14 @@ bool SharedIRQHandler::eoi()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SharedIRQHandler::enumerate_handlers(Function<void(GenericInterruptHandler&)>& callback)
|
||||||
|
{
|
||||||
|
for (auto* handler : m_handlers) {
|
||||||
|
VERIFY(handler);
|
||||||
|
callback(*handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SharedIRQHandler::SharedIRQHandler(u8 irq)
|
SharedIRQHandler::SharedIRQHandler(u8 irq)
|
||||||
: GenericInterruptHandler(irq)
|
: GenericInterruptHandler(irq)
|
||||||
, m_responsible_irq_controller(InterruptManagement::the().get_responsible_irq_controller(irq))
|
, m_responsible_irq_controller(InterruptManagement::the().get_responsible_irq_controller(irq))
|
||||||
|
|
|
@ -26,6 +26,8 @@ public:
|
||||||
|
|
||||||
virtual bool eoi() override;
|
virtual bool eoi() override;
|
||||||
|
|
||||||
|
void enumerate_handlers(Function<void(GenericInterruptHandler&)>&);
|
||||||
|
|
||||||
virtual size_t sharing_devices_count() const override { return m_handlers.size(); }
|
virtual size_t sharing_devices_count() const override { return m_handlers.size(); }
|
||||||
virtual bool is_shared_handler() const override { return true; }
|
virtual bool is_shared_handler() const override { return true; }
|
||||||
virtual bool is_sharing_with_others() const override { return false; }
|
virtual bool is_sharing_with_others() const override { return false; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue