Microprocessor User's Manual

OVERVIEW OF THE 80C186 FAMILY ARCHITECTURE
2-14
Figure 2-9. Dynamic Code Relocation
To be dynamically relocatable, a program must not load or alter its segment registers and must
not transfer directly to a location outside the current code segment. All program offsets must be
relative to the segment registers. This allows the program to be moved anywhere in memory, pro-
vided that the segment registers are updated to point to the new base addresses.
Code
Segment
Stack
Segment
Data
Segment
Extra
Segment
Stack
Segment
Data
Segment
Extra
Segment
Before
Relocation
After
Relocation
Free Space
Code
Segment
CS
SS
DS
ES
CS
SS
DS
ES
A1039-0A