0

I'm debugging a 32bits operating system, and to do it I'm using QEMU+GDB.

I'm trying to discover in which moment the code makes an INT 16 to get the keyboard buffer.

I isolated the function that does this, but I can not understant how it does it.

There is a moment that executes a CALL DWORD PTR[EAX] while EAX is pointing to 0x98FA2 (and it jumps to this address).

The think here is that this is not a memory corresponding to the operating system, I don't know why is this code in this point of memory.

I have put a watchpoint to 0x98FA2 to discover who is writting code here. For my surprise, is the QEMU bios, from 0x5b the BIOS is writting this bytes.

Anyone can orient me?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
user1814720
  • 93
  • 1
  • 8
  • Well, if the IVT is located at address 0, then the interrupt vector for `int 16h` would be the DWORD at address 58h..5Bh. – Michael Nov 05 '19 at 18:33
  • 2
    A 32-bit OS is likely not using the BIOS to do keyboard read and writes as BIOS interrupts aren't available while in 32-bit protected mode. They'd have to switch back to real mode and then back to protected mode which makes no sense. 32-bit OSes usually initialize the keyboard controller and then read and write characters directly (and most set up their own interrupt handler and circular keyboard buffer). – Michael Petch Nov 05 '19 at 21:27
  • The source to the BIOS that QEMU runs in the guest is freely available, so it would be faster to look at it rather than reverse-engineering it... – Peter Maydell Nov 07 '19 at 11:16
  • As @MichaelPetch indicated, it seems that the OS have some functions to make the functions of talking with keyboard and tty. What I don't understand is how it works exactly, do you have any reference where I can get more information about how these controllers work? – user1814720 Nov 07 '19 at 16:59
  • https://wiki.osdev.org/%228042%22_PS/2_Controller and https://wiki.osdev.org/PS/2_Keyboard have information. – Michael Petch Nov 07 '19 at 17:24
  • ...and the seabios code that accesses the PS2 ports is in this file: https://git.seabios.org/cgit/seabios.git/tree/src/hw/ps2port.c – Peter Maydell Nov 07 '19 at 18:35

0 Answers0