PatchworkOS  da8a090
A non-POSIX operating system.
Loading...
Searching...
No Matches
interrupt.h File Reference
#include <kernel/cpu/idt.h>
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for interrupt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  interrupt_frame_t
 Trap Frame Structure. More...
 
struct  interrupt_ctx_t
 Per-CPU Interrupt Context. More...
 

Macros

#define INTERRUPT_FRAME_IN_USER_SPACE(frame)   ((frame)->ss == (GDT_SS_RING3) && (frame)->cs == (GDT_CS_RING3))
 Checks if a interrupt frame is from user space.
 

Enumerations

enum  page_fault_errors_t {
  PAGE_FAULT_PRESENT = 1 << 0 , PAGE_FAULT_WRITE = 1 << 1 , PAGE_FAULT_USER = 1 << 2 , PAGE_FAULT_RESERVED = 1 << 3 ,
  PAGE_FAULT_INSTRUCTION = 1 << 4 , PAGE_FAULT_PROTECTION_KEY = 1 << 5 , PAGE_FAULT_SHADOW_STACK = 1 << 6 , PAGE_FAULT_SOFTWARE_GUARD_EXT = 1 << 7
}
 Page Fault Error Codes. More...
 
enum  interrupt_vector_t {
  VECTOR_EXCEPTION_START = 0x0 , VECTOR_DIVIDE_ERROR = 0x0 , VECTOR_DEBUG = 0x1 , VECTOR_NMI = 0x2 ,
  VECTOR_BREAKPOINT = 0x3 , VECTOR_OVERFLOW = 0x4 , VECTOR_BOUND_RANGE_EXCEEDED = 0x5 , VECTOR_INVALID_OPCODE = 0x6 ,
  VECTOR_DEVICE_NOT_AVAILABLE = 0x7 , VECTOR_DOUBLE_FAULT = 0x8 , VECTOR_COPROCESSOR_SEGMENT_OVERRUN = 0x9 , VECTOR_INVALID_TSS = 0xA ,
  VECTOR_SEGMENT_NOT_PRESENT = 0xB , VECTOR_STACK_SEGMENT_FAULT = 0xC , VECTOR_GENERAL_PROTECTION_FAULT = 0xD , VECTOR_PAGE_FAULT = 0xE ,
  VECTOR_RESERVED = 0xF , VECTOR_X87_FLOATING_POINT_EXCEPTION = 0x10 , VECTOR_ALIGNMENT_CHECK = 0x11 , VECTOR_MACHINE_CHECK = 0x12 ,
  VECTOR_SIMD_FLOATING_POINT_EXCEPTION = 0x13 , VECTOR_VIRTUALIZATION_EXCEPTION = 0x14 , VECTOR_CONTROL_PROTECTION_EXCEPTION = 0x15 , VECTOR_HYPERVISOR_INJECTION_EXCEPTION = 0x1C ,
  VECTOR_VMM_COMMUNICATION_EXCEPTION = 0x1D , VECTOR_SECURITY_EXCEPTION = 0x1E , VECTOR_EXCEPTION_END = 0x20 , VECTOR_EXTERNAL_START = 0x20 ,
  VECTOR_EXTERNAL_END = 0xF0 , VECTOR_EXTERNAL_AMOUNT = VECTOR_EXTERNAL_END - VECTOR_EXTERNAL_START , VECTOR_INTERNAL_START = 0xF0 , VECTOR_IPI = 0xFD ,
  VECTOR_TIMER = 0xFE , VECTOR_SPURIOUS = 0xFF , VECTOR_INTERNAL_END = 0x100 , VECTOR_TOTAL_AMOUNT = 0x100
}
 Interrupt Vectors. More...
 

Functions

void interrupt_ctx_init (interrupt_ctx_t *ctx)
 Initializes the interrupt context.
 
void interrupt_disable (void)
 Disable interrupts and increment the disableDepth.
 
void interrupt_enable (void)
 Decrement the CLI depth and enable interrupts if depth reaches zero and interrupts were previously enabled.
 
void interrupt_handler (interrupt_frame_t *frame)
 Handles CPU interrupts.
 

Variables

void * vectorTable [IDT_GATE_AMOUNT]
 Pointers to functions to handle each vector.