<<< Segment Descriptor Data Structure     Index     Segment Descriptor Cont. >>>

6. Segment Descriptor Examples


  • For example, a code fetch always uses the current CS value. A protected mode fetch starts by multiplying CS by 8 and then adding the descriptor base register. The 386 then reads an entire 8 byte record from the descriptor table. The entry describes the start of the segment; the processor adds the current instruction pointer to this start to get an effective address.

  • A data access behaves the same way. A load from location DS:1000 makes the processor read a descriptor by shifting DS left 3 bits (i.e., times 8), adding the table's base address (stored in the 386's on-board descriptor table register), and reading the 8 byte descriptor at this address. The descriptor contains the segment's start address, which is added to the offset in the instruction (in this case 1000). Offsets, and segment start addresses, are 32 bit numbers - it's really easy to reference any location in memory.

  • Segment descriptor format:

      Segment descriptor format

      A segment descriptor


<<< Segment Descriptor Data Structure     Index     Segment Descriptor Cont. >>>