The base of the GDT (plus the LDT and IDT)...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:The base of the GDT (plus the LDT and IDT)...
well, all you need to do is segment(GDT)*16 + offset(GDT). That's your linear base address
Re:The base of the GDT (plus the LDT and IDT)...
How can it be when i'm already in p-mode?
I never know what's the base of cs or ds.
I never know what's the base of cs or ds.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:The base of the GDT (plus the LDT and IDT)...
//off-topic : hey, i got a 3rd star
in that case (and provided that you're at DPL0), you can use
sgdt [target_6bytes] to get a copy of the current GDT registers.
sidt works the same way. As the system will reply with a linear address, you'll need a data descriptor that starts at offset 0 (or a data descriptor that starts at a well-known address, in that case an alignment of the value read by sgdt will be required) to access the tables. Note however that the easiest way to work is to remember the logical address of your GDT when you set it up ...
For the LDT, things are a bit different while sldt returns the *selector* of the current LDT. Thus you need a pointer to your GDT and access GDT+sldt(). Then, read the LDT descriptor and extracts its base address from the fields...
Hope it'll help
in that case (and provided that you're at DPL0), you can use
sgdt [target_6bytes] to get a copy of the current GDT registers.
sidt works the same way. As the system will reply with a linear address, you'll need a data descriptor that starts at offset 0 (or a data descriptor that starts at a well-known address, in that case an alignment of the value read by sgdt will be required) to access the tables. Note however that the easiest way to work is to remember the logical address of your GDT when you set it up ...
For the LDT, things are a bit different while sldt returns the *selector* of the current LDT. Thus you need a pointer to your GDT and access GDT+sldt(). Then, read the LDT descriptor and extracts its base address from the fields...
Hope it'll help
Re:The base of the GDT (plus the LDT and IDT)...
Congratulations... (I misspelled that, didn't I?)Pype.Clicker wrote: //off-topic : hey, i got a 3rd star