User's Manual

THE
80286
INSTRUCTION SET
#SS
12 Stack Fault (Selector or Zero Error Code)
This exception
is
generated when a limit violation
is
detected in addressing through the SS register.
It
can occur on stack-oriented instructions such
as
PUSH or POP, as
well
as
other types
of
memory
references using
SS such
as
MOY AX,[BP+28].
It
also can occur on an
ENTER
instruction when
there
is
not enough space
on
the stack for the indicated local variable space, even
if
the stack exception
is
not triggered by pushing BP or copying the display stack. A stack exception can therefore indicate
a stack overflow, a stack underflow or a wild offset. The error code
will-
be zero.
#SS
is
also generated on an attempt to load SS with a descriptor that
is
marked not present but
is
otherwise valid. This can occur in a task switch, an inter-level call, an inter-level return, a
move
to the
SS
instruction or a pop to the SS instruction. The error code
will
be non-zero.
#SS
is
never generated when addressing through the DS or ES registers even if the offending register
points to the same segment
as
the SS register.
The
#SS exception handler must contain special code to complete the loading of segment registers.
The
DS and ES registers
will
not
be
fully loaded if a not-present condition
is
detected while loading
the
SS register. Therefore, the #SS exception handler should execute code such as the following to
insure full loading of the segment registers:
MOY AX,DS
MOYDS,AX
MOY AX,ES
MOYES,AX
Generally, the instruction causing #SS can be restarted, but there
is
one special case
when
it cannot:
when a
PUSHA
orPOPA
instruction attempts to wrap around the 64K boundary of a stack segment.
This condition
is
identified by the value of the saved SP, which can
be
either
OOOOH,
OOOIH;
OFFFEH,
or OFFFFH.
#TS
10
Invalid Task State Segment (Selector Error Code)
This exception
is
generated during a task switch when the
new
task state segment
is
invalid, that is,
when a task state segment
is
too small; when the LDT indicated
in
a TSS
is
invalid or
not
present;
when the
SS, CS, DS, or ES indicated
ina
TSS are invalid (task switch); when the back link in a TSS
is
invalid (inter-task IRET).
#TS
is
not generated when the SS, CS, DS, or ES back link or privileged stack selectors point
to
a
descriptor that
is
not present but otherwise
is
valid.
#NP
is generated
in
these cases.
The error code passed to the exception handler contains
the selector of the offending segment, which
caneitJIer be the
Task
State Segment itself, or it selector found within the Task State Segment.ยท
The instruction causing #TS can
be
restarted.
#TS must be handled through a task gate.
The exception handler must reset the busy bit
in
the
new
TSS.
8-11