usb keyboard vs btx: an SMI theory

John Baldwin jhb at
Wed Jan 21 12:09:48 PST 2009

On Tuesday 16 December 2008 8:16:44 am Andriy Gapon wrote:
> Again, I am very fuzzy about the exact details, but I think that this is
> something that could be happening and I think that SMI is of primary
> interest here. I also think that this might explain to a certain degree
> the difference in behavior between "older" btx and "newer" btx.

One thing to keep in mind is that when an SMI# is delivered, the processor 
enters System Management Mode (SMM).  In SMM, the CPU actually uses a 
different set of memory for its RAM.  It also runs in a sort of weird 32-bit 
real mode.  It is not going to call the stock IRQ 1 handler.  Instead, it 
passes data back to "normal" mode by changing the values restored into 
registers when exiting SMM.  Typically doing an I/O port access to the ports 
backing the keyboard (0x60 and 0x64) cause an SMI# and the SMM handler 
emulates the inb/outb request by storing the resulting data for an inb in 
the %ax register the "normal" mode sees once it resumes execution after 
the 'inb' instruction.

John Baldwin

More information about the freebsd-hackers mailing list