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

TNS Execution Modes
HP NonStop S-Series Server Description Manual520331-004
6-32
Procedure Attributes
Procedure Attributes
Some procedures use privileged instructions in performing certain operations. Those
procedures can switch the processor into privileged mode (and thus be able to execute
the privileged instructions) only if they have the required procedure attribute. Every
procedure has one of the following attributes:
In the procedure entry point (PEP) table, procedure entry points are grouped according
to attribute. There are three groups: the first is all nonprivileged procedures, the
second is all callable procedures, and the last is all privileged procedures. This
grouping is shown in Figure 6-19.
Because application programs rarely contain privileged code, PEP tables in user code
and user library segments (UC and UL) generally have only the first group—that is, all
procedures are nonprivileged. However, system library segments (SL) do have all
three groups. System code segments (SC) have only the callable and privileged
groups.
The first two words (TNS words) in the PEP table, C[0:1], describe where the callable
and privileged entry points begin in the PEP table. Specifically, C[0] is the address of
the first PEP entry for a callable procedure, and C[1] is the address of the first PEP
table entry for a privileged procedure. These words are used to check whether a
nonprivileged caller is attempting to invoke a privileged procedure. In the case where
all procedures are nonprivileged, both of these addresses point just past the end of the
PEP table (plus 1), so that any reference beyond the end of this table is invalid
(invokes the privileged mode trap).
Nonprivileged Procedures having this attribute can be called by any procedure.
They execute in the same mode (privileged or nonprivileged) as the
calling procedure. This is the attribute typically given to procedures
in an application program.
Callable Procedures having this attribute can also be called by any
procedure, but they execute in privileged mode (that is, PRIV = 1 in
the Environment register). The caller’s mode is restored when a
callable procedure exits. This attribute is typically assigned only to
operating system procedures. It is used so that a controlled, secure
interface exists between a nonprivileged application program and
the privileged operating system.
Privileged Privileged procedures execute in privileged mode and are callable
only by procedures currently executing in privileged mode. An
attempt by a nonprivileged procedure to call a privileged procedure
results in one of several possible traps when the first privileged
instruction or operation is encountered. This attribute should be
used only by the operating system. It is typically used when the
procedure uses privileged instructions which, if used improperly,
might have an adverse effect on processor or system operation.