Petersson, Mats
2006-Jan-24 13:34 UTC
RE: [Xen-devel] Paravirtualization of the "HLT" instruction ( for example) on x386
> -----Original Message----- > From: xen-devel-bounces@lists.xensource.com > [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Ian Brown > Sent: 24 January 2006 12:24 > To: Keir Fraser > Cc: Xen Mailing List > Subject: Re: [Xen-devel] Paravirtualization of the "HLT" > instruction ( for example) on x386 > > Hello, > > Thanks for your answer in such a short time ! > > I am aware of emulate_privileged_op() in traps.c and also of > the emulation of both CLTS and WBINVD in this method. > > you said : > >GPFs that are not handled by Xen are indeed then passed to the guest > >and will end up in the function you mentioned in your email. > > I am not sure about something regarding "are indeed then > passed to the guest": > suppose a guest OS, running in ring 1, issues a privileged > instruction (namely, an instruction which causes #GP(0) since > it was issued in CPL1 ). > I don''t know if it is possible at all since as I understand > such instructions were replaced in the guest OS code. But > let''s say it''s possible, the "passed to the guest" is the > point I am trying to get at. > > In such a case, what happens ? there is a #GP(0) of course, > but who handles it in the first place ? is it the OS in ring > 0 (with it''s > do_general_protection() method in this case ? ) ? or is it > the OS in ring 1, which also have do_general_protection() method ? > > and by > >GPFs that are not handled by Xen are indeed then passed to the guest > >and will end up in the function you mentioned in your email. > > you mean that GPFs that occurred in ring 1 will be handled at > the first place by the guest ? (or ,what seems to me more > unlikely, first by ring0 and then somehow "passed" to the guest) > > Regards, > IB > >The way it works is that the GP fault is taken by Xen, and if Xen decides that "I don''t know what to do with this", for example because it''s an unexpected scenario, it will PASS it to the Guest. I haven''t looked at how the passing is done in Xen''s hypervisor - there are several ways you could do this, for example parsing the IDT of the guest and making a fake stack-frame for the guest. In a hardware virtualized environment, the GP fault would be passed in the same way as a virtual interrupt is passed to the guest. I just noticed that Keir just answered this one too. [snip] -- Mats _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel