My Kernel v0.1.0
Collaboration diagram for Interrputs:

Modules

 Interrupts - x86 specific
 

Macros

#define INTERRUPT_HANDLER(_interrupt)   _interrupt##_handler
 Compute the interrupt's handler's name.
 
#define INTERRUPT_HANDLER_FUNCTION(_interrupt)    u32 INTERRUPT_HANDLER(_interrupt)(void *data)
 Define an interrupt handler function for a given interrupt You must always use this function when defining an interrupt handler.
 
#define interrupts_disabled_scope()
 Define a scope inside which irqs are disabled on the current CPU. More...
 

Typedefs

typedef struct interrupt_frame interrupt_frame
 Frame passed onto the interrupt handlers when triggering an interrupt. More...
 
typedef u32(* interrupt_handler) (void *)
 Function pointer to an interrupt handler.
 

Functions

void interrupts_set_handler (u8 irq, interrupt_handler, void *)
 Dynamically set an interrupt handler. More...
 
interrupt_handler interrupts_get_handler (u8 irq, void **)
 Retreive the current handler for a given IRQ. More...
 
static bool interrupts_has_been_installed (u8 irq)
 Return wether a custom interrupt has been installed for the given vector.
 
const char * interrupts_to_str (u8 nr)
 Returns the name of an interrupt from its vector number.
 
static void interrupts_disable (void)
 Disable interrupts on the current CPU.
 
static void interrupts_enable (void)
 Enable interrupts on the current CPU.
 
static void interrupts_restore (bool enabled)
 Restore the previous interrupt state. More...
 

Detailed Description

Interrupts

Here are defined the interfaces used to setup and control interrupts.

As interrupts are an architecure-dependent mechanism, the actual definitions for the strucutre are present inside the 'arch' folder. This file only serves as a common entry point for arch-generic code that would need to interact with interrupts.

Warning
You should never include the arch specific headers directly

Macro Definition Documentation

◆ interrupts_disabled_scope

#define interrupts_disabled_scope ( )
Value:
for (scope_irq_off_t guard CLEANUP(scope_irq_off_destructor) = \
scope_irq_off_constructor(); \
!guard.done; guard.done = true)

WARNING: As this macro uses a for loop to function, any 'break' directive placed inside it will break out of the guarded scope instead of that of its containing loop.

Typedef Documentation

◆ interrupt_frame

Note
This is a only a forward declaration. The actual definition is done inside the arch-specific header.

Function Documentation

◆ interrupts_get_handler()

interrupt_handler interrupts_get_handler ( u8  irq,
void **  pdata 
)
Parameters
irqThe interrupt number
[out]pdataIf not NULL, the handler's associated data is stored inside this pointer (optional)
Returns
The current handler function fo the IRQ

◆ interrupts_restore()

static void interrupts_restore ( bool  enabled)
inlinestatic
Parameters
enabledThe previous interrupt state (on/off).

◆ interrupts_set_handler()

void interrupts_set_handler ( u8  irq,
interrupt_handler  handler,
void *  data 
)
Parameters
irqThe IRQ number to associate the handler with
handlerThe handler function called when the interrupt occurs
dataData passed to the interrupt handler

@info If data is NULL, the kernel will pass a pointer to the interrupt frame (interrup_frame) when calling the handler instead