[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 07/32] xen/x86: fix arch_set_info_guest for HVM guests
On 05/08/15 18:11, Roger Pau Monné wrote: > El 05/08/15 a les 18.46, Andrew Cooper ha escrit: >> On 05/08/15 17:40, Roger Pau Monné wrote: >>> El 05/08/15 a les 17.39, Andrew Cooper ha escrit: >>>> On 05/08/15 10:53, Roger Pau Monné wrote: >>>>> El 04/08/15 a les 20.08, Andrew Cooper ha escrit: >>>>>> On 03/08/15 18:31, Roger Pau Monné wrote: >>>>>>> uint32_t cs_base; >>>>>>> uint32_t ds_base; >>>>>>> uint32_t ss_base; >>>>>>> uint32_t cs_limit; >>>>>>> uint32_t ds_limit; >>>>>>> uint32_t ss_limit; >>>>>>> uint16_t cs_ar; >>>>>>> uint16_t ds_ar; >>>>>>> uint16_t ss_ar; >>>>>> You need selector entries for each segment as well. >>>>> Really? What's the point in having the selector if we don't have a GDT, >>>>> and we allow loading the cached part, which is the relevant one. >>>> push %cs; push 1f; lret >>>> >>>> At all points when segment details are updated, it is the responsibility >>>> of software to ensure that the details match with the GDT/LDT entry. >>>> See for example the Intel and AMD manuals for syscall/sysenter where >>>> similar "updating segment details behind the scenes" occurs. >>> I would certainly expect the user to have loaded a proper GDT and >>> reloaded the segments selectors before attempting to do something like >>> the above. >>> >>> I really don't mind adding a cs_sel, ds_sel, ss_sel and tr_sel, I just >>> think it's quite pointless because it's common practice to load a GDT >>> and then reload the segment selectors to point to the right entries. >> Consider what would happen if the vcpu hits mmio and bounces into Xen >> for emulation before reloading the segment selectors. > I hope Xen is just going to kill the guest. I would hope for it to work properly. > >> The segment selector information needs to be consistent, as it might not >> be the guest which is the next entity to observe the vcpu state. > I guess I'm missing something, but AFAICT we already start the BSP in > such "inconsistent" state, So we do. (There are a number of inconsistencies in that area.) > the cached part of the selectors is right but > the selectors themselves don't point to valid GDT entries because > there's no GDT loaded. Hmm yes - you are correct. On native, the cached part of the segment selectors only get updated with a segment selector is loaded, at which point the gdt/ldt must be valid. However there is no requirement or need for the gdt/ldt to stay valid after the cached part has been loaded. Unreal mode relies on this. Considering that the first thing any AP startup function will do is lgdt and reload the segment registers, we can do without maintaining selector consistency. Sorry for the confusion. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |