usb keyboard vs btx: an SMI theory

Andriy Gapon avg at icyb.net.ua
Thu Jan 22 05:29:16 PST 2009


on 21/01/2009 21:07 John Baldwin said the following:
> 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.
> 

I've been thinking about that and also decided that my SMI theory is
rubbish.
On the other hand, I still suspect that there could be some race in
protected<->real transition, but from looking at the code I can not
imagine how it could happen.

-- 
Andriy Gapon


More information about the freebsd-hackers mailing list