lesson 21, keyboard input and shell

This commit is contained in:
Carlos
2015-03-20 19:20:44 +01:00
parent 5aaabf189d
commit e9d0d6c388
25 changed files with 1217 additions and 3 deletions

16
21-shell/cpu/idt.c Normal file
View File

@@ -0,0 +1,16 @@
#include "idt.h"
void set_idt_gate(int n, u32 handler) {
idt[n].low_offset = low_16(handler);
idt[n].sel = KERNEL_CS;
idt[n].always0 = 0;
idt[n].flags = 0x8E;
idt[n].high_offset = high_16(handler);
}
void set_idt() {
idt_reg.base = (u32) &idt;
idt_reg.limit = IDT_ENTRIES * sizeof(idt_gate_t) - 1;
/* Don't make the mistake of loading &idt -- always load &idt_reg */
__asm__ __volatile__("lidtl (%0)" : : "r" (&idt_reg));
}