mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2025-12-18 04:44:35 +03:00
Lesson 23, section 6
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user