My Kernel v0.1.0
Collaboration diagram for Interrupts - x86 specific:

Data Structures

struct  idtr
 The location of the IDT is kept inside the IDTR (IDT register). More...
 
struct  idt_descriptor
 inside the IDT More...
 
struct  interrupt_frame
 Frame passed onto the interrupt handlers by our stub handler. More...
 
struct  interrupt_frame::registers_dump
 Dump of the process's registers. More...
 
struct  interrupt_frame::cpu_interrupt_frame
 Default x86 interrupt frame pushed by the cpu Intel developper manual, figure 6-4. More...
 

Enumerations

enum  x86_exceptions
 List of all x86 CPU exceptions Intel developper manual, Table 6-1.
 
enum  idt_gate_type
 The different types of interrupt gates Intel developper manual, section 6-11.
 

Functions

void idt_log (void)
 Print the content of the IDT and IDTR.
 

Variables

u16 idtr::size
 Size of the IDT.
 
u32 idtr::offset
 Linear address of the IDT

 
u16 idt_descriptor::offset_low
 16 lower bits of the handler function's address

 
segment_selector idt_descriptor::segment
 Selector for the segment inside which we want to run the handler.
 
u8 idt_descriptor::access
 Acess restriction flags for this interrupt

 
u16 idt_descriptor::offset_high
 16 higher bits of the handler function's address

 
u32 interrupt_frame::nr
 Interrupt number (pushed by our stub)
 
u32 interrupt_frame::error
 Error code for this exception (pushed by our stub)

 

Detailed Description

x86 specific interrupt interface implentation

Design

On x86 the interrupts are set-up using an Interrupt Descriptor Table.

This table can be located anywhere in memory and is pointed to by the address inside the IDTR register. It contains a pointer to each interrupt's specific handler, as well as information about how we want to run the interrupt (should never change).

Despite that, for conviniency, we define a common stub handler for each known CPU interrupts, which pushes additional information about the interrupt, and eventually calls the actual handler (if we defined one). The actual interrupts are software defined, located inside a static array and can be modified at will using interrupts_set_handler..

This lets us have more control on how we handle the interrupts.

See also
Intel developper manual, section 6
OsDev - IDT