Various checks on consistency are performed, to ensure that the requested sizes for the text, data and stack are reasonable.
Note that a non-zero value for “sep” implies separate mappings for the text area (“i” space) and the data area (“d” space). This is never possible on the PDP11/40;
“a” defines the address of a segment relative to an arbitrary base of zero. “ap” and “dp” point to the set of prototype segmentation address and descriptor registers respectively.
The first eight of each of these sets are intended to refer to “i” space, and
“nt” measures the number of 32 word blocks needed for the text segment. If “nt” is non-zero, one or more pages must be allocated for this purpose.
Where more than one page is allocated, all but the last will consist of 128 blocks (4096 words), and will be read only, and will have relative addresses starting at zero and increasing successively by 128.
If some fraction of a page of text is still to be assigned, allocate the appropriate part of the next page;
if “i” and “d” spaces are being used separately, mark the segmentation registers for the remaining “i” pages as null;
“a” is reset because all remaining addresses refer to the data area (not the text area) and are relative to the beginning of this area. The first “USIZE” blocks of this area are reserved for the “per process data area”;
The stack area is allocated from the top of the address space towards the lower addresses (“downwards”);
If a partial page must be allocated for the stack area, it is the high address art of the page which is valid. (For text and data areas, which grow “upwards”, it is the lower part of a partial page which is valid.) This requires an extra bit in the descriptor, hence “ED” (“expansion downwards”);
If separate “i” and “d” spaces are not used, only the first eight of the sixteen prototype register pairs will have been initialised by this point. In this case, the second eight are copied from the first eight.