<P> The choice of segment is normally defaulted by the processor according to the function being executed . Instructions are always fetched from the code segment . Any stack push or pop or any data reference referring to the stack uses the stack segment . All other references to data use the data segment . The extra segment is the default destination for string operations (for example MOVS or CMPS). FS and GS have no hardware - assigned uses . The instruction format allows an optional segment prefix byte which can be used to override the default segment for selected instructions if desired . </P> <P> In real mode or V86 mode, the size of a segment can range from 1 byte up to 65,536 bytes (using 16 - bit offsets). </P> <P> The 16 - bit segment selector in the segment register is interpreted as the most significant 16 bits of a linear 20 - bit address, called a segment address, of which the remaining four least significant bits are all zeros . The segment address is always added to a 16 - bit offset in the instruction to yield a linear address, which is the same as physical address in this mode . For instance, the segmented address 06EFh: 1234h (here the suffix "h" means hexadecimal) has a segment selector of 06EFh, representing a segment address of 06EF0h, to which we add the offset, yielding the linear address 06EF0h + 1234h = 08124h . </P> <P> Because of the way the segment address and offset are added, a single linear address can be mapped to up to 4096 distinct segment: offset pairs . For example, the linear address 08124h can have the segmented addresses 06EFh: 1234h, 0812h: 0004h, 0000h: 8124h, etc . This could be confusing to programmers accustomed to unique addressing schemes, but it can also be used to advantage, for example when addressing multiple nested data structures . While real mode segments are always 64 KB long, the practical effect is only that no segment can be longer than 64 KB, rather than that every segment must be 64 KB long . Because there is no protection or privilege limitation in real mode, even if a segment could be defined to be smaller than 64 KB, it would still be entirely up to the programs to coordinate and keep within the bounds of their segments, as any program can always access any memory (since it can arbitrarily set segment selectors to change segment addresses with absolutely no supervision). Therefore, real mode can just as well be imagined as having a variable length for each segment, in the range 1 to 65536 bytes, that is just not enforced by the CPU . </P>

How much memory is needed to store a paragraph in the x86 instruction set