NonStop S-Series Server Description Manual (G06.24+)

TNS Execution Modes
HP NonStop S-Series Server Description Manual520331-003
6-80
Far Jump Tables
Far Jump Tables
In computing a 32-bit PC address from the 26-bit target field of a RISC jump
instruction, the RISC processor takes the four high-order bits from the current program
counter value. That fact results in 16 possible direct jump areas in the 4-GB virtual
address space, each being 256 megabytes. Most process code (UC, UL, and SL), as
well as the interpreter and nonprivileged instruction set millicode, are in the last direct
jump area of user space. System code (SC) and some privileged millicode, however,
are in the first direct jump area of kernel space. Jumps between these two areas are
accomplished by means of far jumps.
A far jump is an entry in a far jump table consisting of four or more RISC instructions.
These instructions use a full 32-bit target address to enable crossing the boundaries of
direct jump areas.
There are only two far jump tables for accelerated code, both built by SYSGENR. One
is at the end of the accelerated code of SL and is combined with SLs gateway table,
and the other is at the end of SC. (SC has no need of a gateway table.) All calls to SC
(or Kseg0 millicode), whether they originate in UC, UL, or SL, must be routed through
the single far jump table in SL. Any calls in the reverse direction, from SC, would only
be to SL (or the millicode in user space).
Figure 6-43 illustrates five common cases of calls between the three main kinds of
code areas: user code (UC or UL), SL, and SC. Three of the calls originate in user
code (calls to A, B, and D), one in SL (call to C), and one originates in system code
(another call to B). The labels FJ, GW, and GW + FJ designate whether the entry is a
far jump table entry, a gateway table entry, or a combined entry, respectively.
Procedure A is a nonprivileged procedure located in SL. Because it requires no
privileged mode transition, it requires no gateway table entry, and because it is in the
same direct jump area as the example call, it requires no far jump table entry.
Procedure B is a callable procedure in SL. Because this procedure is callable, a
gateway table entry is required. When the procedure is called from user code, the call
must jump first to the gateway table entry. As described in the preceding topic, this
indirect access makes the privileged-mode transition before jumping to the procedure.
However, when B is called from SC (dashed lines), the first jump is to the far jump
table entry in SC, which contains a jump-register instruction that jumps directly to B,
ignoring the gateway table because any code that runs in SC is already privileged.
Procedure C is a privileged (but not callable) procedure located in SC. It can be called
only by privileged code and therefore requires no gateway table entry. When it is
called from SL, the call jumps first to the far jump table entry for procedure C; the final
instruction of this entry completes the jump to procedure C code in SC.
Procedure D is both callable (requiring a gateway table entry) and located in SC
(requiring a far jump table entry). Both entries are combined, including the instructions
needed for both functions, and including the jump instruction that completes the jump
to procedure D.