$PAGE "INCLMKPR -- Make'Present"                                        00010000
PROCEDURE MAKE'PRESENT (DSTNUM,OFFSET);   << HP3000 version.>>          00015000
VALUE   DSTNUM, OFFSET;                                                 00020000
INTEGER DSTNUM,       <<# of data segment to make present >>            00025000
        OFFSET;       <<Offset within data segment needed >>            00030000
OPTION PRIVILEGED,UNCALLABLE,INTERNAL;                                  00035000
                                                                        00040000
COMMENT                                                                 00045000
     Makes the specified data segment present in memory, if             00050000
     it is not already so, and returns pdisabled so that it             00055000
     stays present.  This procedure must be resident in the             00060000
     segment from which it is called so that an absence                 00065000
     fault does not occur when returning to caller.                     00070000
                                                                        00075000
     Inputs:                                                            00080000
        DSTNUM = Data segment number to be made present.                00085000
        OFFSET = Location within data segment that is needed.           00090000
                 (OFFSET is not used here but only included             00095000
                  for future expansion.)                                00100000
                                                                        00105000
     Outputs:  (none)                                                   00110000
                                                                        00115000
     Tables accessed:                                                   00120000
        DST:  Entry number DSTNUM of the DST, word 0,                   00125000
              field ABSENTFLAG.                                         00130000
              The data segment table is accessed via pointer            00135000
              DST which is equated to SYSGLOB word 2.                   00140000
                                                                        00145000
     External Dependencies:                                             00150000
        Procedure QueueOnObject.                                        00155000
                                                                        00160000
;                                                                       00165000
                                                                        00170000
BEGIN                                                                   00175000
INTEGER POINTER DST=2;       <<Pointer to base of the DST>>             00180000
INTEGER DSTINDEX;            <<Index of entry DSTN in the DST>>         00185000
                                                                        00190000
DEFINE                                                                  00195000
   ABSENTFLAG          = (0:1)#, << Absent bit in DST entry >>          00200000
   DST'OBJECT          = DOUBLE(DSTNUM)#,                               00205000
   DISABLE'INTERRUPTS  = ASSEMBLE(SED 0)#,                              00210000
   ENABLE'INTERRUPTS   = ASSEMBLE(SED 1)#,                              00215000
   PSEUDO'DISABLE      = ASSEMBLE(PSDB)#;                               00220000
                                                                        00225000
                                                                        00230000
DSTINDEX := DSTNUM & LSL(2); <<Multiply DSTN by 4>>                     00235000
DISABLE'INTERRUPTS;                                                     00240000
                             <<Loop til segment present>>               00245000
WHILE LOGICAL(DST(DSTINDEX).ABSENTFLAG) DO                              00250000
   BEGIN                                                                00255000
   ENABLE'INTERRUPTS;                                                   00260000
   QueueOnObject (DST'OBJECT);                                          00265000
   DISABLE'INTERRUPTS;                                                  00270000
   END;                                                                 00275000
                                                                        00280000
PSEUDO'DISABLE;         <<So it stays present.>>                        00285000
                                                                        00290000
<< Exit will return with the interrupts as they were before >>          00295000
<< calling Make'Present.                                    >>          00300000
                                                                        00305000
END;                         <<procedure MAKE'PRESENT>>                 00310000
$TITLE " "                                                              00315000
