NonStop S-Series Server Description Manual (G06.24+)
TNS Execution Modes
HP NonStop S-Series Server Description Manual—520331-003
6-68
Resolving Virtual Addresses for External Calls
Resolving Virtual Addresses for External Calls
The preceding few topics assume that a P-register address is all that is needed to
identify the entry point of a procedure in memory. However, that is simply a word
address that is relative to the start of some TNS code segment; it does not tell you
where that address is in virtual memory. So, given a 16-bit word address for a
P-register address, what is the corresponding address in virtual memory?
The illustration shown in Figure 6-37, based on the example explained below,
illustrates how the resolution to virtual address is made. The process code is assumed
to be contained in the first four segments of the region. The segments use,
respectively, four pages, three pages, five pages, and four pages. (The first page in all
cases contains the procedure entry point table, PEP, and some of the code; the
external entry point table, XEP, is on the last page, with entries assigned backward
from the page boundary.) All addresses and offsets are hexadecimal numbers.
The first step is to identify the base address for the particular code space. As
explained in Section 4, Memory Addressing and Access, the four code spaces have
fixed starting addresses in the process address space. Three of them are in separate
regions of the nonprivileged space, and the system code (SC) is in the Kseg0 part of
the privileged space.
The four base addresses are:
UC %h 70000000
UL %h 72000000
SL %h 7A000000
SC %h 80000000
The example in the figure assumes that the user code is being addressed. Therefore,
the base address is %h 70000000.
The next step is to compute the segment offset. This is done by multiplying the space
ID (2, in this case, for segment 2) by the maximum possible segment size, which is
128 KB (20000 in hexadecimal) even for code segments that are not full. This gives an
offset of %h 40000.
The next step is to get a hexadecimal byte address for the relative address in the P
register. The byte address is obtained by shifting the word address one bit position.
The figure assumes that P contains %h 1080 (= %10200); the shifted address is
%h 2100—that is, %h 100 bytes into the third page. (A page is %h 1000 bytes.)
The final step is to add these three values together. In the example, the actual virtual
address is %h 70042100.