Intel 253668-032US Webcam User Manual


 
Vol. 3 5-35
PROTECTION
The processor automatically performs first, second, and third checks during instruc-
tion execution. Software must explicitly request the fourth check by issuing an ARPL
instruction. The fifth check (offset alignment) is performed automatically at privilege
level 3 if alignment checking is turned on. Offset alignment does not affect isolation
of privilege levels.
5.10.1 Checking Access Rights (LAR Instruction)
When the processor accesses a segment using a far pointer, it performs an access
rights check on the segment descriptor pointed to by the far pointer. This check is
performed to determine if type and privilege level (DPL) of the segment descriptor
are compatible with the operation to be performed. For example, when making a far
call in protected mode, the segment-descriptor type must be for a conforming or
nonconforming code segment, a call gate, a task gate, or a TSS. Then, if the call is to
a nonconforming code segment, the DPL of the code segment must be equal to the
CPL, and the RPL of the code segment’s segment selector must be less than or equal
to the DPL. If type or privilege level are found to be incompatible, the appropriate
exception is generated.
To prevent type incompatibility exceptions from being generated, software can check
the access rights of a segment descriptor using the LAR (load access rights) instruc-
tion. The LAR instruction specifies the segment selector for the segment descriptor
whose access rights are to be checked and a destination register. The instruction then
performs the following operations:
1. Check that the segment selector is not null.
2. Checks that the segment selector points to a segment descriptor that is within
the descriptor table limit (GDT or LDT).
3. Checks that the segment descriptor is a code, data, LDT, call gate, task gate, or
TSS segment-descriptor type.
4. If the segment is not a conforming code segment, checks if the 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).
5. If the privilege level and type checks pass, loads the second doubleword of the
segment descriptor into the destination register (masked by the value
00FXFF00H, where X indicates that the corresponding 4 bits are undefined) and
sets the ZF flag in the EFLAGS register. If the segment selector is not visible at
the current privilege level or is an invalid type for the LAR instruction, the
instruction does not modify the destination register and clears the ZF flag.
Once loaded in the destination register, software can preform additional checks on
the access rights information.