Hardware Reference
In-Depth Information
The problem of moving programs that have already been linked and relocated
is intimately related to the time at which the final binding of symbolic names onto
absolute physical memory addresses is completed. When a program is written it
contains symbolic names for memory addresses, for example, BR L . The time at
which the actual main memory address corresponding to L is determined is called
the binding time . At least six possibilities for the binding time exist:
1. When the program is written.
2. When the program is translated.
3. When the program is linked but before it is loaded.
4. When the program is loaded.
5. When a base register used for addressing is loaded.
6. When the instruction containing the address is executed.
If an instruction containing a memory address is moved after binding, it will be
incorrect (assuming that the object referred to has also been moved). If the transla-
tor produces an executable binary as output, the binding has occurred at translation
time, and the program must be run at the address at which the translator expected it
to be run at. The linking method described in the preceding section binds symbolic
names to absolute addresses during linking, which is why moving programs after
linking fails, as shown in Fig. 7-16.
Two related issues are involved here. First, there is the question of when sym-
bolic names are bound to virtual addresses. Second, there is a question of when
virtual addresses are bound to physical addresses. Only when both operations have
taken place is binding complete. When the linker merges the separate address
spaces of the object modules into a single linear address space, it is, in fact, creat-
ing a virtual address space. The relocation and linking serve to bind symbolic
names onto specific virtual addresses. This observation is true whether or not vir-
tual memory is being used.
Assume for the moment that the address space of Fig. 7-14(b) is paged. It is
clear that the virtual addresses corresponding to the symbolic names A , B , C , and D
have already been determined, even though their physical main memory addresses
will depend on the contents of the page table at the time they are used. An ex-
ecutable binary program is really a binding of symbolic names to virtual addresses.
Any mechanism that allows the mapping of virtual addresses onto physical
memory addresses to be changed easily will facilitate moving programs around in
main memory, even after they have been bound to a virtual address space. One
such mechanism is paging. After a program has been moved in main memory,
only its page table need be changed, not the program itself.
A second mechanism is the use of a runtime relocation register. The CDC
6600 and its successors had such a register. On machines using this relocation
Search WWH ::




Custom Search