comparison cos/kernel/handlers.c @ 26:dcce92b1efbc

Added mm.c
author windel
date Tue, 27 Dec 2011 17:36:52 +0100
parents d8627924d40d
children 7e3bdcb391dc
comparison
equal deleted inserted replaced
25:d3c4bf3720a3 26:dcce92b1efbc
55 idt[num].reserved2 = 0; 55 idt[num].reserved2 = 0;
56 } 56 }
57 57
58 void setupIDT(void) { 58 void setupIDT(void) {
59 int i; 59 int i;
60 //panic("Just before filling IDT"); 60
61 // After this line a crash occurs!
62 // Fill all vectors with the default handler: 61 // Fill all vectors with the default handler:
63 for (i=0; i<256; i++) { 62 for (i=0; i<256; i++) {
64 setIDTentry(i, INTDEF, 0x08, 0x8E); 63 setIDTentry(i, INTDEF, 0x08, 0x8E);
65 } 64 }
66 //panic("Just after setting defhandlers in IDT");
67 65
68 // Now set other then default handler: 66 // Now set other then default handler:
69 setIDTentry(0, INT0, 0x08, 0x8E); 67 setIDTentry(0, INT0, 0x08, 0x8E);
70 setIDTentry(1, INT1, 0x08, 0x8E); 68 setIDTentry(1, INT1, 0x08, 0x8E);
71 setIDTentry(2, INT2, 0x08, 0x8E); 69 setIDTentry(2, INT2, 0x08, 0x8E);
94 92
95 // Set the correct values in the IDT pointer: 93 // Set the correct values in the IDT pointer:
96 idtP.base = (uint64_t)idt; 94 idtP.base = (uint64_t)idt;
97 idtP.limit = (sizeof(IDT_entry) * 256) - 1; 95 idtP.limit = (sizeof(IDT_entry) * 256) - 1;
98 // call load IDT asm function: 96 // call load IDT asm function:
99 //panic("Just before LIDT");
100 loadIDT(); 97 loadIDT();
101 98
102 PICremap(); 99 PICremap();
103 //panic("Just before sti");
104 asm("sti"); 100 asm("sti");
105 } 101 }
106 102
107 // PIC functions: 103 // PIC functions:
108 void PICremap() { 104 void PICremap() {