LGS
Usage: LGS dest,src Modifies flags: None
Loads 32-bit pointer from memory 'src' to 'dest' register and GS. The offset is placed in the 'dest' register and the segment is placed in GS. To use this instruction the word at the lower memory address must contain the offset and the word at the higher address must contain the segment.
Load Far Pointer
LDS reg16,mem ; o16 C5 /r [8086]
LDS reg32,mem ; o32 C5 /r [386]
LES reg16,mem ; o16 C4 /r [8086]
LES reg32,mem ; o32 C4 /r [386]
LFS reg16,mem ; o16 0F B4 /r [386]
LFS reg32,mem ; o32 0F B4 /r [386]
LGS reg16,mem ; o16 0F B5 /r [386]
LGS reg32,mem ; o32 0F B5 /r [386]
LSS reg16,mem ; o16 0F B2 /r [386]
LSS reg32,mem ; o32 0F B2 /r [386]
These instructions load an entire far pointer (16 or 32 bits of offset, plus 16 bits of segment) out of memory in one go. LDS, for example, loads 16 or 32 bits from the given memory address into the given register (depending on the size of the register), then loads the 16 bits from memory into DS.
LES, LFS, LGS and LSS work in the same way but use the other segment registers.
Example:
lgs eax Label