comparison cos/kernel/handlers.c @ 18:6129643f5c34

Fixed interrupt issue, ds, es, ss, fs and gs were not initialized to 0
author windel
date Sun, 20 Nov 2011 20:35:51 +0100
parents f3e3e0e9c4bc
children b1fed2171e1a
comparison
equal deleted inserted replaced
17:f3e3e0e9c4bc 18:6129643f5c34
1 #include "kernel.h" 1 #include "kernel.h"
2 2
3 void panic(char *msg) { 3 void panic(char *msg) {
4 printf("Kernel panic: "); 4 printf("Kernel panic: ");
5 printf(msg); 5 printf(msg);
6 magicBochsBreak();
6 halt(); 7 halt();
7 } 8 }
8 9
9 // Assembler wrapper prototypes: 10 // Assembler wrapper prototypes:
10 void INTDEF(void); 11 void INTDEF(void);
87 setIDTentry(17, INT17, 0x08, 0x8E); 88 setIDTentry(17, INT17, 0x08, 0x8E);
88 setIDTentry(18, INT18, 0x08, 0x8E); 89 setIDTentry(18, INT18, 0x08, 0x8E);
89 setIDTentry(19, INT19, 0x08, 0x8E); 90 setIDTentry(19, INT19, 0x08, 0x8E);
90 /* reserved interrupts: */ 91 /* reserved interrupts: */
91 // From int20 - int31 92 // From int20 - int31
92 setIDTentry(32, INT32, 0x08, 0x8E); 93 setIDTentry(32, INT32, 0x08, 0x8F);
93 setIDTentry(33, INT33, 0x08, 0x8E); 94 setIDTentry(33, INT33, 0x08, 0x8F);
94 setIDTentry(34, INT34, 0x08, 0x8E); 95 setIDTentry(34, INT34, 0x08, 0x8F);
95 96
96 // Set the correct values in the IDT pointer: 97 // Set the correct values in the IDT pointer:
97 idtP.base = (uint64_t)&idt; 98 idtP.base = (uint64_t)&idt;
98 idtP.limit = (sizeof(IDT_entry) * 256) - 1; 99 idtP.limit = (sizeof(IDT_entry) * 256) - 1;
99 // call load IDT asm function: 100 // call load IDT asm function:
100 loadIDT(); 101 loadIDT();
101 102
102 PICremap(); 103 PICremap();
104 magicBochsBreak();
103 printf("enable ints\n"); 105 printf("enable ints\n");
104 asm("sti"); 106 asm("sti");
105 printf("Done!\n"); 107 printf("Done!\n");
106 } 108 }
107 109
276 { 278 {
277 // System timer. 279 // System timer.
278 //printf("INT32 called!\n"); 280 //printf("INT32 called!\n");
279 // called very frequent, what is this? 281 // called very frequent, what is this?
280 timerDriverUpdate(); 282 timerDriverUpdate();
283 // Acknowledge int:
281 outb(0x20, 0x20); // EOI to master 284 outb(0x20, 0x20); // EOI to master
282 } 285 }
283 286
284 void INT33handler() 287 void INT33handler()
285 { 288 {