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

Native Execution Mode
HP NonStop S-Series Server Description Manual520331-003
7-16
Far Jumps and Far Gateways Are Needed for SCr
Far Jumps and Far Gateways Are Needed for
SCr
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 (UCr and SLr), as well
as the interpreter and nonprivileged instruction set millicode, are in the last direct jump
area of user space. System code (SCr) 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 native code, each combined with gateway
tables—one in the 7E region and one at the end of SCr. (SCr has a gateway table, but
its gateways are degenerate because the process is already in privileged state when
running in SCr.) All calls to SCr, whether they originate in UCr, an SRL, or SLr, must
be routed through the far jump table in the gateway area. Any calls in the reverse
direction, from SCr, are only to SLr in user space. (Far jumps to millicode are placed
with the accelerated far jumps and gateways at the ends of SC and SL as described in
Section 6.)
Figure 7-8 illustrates five common cases of calls between the three main kinds of code
areas: user code (UCr), SLr, and SCr. Three of the calls originate in user code (calls to
A, B, and D), one in SLr (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 SLr. 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 SLr, and therefore requires a gateway table
entry. 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 SCr (dashed lines), the first jump is to the degenerate far gateway table
entry in SCr, which contains a jump-register instruction that jumps directly to B. The
degenerate gateway entry involves no privilege transition because the call is made
from privileged code, but must set a register to indicate that the caller was privileged
and no parameter copying is needed.
Procedure C is a privileged (but not callable) procedure located in SCr. It can be called
only by privileged code and therefore requires no gateway table entry. When it is
called from SLr, 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 SCr.