Commit 260ddc369eb582437459201671ea4ff88178583d
- Diff rendering mode:
- inline
- side by side
kernel/arch/x86/idt.cc
(3 / 3)
|   | |||
| 3 | 3 | ||
| 4 | 4 | extern "C" | |
| 5 | 5 | { | |
| 6 | void idt_flush(u32int pointer); | ||
| 6 | void idt_flush(uintptr pointer); | ||
| 7 | 7 | void isr_handler(registers_t r); | |
| 8 | 8 | void irq_handler(registers_t r); | |
| 9 | 9 | } | |
| … | … | ||
| 47 | 47 | ||
| 48 | 48 | // Set the address of the IDT entries in the IDT pointer structure | |
| 49 | 49 | idt_ptr.limit = sizeof(idt_entry_t) * 256 -1; | |
| 50 | idt_ptr.base = (u32int)&idt_entries; | ||
| 50 | idt_ptr.base = (uintptr)&idt_entries; | ||
| 51 | 51 | ||
| 52 | 52 | // Clear all descriptors | |
| 53 | 53 | memset(&idt_entries, 0, sizeof(idt_entry_t) * 256); | |
| … | … | ||
| 88 | 88 | set_gate(30, (u32int)isr30, 0x08, 0x8E); | |
| 89 | 89 | set_gate(31, (u32int)isr31, 0x08, 0x8E); | |
| 90 | 90 | ||
| 91 | idt_flush((u32int)&idt_ptr); | ||
| 91 | idt_flush((uintptr)&idt_ptr); | ||
| 92 | 92 | ||
| 93 | 93 | // IRQs | |
| 94 | 94 | set_gate(32, (u32int)irq0 , 0x08, 0x8E); |
kernel/arch/x86/idt.h
(4 / 4)
|   | |||
| 18 | 18 | ||
| 19 | 19 | struct idt_entry_struct | |
| 20 | 20 | { | |
| 21 | u16int base_lo; // The lower 16 bits of the address to jump to when this interrupt fires. | ||
| 21 | u16int base_lo; // The lower 16 bits of the address to jump to when this interrupt fires. | ||
| 22 | 22 | u16int sel; // Kernel segment selector. | |
| 23 | u8int always0; // This must always be zero. | ||
| 23 | u8int always0; // This must always be zero. | ||
| 24 | 24 | u8int flags; // More flags. See documentation. | |
| 25 | u16int base_hi; // The upper 16 bits of the address to jump to. | ||
| 25 | u16int base_hi; // The upper 16 bits of the address to jump to. | ||
| 26 | 26 | } __attribute__((packed)); | |
| 27 | 27 | ||
| 28 | 28 | typedef struct idt_entry_struct idt_entry_t; | |
| … | … | ||
| 31 | 31 | struct idt_ptr_struct | |
| 32 | 32 | { | |
| 33 | 33 | u16int limit; | |
| 34 | u32int base; // The address of the first element in our idt_entry_t array. | ||
| 34 | u32int base; // The address of the first element in our idt_entry_t array. | ||
| 35 | 35 | } __attribute__((packed)); | |
| 36 | 36 | ||
| 37 | 37 | typedef struct idt_ptr_struct idt_ptr_t; |

