User's Manual

intel"
ADVANCED TOPICS
ASSEJIIBLER
INVOKED BV:
ASM286,86
:FS:5WHPl.AB6
LOC
DBJ
liB
DotD
DODD
ID
DOD'
IE
0002
II···
.
ODDS
81D8
0007
DF
0 0
C8
DDDA
2HC
DDOC
DFOI
o
DOE
.FA
DO
DF
3ID8 0 0 0 0
00'3
7
~
12
DO
IS
87050000
00'9
050800
DD'C
8ED8
ODIE
DD362C
0 0
0022
36DD26BOO
0027
0027
If
0028
58
0029
CF
LI
HE
SOURCE
'.1
"lllaC'Swltch
the
NPl
Cont!!!t
on
Ftrst
Use
Af.ter
"Task
Switch')
2
3
5'111
teh_npx_conhxt
~
5
publiC
nltch_"PCcontut
6
utrn
lut_npl_task
:word
Thl!
Interrupt
hlndler
'11111
!wltch
thl! NPI
cantu!
If
I new
tuk
15
attU'lpt1ng
to
US!
the
NPl
contelt
of
IInother
task
lifter
'a
'"k
7
8
9
'0
switch.
If
the
NPl
context
belong'
\0
the
current
tuk.
nothing
hlppens.
"
'2
13
,
~
'5
'6
'7
18
'9
20
f,
22
23
2
~
25
28
27
18
29
3D
3'
32
33
3
~
36
38
37
38
39
~
0
~
,
<2
H
~
.~
45.
~
6
47
~
8
~
9
SO
5'
52
53
.,
A
trap
ga\!
should
be
placed
In
IDT
entry
7
rehrrIng
to
thl!
routine.
The DPt of thl! Slltl! sholl.)d be 0
to
prevent
spoofing.
The"code
uglll!nt
mu
5t
be
at
pr
Iv
IItge
!eve
1
O.
The
kernel
~tl.Ct
15
u'!UlIIed
to
overley
the
TSS
Ind
the'HPI
uv'e
area
II
p
laced
at
the
end
of
the
TSS
artl.
II
globll
word
vlfllble
LAST_HPX_TASK
Ident1Hu
the
TSS
ulectar
of
thl
lilt
tilt
to
UII!
thl
HPX.
npl_IIVI_lrt!:1
eq,u
urd
,ptr
~
~
I
Off
II!
t
.f
HPX
live
Irel
.,
IIjut
tlrnll_udl
IIgmen
t
"
publIC
IW
1 t c
h_n
p
I_C
0 n t
IX
t
proc
far
'"
,ov
".
"d
c
1t
I
,I
omp
I'
xchg
odd
,ov
hne
f r
~
\0
r
llIme_iul:
p.p
p.p
lret
..
dl
IXtllg
11I'_npx_tllt
dl,
IX
IX,
dllll'
t_npl_ill
t
uml_tllt
IX
, d I l
III
t_
n p x_ t
II
k
11,8
dl,11
dl:npl_Ilve_lru
"lnpI_!IVI_lrll
d.
udp
weCO)
I
Savi
worHng
rlgllhr.
I 'Get,
Iddrul
of
Id
of
lI~t
HPI
'lit
Ge
t
Id
of
t
hI!
til
t
Rell'lGve
APL
Held
Cll1r
tilt
ulhhed
fllg
No
interrupti
1II0wedi
I
Sit
1 f 111111 \
II
k
Set
new
tuk
ld
ud
glt
old
Go
to
TSS
11111
"
Address
TSS
of
previoul
HPI
tllk
Sive
old
NPI
S\I\I
I
Get
current
NPX
state
I
Retllrn
to
Interrupted
program
TSS
S4
kerneLcode
ends
II.
WARNING
'160.
LINE
154,
SEGIHHT
CDHTAIHS
PRIVILEGED INSTRUCTIOHS
55
ud
Figure 11-3. Example
of
NPX
Context
Switching
When a program changes a descriptor that
is
shared with other processors, it should broadcast this fact
to
the other processors. This broadcasting can
be
done with
.an
inter-processor inierrupl. Tht;
hiii,;11;;,
for this interrupt must ensure that the segment registers, the LDTR and the TR, are re-Ioaded. This
happens automatically if the interrupt
is
serviced by a.task switch.
Modification of descriptors of shared segments in multi-processor systems
may
require that the on-chip
descriptors also
be
updated. For example,
one
processor may attempt
to
mark the descriptor of a shared
segment
as
not-present while another
is
using it. Software has
to
ensure that the descriptors
in
the
segment register caches are updated with the
new
information. The segment register caches can
be
11-6