[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [Patch] Fix for x86_64 boot failures due to bad segment setup for protected mode.



Keir Fraser wrote:
On 9/11/06 3:49 am, "Stephen C. Tweedie" <sct@xxxxxxxxxx> wrote:

The fix is to save the 16-bit segments *always*, on entry to protected
mode when %CR0(PE) is first set; and to clear the saved 16-bit segment
and set the 32-bit variant in oldctx whenever a 32-bit segment
descriptor is set during the transition to 32-bit CS.  Then, when we
finally do the VMENTER, we will set up the VMCS from only the 32-bit
segments, clearing the VMCS entries for segments that have not been
assigned valid 32-bit segments yet.

So, after setting CR0.PE but before doing a jump to complete the transition
to protected mode, is the guest now running with zeroed data selectors but
with the old 'shadow segment state'? So it can still use its data segments
until the long jump? Not that I know whether any bootloader would actually
*want* to access data in that critical region....



Keir,

oldctx.*_sel is basically the shadow selector. They are not used in emulating the code during the single step. So zeroing them out is fine. The regs structure is what is used in calculating getting data in the data segments.

The main thing here that Stephen's approach is different to the previous approach, is that if a segment descriptor *is* changed (ie. %es for Vista) then we have to update the oldctx explicitly for that selector. So far the only place we see this is with the "pop %es". And Stephen put in the proper code to update that descriptor.

The old approach would just update all the selectors if they fit inside the GDT table, whether or not they were changed or loaded. So when Linux had a bad (extremely large) GDT limit, we loaded all the selectors into the shadow selector, even though they were bogus.

-- Steve


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.