Page 1 of 1

what's behind the lgdt

Posted: Fri Sep 26, 2014 1:40 am
by watermirror
hi, i have a question about lgdt when initialize the VMCS, intel-vt structure.

in my code, i have to switch the gdt when my system enter the protect mode.

if i use lgdt switch GDT directly, the checking for VMCS will fail. the new GDT is the same as the old one, except the base address.

but if i rewrite the cs, es... after switch the GDT, the VMCS is fine.

what's the difference between them?

Re: what's behind the lgdt

Posted: Fri Sep 26, 2014 2:47 am
by alexfru
You have to be more clear about what you're talking about.

Irrespective of that, GDT/GDTR manipulations must function the same way in guest and host OSes, irrespective of the existence of some Hypervisor using Intel-VT or AMD-Pacifica hardware-assisted virtualization.

Re: what's behind the lgdt

Posted: Fri Sep 26, 2014 8:11 am
by b.zaar
watermirror wrote:but if i rewrite the cs, es... after switch the GDT, the VMCS is fine.
Do you mean changing the segment registers after loading the GDT?

This is always necessary to set the correct base, limit and privilege level of the segment.