LAR—Load Access Rights ByteInstruction Operand EncodingDescriptionLoads the access rights from the segment descriptor specified by the second operand (source operand) into the first operand (destination operand) and sets the ZF flag in the flag register. The source operand (which can be a register or a memory location) contains the segment selector for the segment descriptor being accessed. If the source operand is a memory address, only 16 bits of data are accessed. The destination operand is a general-purpose register.The processor performs access checks as part of the loading process. Once loaded in the destination register, soft-ware can perform additional checks on the access rights information. The access rights for a segment descriptor include fields located in the second doubleword (bytes 4–7) of the segment descriptor. The following fields are loaded by the LAR instruction:•Bits 7:0 are returned as 0•Bits 11:8 return the segment type.•Bit 12 returns the S flag.•Bits 14:13 return the DPL.•Bit 15 returns the P flag.•The following fields are returned only if the operand size is greater than 16 bits:—Bits 19:16 are undefined.—Bit 20 returns the software-available bit in the descriptor.—Bit 21 returns the L flag.—Bit 22 returns the D/B flag.—Bit 23 returns the G flag.—Bits 31:24 are returned as 0.This instruction performs the following checks before it loads the access rights in the destination register: •Checks that the segment selector is not NULL.•Checks that the segment selector points to a descriptor that is within the limits of the GDT or LDT being accessed•Checks that the descriptor type is valid for this instruction. All code and data segment descriptors are valid for (can be accessed with) the LAR instruction. The valid system segment and gate descriptor types are given in Table 3-53. •If the segment is not a conforming code segment, it checks that the specified segment descriptor is visible at the CPL (that is, if the CPL and the RPL of the segment selector are less than or equal to the DPL of the segment selector).If the segment descriptor cannot be accessed or is an invalid type for the instruction, the ZF flag is cleared and no access rights are loaded in the destination operand.OpcodeInstructionOp/ En64-Bit ModeCompat/Leg ModeDescription0F 02 /rLAR r16, r16/m16RMValidValidr16 := access rights referenced by r16/m160F 02 /rLAR reg, r32/m161RMValidValidreg := access rights referenced by r32/m16NOTES:1. For all loads (regardless of source or destination sizing) only bits 16-0 are used. Other bits are ignored.Op/EnOperand 1Operand 2Operand 3Operand 4RMModRM:reg (w)ModRM:r/m (r)NANA
This UNOFFICIAL reference was generated from the official Intel® 64 and IA-32 Architectures Software Developer’s Manual by a dumb script. There is no guarantee that some parts aren't mangled or broken and is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.