KernOS
INTRP Namespace Reference

interrupt namespace More...

Classes

union  DescriptorEntry
 Exception and interrupt gate descriptor entry. More...
 
class  Mask
 Disables interrupt on construction, restores previous interrupt mask on scope exit. More...
 

Enumerations

enum  IVT : uint8_t {
  RESERVED_START = 0x0, DIV_0_FAULT = RESERVED_START, DEBUG_TRAP = 0x1, NMI_INTERRUPT = 0x2,
  BREAKPOINT_TRAP = 0x3, OVERFLOW_TRAP = 0x4, OUT_OF_BOUNDS_FAULT = 0x5, INVALID_OPCODE_FAULT = 0x6,
  NO_MATH_COP_FAULT = 0x7, DOUBLE_FAULT = 0x8, COP_SEG_OVERRUN_FAULT = 0x9, INVALID_TSS_FAULT = 0x0A,
  SEG_NOT_PRESENT_FAULT = 0x0B, STACK_SEG_FAULT = 0x0C, GEN_PROTECTION_FAULT = 0x0D, PAGE_FAULT = 0x0E,
  RESERVED = 0x0F, MATH_FAULT = 0x10, ALIGNMENT_CHECK_FAULT = 0x11, MACHINE_CHECK_ABORT = 0x12,
  SIMD_FP_XF_FAULT = 0x13, RESERVED_END = 0x1F, PIC1_OFFSET = 0x20, USER_DEFINED_START = PIC1_OFFSET,
  TIMER = 0x20, KEYBOARD = 0x21, PIC2_CASCADE = 0x22, SERIAL2 = 0x23,
  SERIAL1 = 0x24, PARALLEL2 = 0x25, DISKETTE = 0x26, PARALLEL1 = 0x27,
  PIC2_OFFSET = 0x28, CMOS = 0x28, CGA = 0x29, RESERVED1 = 0x2A,
  RESERVED2 = 0x2B, PS2 = 0x2C, FPU = 0x2D, HARDDISK = 0x2E,
  RESERVED3 = 0x2F, USER_DEFINED_END = 0xFF
}
 

Functions

void RegisterHandler (DescriptorEntry IdtTable[], size_t Idx, func_ptr Handler)
 Creates interrupt descriptor entries in idt_table, and loads into CPU. More...
 
void UnhandledException ()
 default unhandled exception handler More...
 
void TimerInterruptHandler ()
 Timer interrupt handler. More...
 
void PageFaultHandler ()
 Page fault handler. More...
 
void UnhandledInterrupt ()
 default unhandled interrupt handler More...
 
void SetExceptionHandler (DescriptorEntry IdtTable[])
 Installs default exception handler to all exceptions. More...
 
void SetInterruptHandler (DescriptorEntry IdtTable[])
 Installs default interrupt handler to all interrupts. More...
 
void Load_lidt (void *lidtAddress, uint16_t LimitUse)
 assembly instruction to load idt table to CPU More...
 
void Install_idt ()
 Assigns exception and interrupt handler to idt_table, and load to CPU. More...
 

Variables

const uint16_t IDT_ENTRIES = 256
 
DescriptorEntry idt_table [IDT_ENTRIES]
 

Detailed Description

interrupt namespace

Enumeration Type Documentation

◆ IVT

enum INTRP::IVT : uint8_t
Enumerator
RESERVED_START 

0x0

DIV_0_FAULT 

0x0

DEBUG_TRAP 

0x1

NMI_INTERRUPT 

0x2

BREAKPOINT_TRAP 

0x3

OVERFLOW_TRAP 

0x4

OUT_OF_BOUNDS_FAULT 

0x5

INVALID_OPCODE_FAULT 

0x6

NO_MATH_COP_FAULT 

0x7

DOUBLE_FAULT 

0x8

COP_SEG_OVERRUN_FAULT 

0x9

INVALID_TSS_FAULT 

0x0A

SEG_NOT_PRESENT_FAULT 

0x0B

STACK_SEG_FAULT 

0x0C

GEN_PROTECTION_FAULT 

0x0D

PAGE_FAULT 

0x0E

RESERVED 

0x0F

MATH_FAULT 

0x10

ALIGNMENT_CHECK_FAULT 

0x11

MACHINE_CHECK_ABORT 

0x12

SIMD_FP_XF_FAULT 

0x13

RESERVED_END 

0x1F

PIC1_OFFSET 

0x20

USER_DEFINED_START 
TIMER 
KEYBOARD 
PIC2_CASCADE 
SERIAL2 
SERIAL1 
PARALLEL2 
DISKETTE 
PARALLEL1 
PIC2_OFFSET 

0x28

CMOS 
CGA 
RESERVED1 
RESERVED2 
PS2 
FPU 
HARDDISK 
RESERVED3 
USER_DEFINED_END 

0xFF

Definition at line 18 of file interrupt.h.

Function Documentation

◆ Install_idt()

void INTRP::Install_idt ( )

Assigns exception and interrupt handler to idt_table, and load to CPU.

Definition at line 116 of file interrupt.cpp.

◆ Load_lidt()

void INTRP::Load_lidt ( void *  lidtAddress,
uint16_t  LimitUse 
)
inline

assembly instruction to load idt table to CPU

Parameters
lidtAddress
LimitUse

Definition at line 98 of file interrupt.cpp.

◆ PageFaultHandler()

void INTRP::PageFaultHandler ( )

Page fault handler.

Definition at line 58 of file interrupt.cpp.

◆ RegisterHandler()

void INTRP::RegisterHandler ( DescriptorEntry  IdtTable[],
size_t  Idx,
func_ptr  Handler 
)

Creates interrupt descriptor entries in idt_table, and loads into CPU.

Installing exception or interrupt handler by mapping handler address to idt_table

Parameters
[out]IdtTableto be loaded into CPU later
[in]Idxinto IdtTable for corresponding exception/interrupt number
[in]Handleraddress of exception/interrupt handler

Definition at line 29 of file interrupt.cpp.

◆ SetExceptionHandler()

void INTRP::SetExceptionHandler ( DescriptorEntry  IdtTable[])

Installs default exception handler to all exceptions.

Parameters
IdtTable

Definition at line 75 of file interrupt.cpp.

◆ SetInterruptHandler()

void INTRP::SetInterruptHandler ( DescriptorEntry  IdtTable[])

Installs default interrupt handler to all interrupts.

Parameters
IdtTable

Definition at line 86 of file interrupt.cpp.

◆ TimerInterruptHandler()

void INTRP::TimerInterruptHandler ( )

Timer interrupt handler.

Definition at line 48 of file interrupt.cpp.

◆ UnhandledException()

void INTRP::UnhandledException ( )

default unhandled exception handler

Definition at line 40 of file interrupt.cpp.

◆ UnhandledInterrupt()

void INTRP::UnhandledInterrupt ( )

default unhandled interrupt handler

Definition at line 66 of file interrupt.cpp.

Variable Documentation

◆ IDT_ENTRIES

const uint16_t INTRP::IDT_ENTRIES = 256

Definition at line 71 of file interrupt.h.

◆ idt_table

DescriptorEntry INTRP::idt_table

Definition at line 20 of file interrupt.cpp.