User's Manual

inter
THE
80286
INSTRUCTION SET
IRET
-Interrupt
Return
Opcode
CF
CF
CF
Instruction
IRET
IRET
IRET
Clock.
17,pm=31
55
169
Description
Interrupt return (far return and pop flags)
Interrupt
return, lesser privilege
Interrupt return, different task
(NT=1)
"Add one clock for each byte in the next instruction executed.
FLAGS MODIFIED
Entire flags register popped from stack
FLAGS UNDEFINED
None
OPERATION
In real address mode, IRET
pops
IP, CS, and FLAGS from the stack in that order, and resumes the
interrupted routine.
In protected mode, the action of IRET depends
on
the setting of the Nested Task Flag (NT) bit in the
flag register. When popping the
new
flag image from the stack, note that the IOPL bits in the flag
register are changed only when CPL=O.
If
NT=O,
IRET returns from an interrupt procedure without a task switch. The code returned to must
be equally or
less
privileged than the interrupt routine as indicated by the RPL bits of the
CS
selector
popped from the stack.
If
the destination code
is
of less privilege, IRET then also pops SP and SS
from the stack.
If
NT=
1,
IRET reverses Jhe operation of a CALL or
INT
that caused a task switch.
The
task execut-
ing IRET has its updated state saved in its Task State Segment. This means that. if the task
is
re-
entered, the code that
follows
IRET
will
be executed.
The exact checks and actions performed by IRET in protected mode are given
on
the
following
page.
INTERRUPT RETURN:
If
Nested Task
Flag=1'then
RETURN FROM NESTED TASK:
Examine Back Link Selector in TSS addressed
by
the current Task Register:
Must specify
global in the local/global bit else
#TS
(new TSS selector)
Index
must be within GDT limits else
#TS
(new TSS selector)
AR
byte must specify TSS else
#TS
(new TSS selector)
New TSS must be busy else
#TS
(new TSS selector)
Task State Segment must be PRESENT else
#NP
(new TSS selector)
SWITCH_TASKS
without nesting
to
TSS specified by back link selector
Mark the task just abandoned as NOT BUSY
IP
must be in code segment limit else #GP(O)
B-51