Lesson 23, section 6

This commit is contained in:
Carlos
2015-08-28 10:52:05 +02:00
parent c473761432
commit b109691179
8 changed files with 44 additions and 51 deletions

View File

@@ -116,13 +116,13 @@ char *exception_messages[] = {
"Reserved"
};
void isr_handler(registers_t r) {
void isr_handler(registers_t *r) {
kprint("received interrupt: ");
char s[3];
int_to_ascii(r.int_no, s);
int_to_ascii(r->int_no, s);
kprint(s);
kprint("\n");
kprint(exception_messages[r.int_no]);
kprint(exception_messages[r->int_no]);
kprint("\n");
}
@@ -130,15 +130,15 @@ void register_interrupt_handler(uint8_t n, isr_t handler) {
interrupt_handlers[n] = handler;
}
void irq_handler(registers_t r) {
void irq_handler(registers_t *r) {
/* After every interrupt we need to send an EOI to the PICs
* or they will not send another interrupt again */
if (r.int_no >= 40) port_byte_out(0xA0, 0x20); /* slave */
if (r->int_no >= 40) port_byte_out(0xA0, 0x20); /* slave */
port_byte_out(0x20, 0x20); /* master */
/* Handle the interrupt in a more modular way */
if (interrupt_handlers[r.int_no] != 0) {
isr_t handler = interrupt_handlers[r.int_no];
if (interrupt_handlers[r->int_no] != 0) {
isr_t handler = interrupt_handlers[r->int_no];
handler(r);
}
}