Re: [edk2] Why does UEFI firmware on x64 not initialize "long mode" GDT?

2016-06-07 Thread Andrew Fish
> On Jun 7, 2016, at 2:59 PM, Brett Stahlman wrote: > > d'Oh! Mystery solved. Working through the `info registers' output you > sent helped me see what was happening. The system I'm working with had > a buggy printf: in particular, it was parsing but effectively

Re: [edk2] Why does UEFI firmware on x64 not initialize "long mode" GDT?

2016-06-07 Thread Brett Stahlman
d'Oh! Mystery solved. Working through the `info registers' output you sent helped me see what was happening. The system I'm working with had a buggy printf: in particular, it was parsing but effectively throwing away the `l' in a %ld or %lx specifier, so my attempts to print GDT entries with %lx

Re: [edk2] Why does UEFI firmware on x64 not initialize "long mode" GDT?

2016-06-07 Thread Laszlo Ersek
On 06/07/16 17:35, Andrew Fish wrote: > >> On Jun 7, 2016, at 8:31 AM, Brett Stahlman 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: >>

Re: [edk2] Why does UEFI firmware on x64 not initialize "long mode" GDT?

2016-06-07 Thread Andrew Fish
> On Jun 7, 2016, at 8:31 AM, Brett Stahlman 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

Re: [edk2] Why does UEFI firmware on x64 not initialize "long mode" GDT?

2016-06-07 Thread Brett Stahlman
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

[edk2] Why does UEFI firmware on x64 not initialize "long mode" GDT?

2016-06-07 Thread Brett Stahlman
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: