Segmentation Registers: when are they used? Implicit uses 1. Instruction references use the %cs segment register. 2. General memory references use the %ds segment register. 3. Stack references, that is, memory references via %ebp or %esp, use the %ss segment register. 4. String references, that is, memory references via string operations (e.g. indexing using %esi and %edi, or primitive string operations %movs, %stos, or repeat prefix %rep), use the %es segment register Explicit uses 1. Overriding implicit rules. Only rule 2 above can be overridden. can do movl %eax, %ss:[%ebx]. 2. can directly modify segment registers via mov or far jmp and call. 3. can use lds lss, lfs, ... instructions to load a memory reference via the selected segment registers. References [1] http://www.scs.stanford.edu/05au-cs240c/lab/i386/s02_05.htm [2] http://www.ic.unicamp.br/~celio/mc404s2-03/addr_modes/intel_addr.html