mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-03 03:19:18 +00:00
Update kernel
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
|
||||
#include <types.h>
|
||||
#include <cpu.hpp>
|
||||
#include <pci.hpp>
|
||||
|
||||
namespace Interrupts
|
||||
{
|
||||
@ -30,49 +31,55 @@ namespace Interrupts
|
||||
#endif
|
||||
|
||||
#if defined(a64)
|
||||
/* APIC::APIC */ extern void *apic[256]; // MAX_CPU
|
||||
/* APIC::Timer */ extern void *apicTimer[256]; // MAX_CPU
|
||||
/* APIC::APIC */ extern void *apic[255]; // MAX_CPU
|
||||
/* APIC::Timer */ extern void *apicTimer[255]; // MAX_CPU
|
||||
#elif defined(a32)
|
||||
/* APIC::APIC */ extern void *apic[256]; // MAX_CPU
|
||||
/* APIC::Timer */ extern void *apicTimer[256]; // MAX_CPU
|
||||
/* APIC::APIC */ extern void *apic[255]; // MAX_CPU
|
||||
/* APIC::Timer */ extern void *apicTimer[255]; // MAX_CPU
|
||||
#elif defined(aa64)
|
||||
#endif
|
||||
extern void *InterruptFrames[INT_FRAMES_MAX];
|
||||
extern void *InterruptFrames[INT_FRAMES_MAX];
|
||||
|
||||
void Initialize(int Core);
|
||||
void Enable(int Core);
|
||||
void InitializeTimer(int Core);
|
||||
void RemoveAll();
|
||||
void Initialize(int Core);
|
||||
void Enable(int Core);
|
||||
void InitializeTimer(int Core);
|
||||
void RemoveAll();
|
||||
|
||||
class Handler
|
||||
{
|
||||
private:
|
||||
int InterruptNumber;
|
||||
void AddHandler(void (*Callback)(CPU::TrapFrame *),
|
||||
int InterruptNumber, void *ctx = nullptr,
|
||||
bool Critical = false);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Set a new interrupt number.
|
||||
* @param InterruptNumber The interrupt number. NOT the IRQ number! (IRQ0 != 32)
|
||||
*/
|
||||
void SetInterruptNumber(int InterruptNumber) { this->InterruptNumber = InterruptNumber; }
|
||||
int GetInterruptNumber() { return this->InterruptNumber; }
|
||||
void RemoveHandler(void (*Callback)(CPU::TrapFrame *),
|
||||
int InterruptNumber);
|
||||
|
||||
/**
|
||||
* @brief Create a new interrupt handler.
|
||||
* @param InterruptNumber The interrupt number. NOT the IRQ number! (IRQ0 != 32)
|
||||
*/
|
||||
Handler(int InterruptNumber);
|
||||
~Handler();
|
||||
void RemoveHandler(void (*Callback)(CPU::TrapFrame *));
|
||||
void RemoveHandler(int InterruptNumber);
|
||||
|
||||
public:
|
||||
#if defined(a64)
|
||||
virtual void OnInterruptReceived(CPU::x64::TrapFrame *Frame);
|
||||
#elif defined(a32)
|
||||
virtual void OnInterruptReceived(CPU::x32::TrapFrame *Frame);
|
||||
#elif defined(aa64)
|
||||
virtual void OnInterruptReceived(CPU::aarch64::TrapFrame *Frame);
|
||||
#endif
|
||||
};
|
||||
class Handler
|
||||
{
|
||||
private:
|
||||
int InterruptNumber;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Set a new interrupt number.
|
||||
* @param InterruptNumber The interrupt number. NOT the IRQ number! (IRQ0 != 32)
|
||||
*/
|
||||
void SetInterruptNumber(int InterruptNumber) { this->InterruptNumber = InterruptNumber; }
|
||||
int GetInterruptNumber() { return this->InterruptNumber; }
|
||||
|
||||
/**
|
||||
* @brief Create a new interrupt handler.
|
||||
* @param InterruptNumber The interrupt number. NOT the IRQ number! (IRQ0 != 32)
|
||||
*/
|
||||
Handler(int InterruptNumber, bool Critical = false);
|
||||
Handler(PCI::PCIDevice Device, bool Critical = false);
|
||||
Handler();
|
||||
~Handler();
|
||||
|
||||
public:
|
||||
virtual void OnInterruptReceived(CPU::TrapFrame *Frame);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // !__FENNIX_KERNEL_INTERRUPTS_H__
|
||||
|
Reference in New Issue
Block a user