Subject: Re: Xen Internals(Trap handler)
To: Vibhooti Verma <vibhooti_verma@yahoo.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-xen
Date: 03/26/2007 20:37:45
On Sun, Mar 25, 2007 at 10:36:02PM -0700, Vibhooti Verma wrote:
> 
> How does trap handler know about origin of trap?
> Whether it is generated from guest os's user process or guest os
> kernel?since it has to execute privileged instruction only when it is coming
> from guest OS., kernel.

On i386, the kernel and userland runs in different ring levels (userland
is still at level 3, the kernel is at level 1 - level 0 is reserved for the
hypervisor of course).
So the hypervisor just needs to check the ring level of the trapping
instruction in %cs

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--