MentOS  0.8.0
The Mentoring Operating System
idt.h
Go to the documentation of this file.
1 
22 #pragma once
23 
24 #include "stdint.h"
25 
27 #define IDT_SIZE 256
29 #define TASK_GATE 0x5
31 #define INT16_GATE 0x6
33 #define TRAP16_GATE 0x7
35 #define INT32_GATE 0xE
37 #define TRAP32_GATE 0xF
38 
39 /*
40  * Trap and Interrupt gates are similar, and their descriptors are
41  * structurally the same, they differ only in the "type" field. The
42  * difference is that for interrupt gates, interrupts are automatically
43  * disabled upon entry and reenabled upon IRET which restores the saved EFLAGS.
44  */
45 
47 typedef struct idt_descriptor_t {
58 } __attribute__((packed)) idt_descriptor_t;
59 
61 typedef struct idt_pointer_t {
66 } __attribute__((packed)) idt_pointer_t;
67 
69 void init_idt(void);
70 
void init_idt(void)
Initialise the interrupt descriptor table.
Definition: idt.c:142
Standard integer data-types.
unsigned short uint16_t
Define the unsigned 16-bit integer.
Definition: stdint.h:24
unsigned int uint32_t
Define the unsigned 32-bit integer.
Definition: stdint.h:18
unsigned char uint8_t
Define the unsigned 8-bit integer.
Definition: stdint.h:30
This structure describes one interrupt gate.
Definition: idt.h:47
uint8_t options
Descriptor options: |P|DPL|01110| (P: present, DPL: required Ring).
Definition: idt.h:55
uint8_t reserved
This will ALWAYS be set to 0.
Definition: idt.h:53
uint16_t seg_selector
The GDT segment selector that the CPU will load into CS before calling the ISR.
Definition: idt.h:51
uint16_t offset_high
The higher 16 bits of the ISR's address.
Definition: idt.h:57
uint16_t offset_low
The lower 16 bits of the ISR's address.
Definition: idt.h:49
A pointer structure used for informing the CPU about our IDT.
Definition: idt.h:61
uint32_t base
The start address of the IDT.
Definition: idt.h:65
uint16_t limit
The size of the IDT (entry number).
Definition: idt.h:63