From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cam Macdonell Subject: Re: What happens on an INT80 instruction Date: Mon, 01 Oct 2007 14:53:22 -0600 Message-ID: <47015E42.4000403@cs.ualberta.ca> References: <47004DDE.1060603@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Anthony Liguori Return-path: In-Reply-To: <47004DDE.1060603-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Anthony Liguori 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. > Thanks Anthony. Does an int80 from an application in the guest always cause a vmexit (in kvm's case at least)? Thanks, Cam > 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. To solve this in the general case, you'll need > to have the guest be aware of a memory hole. If you can limit yourself > to things like Linux and Windows, you can probably just rely on some > memory within the BIOS area (both Linux and Windows always have valid > mappings of the BIOS memory). > > If you need to enforce that int80s go to you, you'll need to > write-protect this memory too. > > Regards, > > Anthony Liguori > >> Thanks, >> Cam >> >> >> >> ------------------------------------------------------------------------- >> 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 >> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org >> https://lists.sourceforge.net/lists/listinfo/kvm-devel >> >> ------------------------------------------------------------------------- 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/