The following are the segment register instructions supported by the x86 processor.
lds{wl} mem[32|48], reg[16|32] les{wl} mem[32|48], reg[16|32] lfs{wl} mem[32|48], reg[16|32] lgs{wl} mem[32|48], reg[16|32] lss{wl} mem[32|48], reg[16|32]
mem[32|48] -> reg[16|32]
Reads a full pointer from memory and stores it in the specified segment register (DS, ES, FS, GS or SS) with a 16- or 32-bit offset value.
Load a 16-bit pointer from memory location 0x44444444 into the DX register:
ldsw 0x44444444, %dx
Load a 32-bit pointer from memory location 0x33333333 into the EDX register:
ldsl 0x33333333, %edx
pop{wl} r/m[16|32] pop{l} [%ds|%ss|%es|%fs|%gs]
stack -> r/m[16|32]
stack -> segment register
Replaces the previous contents of the register or memory operand with a word or long from the top of the stack.
Replaces the previous contents of the segment register operand with a long.
For a word, SP + 2; for a long, SP + 4.
Replace the contents of the memory location pointed to by the EDI register, plus an offset of 4, with the word from the top of the stack:
popw 4(edi)
Replace the contents of the memory location pointed to by the EAX register with the long from the top of the stack:
popl %eax
push{wl} r/m[16|32] push{wl} imm[8|16|32] push{l} [%cs|%ds|%ss|%es|%fs|%gs]
r/m[16|32] -> stack segment register -> stack
For a word, SP - 2; for a long, SP - 4. Replaces the new top of stack, pointed to by SP, with the register, memory, immediate, or segment register operand.
Replaces the new top of stack with the 16-bit immediate value, -126:
pushw $-126
Replaces the new top of stack with the 32-bit immediate value, 23456789:
pushl $23456789
Replaces the new top of stack with the content of the AX register:
pushw %ax
Replaces the new top of stack with the content of the EBX register:
pushl %ebx