Prev: 17.3.T 'T' Instructions
Next: 17.3.W 'W' Instructions

17.3.V 'V' Instructions

VERR, VERW -- Verify a Segment for Reading or Writing

Opcode       Instruction   Clocks      Description

0F  00 /4    VERR r/m16    pm=10/11    Set ZF=1 if segment can be read,
                                       selector in r/m16
0F  00 /5    VERW r/m16    pm=15/16    Set ZF=1 if segment can be written,
                                       selector in r/m16

Operation

IF segment with selector at (r/m) is accessible

   with current protection level
   AND ((segment is readable for VERR) OR
      (segment is writable for VERW))
THEN ZF <- 0;
ELSE ZF <- 1; FI;

Description

The two-byte register or memory operand of VERR and VERW contains the value of a selector. VERR and VERW determine whether the segment denoted by the selector is reachable from the current privilege level and whether the segment is readable (VERR) or writable (VERW). If the segment is accessible, the zero flag is set to 1; if the segment is not accessible, the zero flag is set to 0. To set ZF, the following conditions must be met:

  -  The selector must denote a descriptor within the bounds of the table
     (GDT or LDT); the selector must be "defined."

  -  The selector must denote the descriptor of a code or data segment
     (not that of a task state segment, LDT, or a gate).

  -  For VERR, the segment must be readable. For VERW, the segment
     must be a writable data segment.

  -  If the code segment is readable and conforming, the descriptor
     privilege level (DPL) can be any value for VERR. Otherwise, the
     DPL must be greater than or equal to (have less or the same
     privilege as) both the current privilege level and the selector's RPL.
The validation performed is the same as if the segment were loaded into DS, ES, FS, or GS, and the indicated access (read or write) were performed. The zero flag receives the result of the validation. The selector's value cannot result in a protection exception, enabling the software to anticipate possible segment access problems.

Flags Affected

ZF as described above

Protected Mode Exceptions

Faults generated by illegal addressing of the memory operand that contains the selector, the selector is not loaded into any segment register, and no faults attributable to the selector operand are generated

#GP(0) for an illegal memory operand effective address in the CS, DS, ES, FS, or GS segments; #SS(0) for an illegal address in the SS segment; #PF(fault-code) for a page fault

Real Address Mode Exceptions

Interrupt 6; VERR and VERW are not recognized in Real Address Mode

Virtual 8086 Mode Exceptions

Same exceptions as in Real Address Mode; #PF(fault-code) for a page fault


Prev: 17.3.T 'T' Instructions
Next: 17.3.W 'W' Instructions