Guardian Programmer's Guide

Table Of Contents
Creating and Managing Processes
Guardian Programmer’s Guide 421922-014
16 - 8
Process Organization
of the Guardian procedures are in both sets. Sometimes there are distinct TNS and
native procedures having the same name and basic function, but more often a To-
RISC shell lets the native code serve both kinds of caller.
The SYSTEMENTRYPOINT procedure accepts names from the TNS set and returns
16-bit labels for TNS procedures and To-RISC shells in the system library. The
SYSTEMENTRYPOINT_RISC_ procedure accepts names from the native set and
returns 32-bit addresses for native procedures in the system library. Both procedures
are described in the Guardian Procedure Calls Reference Manual.
Data Spaces for TNS Processes
When a process is created, several data segments are allocated for its use. A TNS
process has the following data segments:
A user data segment, containing the program global data and the user data stack
for TNS procedures.
A main stack segment, containing the stack for unprivileged native procedures.
A priv stack segment, containing the stack for privileged native procedures.
A process file segment (PFS), used by the operating system.
The user data stack, in the TNS user data segment, is where the stack frame, or
activation record, is dynamically managed for each TNS procedure that is called. This
means that information, including formal parameters, a return address, and local data,
is put on the stack for each TNS procedure that is called; this information is removed
from the stack when the procedure finishes.
When TNS code calls a native procedure through its To-RISC shell, execution
automatically switches either to the main stack, for an unprivileged native procedure, or
to the priv stack, for a privileged native procedure. Execution switches back to the
TNS user data stack when the native procedure finishes.
The TNS user data segment has a fixed size that you can specify, up to 128 kilobytes
(
KB) of virtual memory. The lower 64 KB of this space, containing program global data
and the user data stack, is managed for you by the operating system. The remaining
64 KB is also available for use, but TAL and pTAL programs must manage the space
themselves. The Common Run-Time Environment (CRE) manages that area for
programs in other TNS languages.
If your TNS or accelerated program needs more than 128 KB of user data space, you
can
add extended data segments to your process. Section 17, Managing Memory,
provides details on how to add segments and perform other memory-management
activities.
Note. In TNS and accelerated programs, some portion of the user data stack might be used
for managing data for system procedure calls. TNS and accelerated programs should allow at
least 700 bytes of the user data stack for use by system procedure calls.