Segment selector: table index or byte offset?
Posted: Tue Mar 15, 2016 2:14 pm
Intel System Programming guide states that segment selector consists of:
The second approach actually works but what about Intel Manual? Which is it really: index or byte offset?
However the GDT Tutorial and lots of example and OS's source code suggests that segment selector is a byte offset from the descriptor table's beginning. That is first valid selector is 0x08, next is 0x10 and so forth.Index (Bits 3 through 15) — Selects one of 8192 descriptors in the GDT or LDT. The processor multiplies
the index value by 8 (the number of bytes in a segment descriptor) and adds the result to the base
address of the GDT or LDT (from the GDTR or LDTR register, respectively).
The second approach actually works but what about Intel Manual? Which is it really: index or byte offset?