Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 24
Allocating Extended Data Segments
Allocating a Selectable Segment
Using the SEGMENT_ALLOCATE_ procedure call, you can allocate one or more
selectable segments. Each selectable segment can be as many as:
127.5 megabytes long on G04.00 and earlier G-series releases and all D-series
releases
1120 megabytes long on G05.00 and all subsequent G-series releases
1536 megabytes long on all H-series and J-series releases
To allocate a selectable segment, you specify a segment ID, which is any number in
the range 0 through 1023, in the segment-ID parameter of the
SEGMENT_ALLOCATE_ procedure. You use the segment ID later when you make
the segment current.
You also specify the size of the segment in bytes and a variable to receive the address
of the segment base. The size and base address must be specified as 32-bit integers.
The following example allocates four selectable segments of 100,000 bytes each.
These selectable segments are identified by segment IDs 0 through 3:
FOR I := 0 TO 3 DO
BEGIN
SEGMENT^ID[I] := I;
SIZE := 100000D;
ERROR := SEGMENT_ALLOCATE_(SEGMENT^ID[I],
SIZE,
!swap^file^name:length!,
ERROR^DETAIL,
!pin!,
!segment^type!,
BASE^ADDRESS[I]);
IF ERROR <> 0 THEN CALL ERROR^HANDLER;
END;
The base-address output parameter returns the address of the start of the allocated
segment. This address is the same for all selectable segments.
The preceding example also specifies the optional error-detail parameter. This
parameter returns a value if the returned error parameter is nonzero. The
error-detail parameter qualifies the error value.
Allocating a Flat Segment
Using the SEGMENT_ALLOCATE_ procedure call, you can allocate one or more flat
segments. To allocate a flat segment, specify, at minimum, the following parameters in
the SEGMENT_ALLOCATE_ procedure call:
A unique segment ID, which is any number in the range 0 through 1023, in the
segment-ID parameter.