what's behind the lgdt

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
watermirror
Member
Member
Posts: 25
Joined: Tue Nov 05, 2013 4:06 am

what's behind the lgdt

Post 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?
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: what's behind the lgdt

Post 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.
User avatar
b.zaar
Member
Member
Posts: 294
Joined: Wed May 21, 2008 4:33 am
Location: Mars MTC +6:00
Contact:

Re: what's behind the lgdt

Post 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.
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed
Post Reply