> On Jun 7, 2016, at 8:31 AM, Brett Stahlman <brettstahl...@gmail.com> wrote:
> 
> Ah. I think I may have found the answer to at least part of my
> question, but would appreciate if someone could confirm...
> 
> Section 2.3.4 of the UEFI spec states:
> "Selectors are set to be flat and are otherwise not used."
> 
> Section 3.2.4 of the Intel processor spec (Vol. 3A 3-7) states:
> "In 64-bit mode, segmentation is generally (but not completely)
> disabled, creating a
> flat 64-bit linear-address space... Note that the processor does not
> perform segment limit checks at runtime in 64-bit mode."
> 
> So if I'm reading all this correctly... The value of the fields
> governing the interpretation of the segment limits (e.g., L and D/B)
> are "don't cares" in IA32e 64-bit mode. But what about fields not
> directly related to limit checks: e.g., P (Present) flag, and DPL
> (Descriptor Privilege Level)? Do their values not matter either?
> 

Brett,

Yes you only need valid entries for segments that are used. If I'm remembering 
correctly you can use the index in the segment registers to map to the GDT 
entry. 

Thanks,

Andrew Fish

> Thanks,
> Brett S.
> 
> 
> 
> On Tue, Jun 7, 2016 at 8:46 AM, Brett Stahlman <brettstahl...@gmail.com> 
> wrote:
>> Just inside my 64-bit x64 EFI boot loader, I print out the contents of
>> the GDT to see how it was initialized by the firmware. I've tried
>> running the boot loader both in QEMU (OVMF) and VMware ESXi. In both
>> cases, the first 5 descriptors after the leading null descriptor look
>> like this:
>> 
>> 0x000000000000ffff
>> 
>> Note all the leading zeroes: in particular, flags such as D/B and L
>> being clear seem to suggest a GDT that's inappropriate for 64-bit long
>> mode. I've verified by looking at CR* registers and such that the
>> firmware has indeed placed me in IA32e "long mode" with identity
>> paging. This is what I would expect, in light of section 2.3.4 in the
>> UEFI spec. But why does the GDT have all leading 0's?
>> 
>> Thanks,
>> Brett S.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to