Accelerator Manual (G06.27+, H06.04+, J06.03+)

Preparing Your Program for TNS/R Systems
Accelerator Manual527303-003
2-8
Segment Wrapping
Example
The following TAL procedure tries to use the system value at address SG[0], but on a
TNS system, the procedure uses whatever is at address G[0] in the user data
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/R system traps
BEGIN ! TNS system accesses G[0]
! Lots of code
END;
@xcpuno := $XADR(cpuno);
IF xcpuno = 1 THEN ! TNS/R 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/R systems, the variable reference is unpredictable; it might wrap or trap.
Nonprivileged programs cannot access SG.
Required Change
Remove any constructs from your programs that result in segment wrapping.
Change addressing operations so that they stay fully within the segment.