BASIC INSTRUCTION SET

AAS (ASCII Adjust for Subtraction) changes the contents of register AL to a valid unpacked decimal number, and zeros the top 4 bits. AAS must always follow the subtraction of one unpacked decimal operand from another in AL. The carry flag will be set and AH decremented if a borrow was necessary.

Example: AAS

AAM (ASCII Adjust for Multiplication) corrects the result of a multiplication of two valid unpacked decimal numbers. AAM must always follow the multiplication of two decimal numbers to produce a valid decimal result. The high order digit will be left in AH, the low order digit in AL.

Example: AAM

AAD (ASCII Adjust for Division) modifies the numerator in AH and AL to prepare for the division of two valid unpacked decimal operands so that the quotient produced by the division will be a valid unpacked decimal number. AH should contain the high-order digit and AL the low-order digit. This instruction will adjust the value and leave it in AL. AH will contain O.

Example: AAD

3.11 TRUSTED INSTRUCTIONS

When operating in Protected Mode (Chapter 6 and following), the 80286 processor restricts the execu- tion of trusted instructions according to the Current Privilege Level (CPL) and the current value of 10PL, the 2-bit I/O privilege flag. Only a program operating at the highest privilege level (level 0) may alter the value of 10PL. A program may execute trusted instructions only when executing at a level that is at least as privileged as that specified by 10PL.

Trusted instructions control I/O operations, interprocessor communications in a multiprocessor system, interrupt enabling, and the HLT instruction.

These protection considerations do not apply in the real address mode.

3.11.1 Trusted and Privileged Restrictions on POPF and IRET

POPF (POP Flags) and IRET (Interrupt Return) are not affected by IOPL unless ihey aUempi io alter IF (flag register bit 9). To change IF, POPF must be part of a program that is executing at a privilege level greater than or equal.to that specified by 10PL. Any attempt to change IF when CPL ;::: 0 will be ignored (i.e., the IF flag will be ignored). To change the 10PL field, CPL must be zero.

3.11.2 Machine State Instructions

These trusted instructions affect the machine state control interrupt response, the processor hair siate, and the bus LOCK signal that regulates memory access in multiprocessor systems.

CLl (Clear Interrupt-Enable Flag) and STI (Set Interrupt-Enable Flag) alter bit 9 in the flag register. When IF=O, the processor responds only to internal interrupts and to non-maskable external inter- rupts. When IF= 1, the processor responds to all interrupts. An interrupt service routine might use these instructions to avoid further interruption while it processes a previous interrupt request. As with the other flag bits, the processor clears IF during initialization. These instructions may be executed only if CPL :::; 10PL. A protection exception will occur if they are executed when CPL > IOPL.

3-28

Page 84
Image 84
Intel 80287, 80286 Trusted Instructions, Trusted and Privileged Restrictions on Popf and Iret, Machine State Instructions