I mean the selector entries in the GDT. They're 8 bytes long, which makes 0x16 incorrect. (0x16 == 22)raghuk wrote:Small correction there. Size of a selector is 16 bits. Selector needs not be multiples of 8. Usually they are multiples of 8 because bits 0-1 represent requested privilege level and bit 2 represents table indicator (GDT = 0, LDT = 1). For kernel code/data segments we have RPL = 0 and TI = 0. Hence they are multiples of 8.Troy Martin wrote:Okay, but here's the odd thing: 0x16!? Well thar's a problem, it should be 0x18. Selectors are usually multiples of 8, as that's the size of a selector...
Protected Mode Hello world.
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Protected Mode Hello world.
Re: Protected Mode Hello world.
You mean "descriptor" entries. 0x16 is incorrect because 0x16 = 00010110 and bit 2 is set. That means the selector is pointing to LDT and not GDT. It has nothing to with the fact that a descriptor is 8 bytes. For e.g. selector 0x13 is not divisible by 8 but still points at GDT.Troy Martin wrote:I mean the selector entries in the GDT. They're 8 bytes long, which makes 0x16 incorrect. (0x16 == 22)
This is how a selector is structured:
Index to GDT/LDT (Bits 3-15)
TI (Bit 2)
RPL (Bits 0-1)