Code: Select all
void serial_irq(registers_t regs) {
if (regs.eax) {} // prevent GCC complaining about unused parameter
printf("serial irq called\n");
u8int iir = inportb(COM1_PORT + 2); // interrupt identification register
printf("%x\n", iir);
if (!(iir & 1)) { // starts here
/* The UART didn't cause this IRQ; in future, we'll probably want to handle this,
but for now just return. */
printf("not a serial irq\n");
return;
} // ends here
if ((iir & 0x0e) != 4) {
/* This isn't a received-data-available interrupt; again, just return. */
printf("not a received-data interrupt\n");
return;
}
u8int read = inportb(COM1_PORT);
// for now just print it
printf("%c", read);
}
Edit: syntax