Extra:Intel x86 Segmentation: Difference between revisions

From COMP15212 Wiki
gravatar Yuron [userbureaucratinterface-adminsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (1 revision imported)
gravatar A59988pm [userPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (Repaired link)
 
Line 9: Line 9:
If you’re still with us, a bit of history.  The 8086 (1978) was a
If you’re still with us, a bit of history.  The 8086 (1978) was a
16-bit microprocessor but was already looking forwards as it was
16-bit microprocessor but was already looking forwards as it was
apparent that a 16-bit [address space](Memory_Sizes] (i.e. 64 KB) was
apparent that a 16-bit [[Memory Sizes|address space]] (i.e. 64 KB) was
going to be inadequate.  It therefore included the concept of
going to be inadequate.  It therefore included the concept of
“segment registers” – 16-bit registers <em>shifted</em> 4 bits
“segment registers” – 16-bit registers <em>shifted</em> 4 bits

Latest revision as of 15:35, 3 February 2025

Before proceeding with this subsection, note that it:

  • addresses a very specific, complicated system
  • uses the term “segmentation” in a specific way
  • is only treated in a cursory way
  • isn’t necessary for most people to know

If you’re still with us, a bit of history. The 8086 (1978) was a 16-bit microprocessor but was already looking forwards as it was apparent that a 16-bit address space (i.e. 64 KB) was going to be inadequate. It therefore included the concept of “segment registers” – 16-bit registers shifted 4 bits left which were added to the ‘ordinary’ 16-bit addresses (or “offsets”) to form a 20-bit address (i.e. 1 MiB).

Within this space was the infamous ‘640K’ memory limit of the original IBM PC. (The other 384K space was used for I/O, such as graphics.)

These ‘segments’ offered no memory protection etc; they simply allowed (possibly ‘enforced’) a logical partitioning, with code in a particular 64KB (16-bit) window into the 1MB space, data in another, stack in a third and so forth. Segments could overlap or be redefined at will by the programmer. There was no concept of privileged operating modes.

The subsequent (but still basically 16-bit) 80286 (1982) extended the address space to 24-bit (16MB) via a ‘segment descriptor’ table with longer addresses and some privilege level indicators. This used fairly ‘classical’ segments, with the table indicating a base address and a segment size. Backward compatibility was maintained, too.

The 32-bit 80386 (1985) (4GB) enlarged the various fields and added paging; with the latter the segment addresses become virtual addresses. Later ‘Physical Address Extension’ (Pentium Pro - 1995) extended the range of physical addresses using three-level page tables. Operation for backward compatibility was maintained.

The x86-64 (c.2000) maintains backwards compatibility whilst extending forwards with four-level page tables in its ‘long mode’. Virtual addresses can be 64-bit although the physical address size is ‘limited’ to 52 bits (many implementations 48 bits: a ‘mere’ 256 TB).

In most of these later incarnations the ‘segmentation’ is regarded as obsolete. Mostly.

You were warned! More details (many, many more details) are available

Further material