Added code to support getting interrupts from the PIC. Can now get some data from the keyboard, however, it's not quite working yet.

This commit is contained in:
2020-08-06 22:36:39 -05:00
parent db1a68188f
commit 49efafe173
15 changed files with 278 additions and 39 deletions
+34 -33
View File
@@ -18,44 +18,45 @@ void idt_install()
// For the kernel ring 8E is chosen
// 100 for bits 7-5. 1 (present) 00 (the level in this case ring zero)
// 01110 for bits 4-0. This is always set to 14.
idt_set_gate(&idt_entries[0], (unsigned int) isr0, 0x08, 0x8E);
idt_set_gate(&idt_entries[1], (unsigned int) isr1, 0x08, 0x8E);
idt_set_gate(&idt_entries[2], (unsigned int) isr2, 0x08, 0x8E);
idt_set_gate(&idt_entries[3], (unsigned int) isr3, 0x08, 0x8E);
idt_set_gate(&idt_entries[4], (unsigned int) isr4, 0x08, 0x8E);
idt_set_gate(&idt_entries[5], (unsigned int) isr5, 0x08, 0x8E);
idt_set_gate(&idt_entries[6], (unsigned int) isr6, 0x08, 0x8E);
idt_set_gate(&idt_entries[7], (unsigned int) isr7, 0x08, 0x8E);
idt_set_gate(&idt_entries[8], (unsigned int) isr8, 0x08, 0x8E);
idt_set_gate(&idt_entries[9], (unsigned int) isr9, 0x08, 0x8E);
idt_set_gate(&idt_entries[10], (unsigned int) isr10, 0x08, 0x8E);
idt_set_gate(&idt_entries[11], (unsigned int) isr11, 0x08, 0x8E);
idt_set_gate(&idt_entries[12], (unsigned int) isr12, 0x08, 0x8E);
idt_set_gate(&idt_entries[13], (unsigned int) isr13, 0x08, 0x8E);
idt_set_gate(&idt_entries[14], (unsigned int) isr14, 0x08, 0x8E);
idt_set_gate(&idt_entries[15], (unsigned int) isr15, 0x08, 0x8E);
idt_set_gate(&idt_entries[16], (unsigned int) isr16, 0x08, 0x8E);
idt_set_gate(&idt_entries[17], (unsigned int) isr17, 0x08, 0x8E);
idt_set_gate(&idt_entries[18], (unsigned int) isr18, 0x08, 0x8E);
idt_set_gate(&idt_entries[19], (unsigned int) isr19, 0x08, 0x8E);
idt_set_gate(&idt_entries[20], (unsigned int) isr20, 0x08, 0x8E);
idt_set_gate(&idt_entries[21], (unsigned int) isr21, 0x08, 0x8E);
idt_set_gate(&idt_entries[22], (unsigned int) isr22, 0x08, 0x8E);
idt_set_gate(&idt_entries[23], (unsigned int) isr23, 0x08, 0x8E);
idt_set_gate(&idt_entries[24], (unsigned int) isr24, 0x08, 0x8E);
idt_set_gate(&idt_entries[25], (unsigned int) isr25, 0x08, 0x8E);
idt_set_gate(&idt_entries[26], (unsigned int) isr26, 0x08, 0x8E);
idt_set_gate(&idt_entries[27], (unsigned int) isr27, 0x08, 0x8E);
idt_set_gate(&idt_entries[28], (unsigned int) isr28, 0x08, 0x8E);
idt_set_gate(&idt_entries[29], (unsigned int) isr29, 0x08, 0x8E);
idt_set_gate(&idt_entries[30], (unsigned int) isr30, 0x08, 0x8E);
idt_set_gate(&idt_entries[31], (unsigned int) isr31, 0x08, 0x8E);
idt_set_gate(0, (unsigned int) isr0, 0x08, 0x8E);
idt_set_gate(1, (unsigned int) isr1, 0x08, 0x8E);
idt_set_gate(2, (unsigned int) isr2, 0x08, 0x8E);
idt_set_gate(3, (unsigned int) isr3, 0x08, 0x8E);
idt_set_gate(4, (unsigned int) isr4, 0x08, 0x8E);
idt_set_gate(5, (unsigned int) isr5, 0x08, 0x8E);
idt_set_gate(6, (unsigned int) isr6, 0x08, 0x8E);
idt_set_gate(7, (unsigned int) isr7, 0x08, 0x8E);
idt_set_gate(8, (unsigned int) isr8, 0x08, 0x8E);
idt_set_gate(9, (unsigned int) isr9, 0x08, 0x8E);
idt_set_gate(10, (unsigned int) isr10, 0x08, 0x8E);
idt_set_gate(11, (unsigned int) isr11, 0x08, 0x8E);
idt_set_gate(12, (unsigned int) isr12, 0x08, 0x8E);
idt_set_gate(13, (unsigned int) isr13, 0x08, 0x8E);
idt_set_gate(14, (unsigned int) isr14, 0x08, 0x8E);
idt_set_gate(15, (unsigned int) isr15, 0x08, 0x8E);
idt_set_gate(16, (unsigned int) isr16, 0x08, 0x8E);
idt_set_gate(17, (unsigned int) isr17, 0x08, 0x8E);
idt_set_gate(18, (unsigned int) isr18, 0x08, 0x8E);
idt_set_gate(19, (unsigned int) isr19, 0x08, 0x8E);
idt_set_gate(20, (unsigned int) isr20, 0x08, 0x8E);
idt_set_gate(21, (unsigned int) isr21, 0x08, 0x8E);
idt_set_gate(22, (unsigned int) isr22, 0x08, 0x8E);
idt_set_gate(23, (unsigned int) isr23, 0x08, 0x8E);
idt_set_gate(24, (unsigned int) isr24, 0x08, 0x8E);
idt_set_gate(25, (unsigned int) isr25, 0x08, 0x8E);
idt_set_gate(26, (unsigned int) isr26, 0x08, 0x8E);
idt_set_gate(27, (unsigned int) isr27, 0x08, 0x8E);
idt_set_gate(28, (unsigned int) isr28, 0x08, 0x8E);
idt_set_gate(29, (unsigned int) isr29, 0x08, 0x8E);
idt_set_gate(30, (unsigned int) isr30, 0x08, 0x8E);
idt_set_gate(31, (unsigned int) isr31, 0x08, 0x8E);
load_idt(&idt);
}
void idt_set_gate(struct idt_entry* entry, unsigned long base, unsigned short sel, unsigned char flags)
void idt_set_gate(unsigned char index, unsigned long base, unsigned short sel, unsigned char flags)
{
struct idt_entry* entry = &idt.idt_entries_start[index];
entry->base_lo = (base & 0xFFFF);
entry->base_hi = (base >> 16) & 0xFFFF;