feat: made more definitions constant and did some more minor
improvements
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <libc/libc.h>
|
||||
#include <drivers/ports.h>
|
||||
|
||||
#define PIC_END_OF_INTERRUPT 0x20
|
||||
|
||||
isr_t interrupt_handlers[256];
|
||||
|
||||
void isr_install() {
|
||||
@@ -133,11 +135,11 @@ void register_interrupt_handler(u8 n, isr_t handler) {
|
||||
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 */
|
||||
port_byte_out(0x20, 0x20); /* master */
|
||||
if (r.int_no >= 40) port_byte_out(PORT_PIC_SLAVE_COMMAND, PIC_END_OF_INTERRUPT); /* slave */
|
||||
port_byte_out(PORT_PIC_MASTER_COMMAND, PIC_END_OF_INTERRUPT); /* master */
|
||||
|
||||
/* Handle the interrupt in a more modular way */
|
||||
if (interrupt_handlers[r.int_no] != 0) {
|
||||
if (interrupt_handlers[r.int_no] != NULL) {
|
||||
isr_t handler = interrupt_handlers[r.int_no];
|
||||
handler(r);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user