Skip to main content

Module keyfeed

Module keyfeed 

Source
Expand description

Host keystrokes waiting to be typed into a DOS guest.

A key has two encodings, and a PC guest consumes exactly one of them:

  • the 8042 data port yields PS/2 set-1 scancodes (make/break, with a shift bracket for shifted characters and the 0xE0 prefix for arrows), which the guest’s own INT 9 handler reads;
  • the firmware keyboard buffer holds (scan code, ASCII) pairs, which a guest that kept INT 16h at the firmware reads.

The queue therefore stores whole keys, not bytes: the cursor is one key index shared by both views. That matters because the two consumers are never both fed — the runner types into the 8042 only once the guest owns INT 9, and into the buffer before that. Advancing only one view used to leave a phantom remainder in the other (a hardware run reported “4 keys not typed” for keys that had all reached the 8042) and would have re-typed the same keys after a restart.

The module is pure — it only touches the keyboard and BIOS models — which is what lets the host tests drive it without VT-x.

Re-exports§

use alloc::vec::Vec; 🔒
use super::bios; 🔒
use super::keyboard; 🔒

Structs§

Key
One queued key, in the encodings the two PC consumers expect.
KeyboardFeed
Host text waiting to be typed into a DOS guest.