Avi Kivity wrote:
> Anthony Liguori wrote:
>> Jun Koi wrote:
>>  
>>> On 10/1/07, Anthony Liguori <[EMAIL PROTECTED]> wrote:
>>>      
>>>> Cameron Macdonell wrote:
>>>>          
>>>>> Hi,
>>>>>
>>>>> I'm trying to understand guest virtualization at the lower levels.  I
>>>>> have a somewhat basic question:  How does KVM virtualize an int80
>>>>> instruction from a guest?  A pointer to an answer is just as good as
>>>>> an answer itself.
>>>>>
>>>>>               
>>>> The same thing happens as it does on normal hardware.
>>>>
>>>> The way VT/SVM works (at a high level), is that certain 
>>>> instructions and
>>>> events check a special area called the VMCS/VMCB to determine whether
>>>> the event should generate a vmexit which is really just a special type
>>>> of trap.
>>>>
>>>> There are no hooks for interrupts 32-255 so the hardware operates 
>>>> as it
>>>> normally would.  If you're interested in getting a trap for int80 
>>>> within
>>>> KVM, you'll have to trap sidt/lidt and virtualize the IDT.  You'll 
>>>> need
>>>> to setup a fake IDT and have the int80 handler do a hypercall.  
>>>> This is
>>>> complicated if the guest is using a fast-syscall mechanism.  It may 
>>>> be a
>>>> little challenging finding a piece of guest memory to take over 
>>>> that has
>>>> a valid virtual mapping.
>>>>           
>>> This is a bit vague to me. Why do you need "a piece of guest memory" 
>>> here?
>>>       
>>
>> You don't just need guest memory, you need a valid guest virtual 
>> address too.  The IDTR contains a guest VA.  If you want to create 
>> your own IDT, then it has to be a valid VA in the guest's address space.
>>
>>   
>
> You can set the guest idt size to zero and trap the double fault 
> exception.

You could, but then you're trapping all exceptions instead of just the 
int80.  Of course, int80 is probably the one you care most about 
performance wise so it's probably a reasonable approach.

Regards,

Anthony Liguori



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to