79537544

Date: 2025-03-27 00:10:11
Score: 1
Natty:
Report link

Unfortunately, it turns out the question I asked does not provide sufficient context to solve this issue!

It turns out the error was not caused solely by my ISR handler, but also by my IRQ handler. Specifically, due to a bug in my bootloader code, the .bss section was not properly initialized to all 0s:

void irq_handler(registers_t *r) {
    if (r->int_no >= 40) set_port_byte(0xA0, 0x20);
    set_port_byte(0x20, 0x20);

    if (interrupt_handlers[r->int_no] != 0) { // This line would fail!
        isr_t handler = interrupt_handlers[r->int_no];
        handler(r);
    }
}

Hence, my code kept trying to call some random addresses in memory with obviously no luck, leading to infinite, weird, exceptions. In QEMU, the bss section is initially set to all 0s, hence there was no sign of failure before booting on real hardware

Reasons:
  • Blacklisted phrase (1): no luck
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: MichaelT572