* remove "\r" nonsense
[mascara-docs.git] / i386 / i386.reference / ARPL.htm
blob6842783ac8ce61c88d45f5053f26a97236de6b57
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>80386 Programmer's Reference Manual -- Opcode ARPL</TITLE>
5 </HEAD>
6 <BODY>
7 <B>up:</B> <A HREF="c17.htm">
8 Chapter 17 -- 80386 Instruction Set</A><BR>
9 <B>prev:</B><A HREF="AND.htm"> AND Logical AND</A><BR>
10 <B>next:</B><A HREF="BOUND.htm"> BOUND Check Array Index Against Bounds</A>
11 <P>
12 <HR>
13 <P>
14 <H1>ARPL -- Adjust RPL Field of Selector</H1>
16 <PRE>
17 Opcode Instruction Clocks Description
19 63 /r ARPL r/m16,r16 pm=20/21 Adjust RPL of r/m16 to not
20 less than RPL of r16
21 </PRE>
23 <H2>Operation</H2>
25 <PRE>
26 IF RPL bits(0,1) of DEST < RPL bits(0,1) of SRC
27 THEN
28 ZF := 1;
29 RPL bits(0,1) of DEST := RPL bits(0,1) of SRC;
30 ELSE
31 ZF := 0;
32 FI;
33 </PRE>
35 <H2>Description</H2>
37 The ARPL instruction has two operands. The first operand is a 16-bit
38 memory variable or word register that contains the value of a selector. The
39 second operand is a word register. If the RPL field ("requested privilege
40 level"--bottom two bits) of the first operand is less than the RPL field of
41 the second operand, the zero flag is set to 1 and the RPL field of the
42 first operand is increased to match the second operand. Otherwise, the zero
43 flag is set to 0 and no change is made to the first operand.
44 <P>
45 ARPL appears in operating system software, not in application programs. It
46 is used to guarantee that a selector parameter to a subroutine does not
47 request more privilege than the caller is allowed. The second operand of
48 ARPL is normally a register that contains the CS selector value of the
49 caller.
51 <H2>Flags Affected</H2>
53 ZF as described above
55 <H2>Protected Mode Exceptions</H2>
57 #GP(0) if the result is in a nonwritable segment; #GP(0) for an illegal
58 memory operand effective address in the CS, DS, ES, FS, or GS segments;
59 #SS(0) for an illegal address in the SS segment; #PF(fault-code) for a page
60 fault
62 <H2>Real Address Mode Exceptions</H2>
64 Interrupt 6; ARPL is not recognized in Real Address Mode
66 <H2>Virtual 8086 Mode Exceptions</H2>
68 Same exceptions as in Real Address Mode; #PF(fault-code) for a page fault
71 <P>
72 <HR>
73 <P>
74 <B>up:</B> <A HREF="c17.htm">
75 Chapter 17 -- 80386 Instruction Set</A><BR>
76 <B>prev:</B><A HREF="AND.htm"> AND Logical AND</A><BR>
77 <B>next:</B><A HREF="BOUND.htm"> BOUND Check Array Index Against Bounds</A>
78 </BODY>