User's Manual

CHAPTER 6
MEMORY MANAGEMENT
AND
VIRTUAL
ADDRESSING
In Protected Virtual Address Mode, the 80286 provides an advanced architecture that retains substan-
tial compatibility with the
8086 and other processors
in
the 8086 family. In many respects, the baseline
architecture of the processor remains constant regardless of the mode of operation. Application
programmers continue to
use
the same set of instructions, addressing modes, and data types
in
Protected
Mode as
in
Real Address Mode.
The major difference between the
two
modes of operation
is
that the Protected Mode provides system
programmers with additional architectural features, supplementary to the baseline architecture, that
can be used to good advantage
in
the design and implementation of advanced systems. Especially
noteworthy are the mechanisms provided for memory management, protection, and multitasking.
This chapter focuses
on
the memory management mechanisms of Protected Mode; the concept of a
virtual address and the process of virtual-to-physical address translation are described
in
detail
in
this
chapter. Subsequent chapters deal with other key aspects of Protected Mode operation. Chapter 7
discusses the issue of protection and the integrated mechanisms that support a system-wide protection
policy. Chapter 8 discusses the notion of a task and.its central role
in
the 80286 architecture. Chapters
9 through
11
discuss certain additional
topics-interrupt
handling, special instructions, system initial-
ization,
etc.-that
complete the system programmer's
view
of 80286 Protected Mode.
6.1 MEMORY MANAGEMENT OVERVIEW
A memory management scheme interposes a mapping operation between logical addresses
(Le.,
addresses
as
they are viewed
by
programs) and physical addresses (i.e., actual addresses
in
real memory). Since
the logical address spaces are independent of physical memory (dynamically relocatable), the mapping
(the assignment of real address space to virtual address space)
is
transparent
to
software. This allows
the program development tools (for static systems) or the system software (for reprogrammable systems)
to control the allocation of space in real memory without regard to the specifics of individual programs.
Application programs may be translated and loaded independently since they deal strictly with virtual
addresses. Any program can be relocated to use any available segments of physical memory.
The
80286, when operated
in
Protected Mode, provides an efficient on-chip memory management
architecture. Moreover,
as
described in Chapter
11,
the 80286 also supports the implementation of
virtual memory
systems-that
is,
systems that dynamically swap chunks of code and data between real
memory and secondary storage devices (e.g., a disk) independent of and transparent to the executing
application programs. Thus, a program-visible address
is
more aptly termed a virtual address rather
than a logical address since it may actually refer to a location not currently present
in
real memory.
Memory management, then, consists of a mechanism for mapping the virtual addresses that are visible
to the program onto the physical addresses of real memory. With the
80286, segmentation
is
the key
to virtual memory addressing. Virtual. memory
is
partitioned into a number of individual segments,
which are the units of memory that are mapped into physical memory and swapped
to
and from
secondary storage devices. Most of this chapter
is
devoted to a detailed discussion of the mapping and
virtual memory mechanisms of the
80286.
The concept of a task also plays a significant role
in
memory management since distinct memory
mappings may be assigned
to
the different tasks
in
a multitask or multi-user environment. A complete
discussion of tasks
is
deferred until Chapter
8,
"Tasks and State Transition." For present purposes, it
6-1