comparison cos/kernel/handlers.c @ 32:3a6a9b929db0

Added initial ramdisk and some virtual file system functions
author windel
date Fri, 13 Jan 2012 18:18:17 +0100
parents 88590c42320f
children d8185ddb6c7b
comparison
equal deleted inserted replaced
31:88590c42320f 32:3a6a9b929db0
126 // Global isr handler: 126 // Global isr handler:
127 127
128 // Hopefully, this function get called with the correct registers. 128 // Hopefully, this function get called with the correct registers.
129 void isr_handler(uint64_t* registers) 129 void isr_handler(uint64_t* registers)
130 { 130 {
131
132 uint64_t intnum = registers[7]; 131 uint64_t intnum = registers[7];
133 132
133 // TODO: make a list with handler pointers:
134 if (intnum == 32) 134 if (intnum == 32)
135 { 135 {
136 timerDriverUpdate(); 136 timerDriverUpdate();
137 } 137 }
138 else if (intnum == 33) 138 else if (intnum == 33)
139 { 139 {
140 unsigned char scancode = inb(0x60); 140 keyboardDriverUpdate();
141 keyboardDriverUpdate(scancode);
142 } 141 }
143 else 142 else
144 { 143 {
145 printf("Interrupt %d called, registers at: %x\n", registers[7], registers); 144 // printf("Interrupt %d called, registers at: %x\n", registers[7], registers);
146 } 145 }
147 146
147 // TODO: EOI to slave?
148 // TODO: replace this with APIC code?
148 outb(0x20, 0x20); // EOI to master 149 outb(0x20, 0x20); // EOI to master
149 } 150 }
150 151
151 // Interrupt service routines: 152 // Interrupt service routines:
152 153
168 { 169 {
169 printf("INT15 called!\n"); 170 printf("INT15 called!\n");
170 panic("Unhandled exception!"); 171 panic("Unhandled exception!");
171 } 172 }
172 173
173 // remapped IRQ from master PIC:
174 void INT32handler()
175 {
176 // System timer.
177 //printf("INT32 called!\n");
178 // called very frequent, what is this?
179 timerDriverUpdate();
180 // Acknowledge int:
181 outb(0x20, 0x20); // EOI to master
182 }
183
184 void INT33handler()
185 {
186 //printf("INT33 called, key pressed????\n");
187 unsigned char scancode = inb(0x60);
188 //printf("Scancode = 0x%x\n", scancode);
189 keyboardDriverUpdate(scancode);
190 outb(0x20, 0x20); // EOI to master
191 }
192
193 void INTDEF_handler() 174 void INTDEF_handler()
194 { 175 {
195 panic("Default int handler called\n"); 176 panic("Default int handler called\n");
196 } 177 }
197 178