Object Code Accelerator Manual
Preparing Your Program for TNS/E Systems
Object Code Accelerator Manual—528144-003
2-8
Segment Wrapping
segment. For more information on how to access the system data segment, refer to the
section on privileged procedures in the TAL Reference Manual.
INT cpuno = 'SG' + 0; ! SG equivalencing
INT .EXT xcpuno; ! Extended pointer
PROCEDURE foo; ! Nonprivileged procedure
BEGIN
IF cpuno = 1 THEN ! TNS/E system traps
BEGIN ! TNS system accesses G[0]
! Lots of code
END;
@xcpuno := $XADR(cpuno);
IF xcpuno = 1 THEN ! TNS/E system traps
... ! TNS system accesses G[0]
END;
Segment Wrapping
If a nonprivileged program tries to allocate and operate on variables partially lying
across the end of the user data segment, results might differ depending on the system:
•
On TNS systems, the variable reference wraps back to the base of the user data
segment.
•
On TNS/E systems, the variable reference is unpredictable; it might wrap or trap.
Nonprivileged programs cannot access SG.
Required Change
•
Remove from your programs any constructs that result in segment wrapping.
Change addressing operations so that they stay fully within the segment.
Example
The following examples show addressing operations that might not wrap back on the
segment on TNS/E systems as they do on TNS systems.
STRUCT s(*);
BEGIN
INT i;
INT(32) d;
INT j;
END;
PROC exam;
BEGIN
INT .p (s);
STRUCT s2(s);
@p := -1; ! -1 = 65535 (unsigned), structure starts at
! the last word of the user data segment and
! goes past the end