Download WINDOWS ASSEMBLY LANGUAGE & SYSTEMS PROGRAMMING

Transcript
28 Windows Assembly Language & Systems Programming
The CPU will only have to look in the shadow register to find out
the starting address of the segment (plus some other information)
and can then go ahead and put together the full 32-bit address for
fetching the instruction.
The CPU will add the base address to the offset IP and get a 32-bit
address that can be put onto the address bus.
Descriptors
I have introduced the descriptor as being an entry in the GDT or
LDT. There are various types of descriptors, but the most
common is the normal addressing type that we have been
discussing so far.
Each descriptor is 8 bytes in size, and Figure 1.13 shows what a
normal descriptor looks like.
Figure 1.13: Descriptor format.
64
55
base+
39
47
# access base
15
limit
0
I
Size of
segment.
“Base” is the address
Normally set
of
the segment.
to zero on the
286.
“Base+” extends the base segment addressing beyond
24 bits. “#“extends the limit beyond 64K.
AC&?SS field
The access byte in Figure 1.13 has various flags and codes. It has
a two-bit DPL field (Descriptor Privilege Level) that determines
the privilege level of the segment. It has P (Present) and A
(Accessed) bits that are used for moving the segments in and out
of memory. There are R (Read) and W (Write) bits that set
constraints on reading and writing the segment. There is also the
C (Conforming) bit and ED. The latter is set if the segment is a
stack.
I go into the description of the descriptor in far greater detail in
Chapter 12.
386 Paging
There are two paging modes in the 386. One is built on top of the
descriptor tables, and the other, called virtual-86, does away with
the descriptor tables altogether.