1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

CPU: Use the new interrupt components

Now we use the GenericInterruptHandler class instead of IRQHandler in
the CPU functions.
This commit adds an include to the ISR stub macros header file.
Also, this commit adds support for IRQ sharing, so when an IRQHandler
will try to register to already-assigned IRQ number, a SharedIRQHandler
will be created to register both IRQHandlers.
This commit is contained in:
Liav A 2020-02-22 20:38:17 +02:00 committed by Andreas Kling
parent 9e66eb160c
commit bb73802b15
2 changed files with 212 additions and 87 deletions

View file

@ -32,6 +32,7 @@
#include <LibBareMetal/Memory/VirtualAddress.h>
#define PAGE_SIZE 4096
#define GENERIC_INTERRUPT_HANDLERS_COUNT 128
#define PAGE_MASK ((uintptr_t)0xfffff000u)
namespace Kernel {
@ -244,7 +245,7 @@ public:
u64 raw[4];
};
class IRQHandler;
class GenericInterruptHandler;
struct RegisterState;
void gdt_init();
@ -252,8 +253,11 @@ void idt_init();
void sse_init();
void register_interrupt_handler(u8 number, void (*f)());
void register_user_callable_interrupt_handler(u8 number, void (*f)());
void register_irq_handler(u8 number, IRQHandler&);
void unregister_irq_handler(u8 number, IRQHandler&);
GenericInterruptHandler& get_interrupt_handler(u8 interrupt_number);
void register_generic_interrupt_handler(u8 number, GenericInterruptHandler&);
void replace_single_handler_with_shared(GenericInterruptHandler&);
void replace_shared_handler_with_single(GenericInterruptHandler&);
void unregister_generic_interrupt_handler(u8 number, GenericInterruptHandler&);
void flush_idt();
void flush_gdt();
void load_task_register(u16 selector);