Search code examples
assemblyx86cpu-registersmemory-segmentation

What is the advantage of using segment registers (today)?


i was trying quite a while to learn what the segment registers purpose is? I All ready know that this comes from the past (8086) where there was only 1 MByte of physical memory. But the CPU's had only 16 Bit wide address registers. With these 16 Address bits you could only address 64K Byte. So the 1MByte Address-space had to be separated into segments each of 64K size.

This seems to me to be a requirement from the past where those engineers hat to work around of somehow limited memory space and such. But my question is what is the advantage of the segment registers today? How or where would you use them registers in a useful way? If you need clarification just comment.


Solution

  • Arguably, x86-64 long mode is the technology of "today". There classical segmentation for the most part is nonexistent, with only FS and GS being used for practical purposes. FS is typically used for various thread-local and system data in user mode, while GS is used for kernel mode. This latter use is supported by the SWAPGS instruction.