To properly debug - generate debug info that QEMU can use. In your Makefile add the -g to GPPPARAMS and ASPARAMS. The debug info is going to be placed in the ELF executable called mykernel.bin. You can launch QEMU with remote debugging and then launch GDB to connect to that using the information in mykernel.bin like this:
Code: Select all
qemu-system-i386 -cdrom mykernel.iso -no-shutdown -no-reboot -S -s &
QEMU_PID=$!
gdb mykernel.bin \
-ex 'target remote localhost:1234' \
-ex 'layout src' \
-ex 'layout regs' \
-ex 'break *kernelMain' \
-ex 'continue'
if ps -p $QEMU_PID >/dev/null
then
kill -9 $QEMU_PID >/dev/null
fi
stty sane
I used this to hunt down your problem. When QEMU first hit the kernelMain breakpoint it stopped. I set a another breakpoint at the Keyboard Interrupt entry point with b InterruptManager::handleInterruptRequest0x01 . I then used the continue command c to continue until the next breakpoint is hit. When a keyboard interrupt occurred I used the step command s to step through the assembly code one instruction at a time observing that things looked okay. I continued using step through the CPP code and then noticed that in InterruptManager::DoHandleInterrupt this line
Code: Select all
esp = handlers[interruptNum]->handleInterrupt(esp);
Code: Select all
virtual uint32_t HandleInterrupt(uint32_t esp);
Making this fix should allow your keyboard handler to be called properly.