Many machines come with a builtin software or hardware terminal for GRUB to use instead of implementing its own! So today I'm studying the simpler of GRUB's machine-specific terminal drivers.
To output a char on Xen-emulated machines until there's space in a ringbuffer it spinlocks (via a helper) on Xen's event-channel before writing enqueueing it, saves some sort of timestamp, & unsets a flag. Memory barriers surround the ringbuffer manipulations.
Chars are read at an incremented index.
1/?