PROTECTION

t

 

SS:SP

 

 

HIGHER

 

FROM TSS

OLO SS

 

ADDRESSES

 

 

 

 

 

 

 

 

 

 

OLDSP

DIRECTION

 

 

 

 

OF STACK

 

 

 

PARM3

GROWTH

 

 

 

 

 

 

 

PARM 2

 

 

PARM 3

 

PARM 1

 

 

PARM 2

 

OLDCS

 

 

PARM 1

 

OLDIP

 

LOWER

OLDSS:SP_....____...

NEW SS + SP

 

 

 

 

 

ADDRESSES

 

 

 

 

~

OLD STACK

 

NEW STACK

 

(AT "OUTER"

 

(AT "INNER"

 

PRIVILEGE

 

PRIVILEGE

 

 

LEVEL)

 

LEVEL)

 

G30108

Figure 7-12. Stack Contents after an Inter-Level Call

The old SS:SP value is then adjusted by the number of bytes indicated in the RET instruction and loaded into SS:SP. The new SP value is not checked for validity. If SP is invalid it is not recognized until the first stack operation. The SS:SP value of the returning program is not saved. (Note: this value normally is the same as that saved in the TSS.)

The last step in the return is checking the contents of the DS and ES descriptor register. If.DS or ES refer to segments whose DPL is greater than the new CPL (excluding conforming code segments), the segment registers are loaded with the null selector. Any subsequent memory reference that attempts to use the segment register containing the null selector will cause a general protection fault. This prevents less privileged code from accessing more privileged data previously accessed by the more privileged program.

7-21

Page 147
Image 147
Intel 80286, 80287 manual Stack Contents after an Inter-Level Call