1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1987                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6         *                                                         *
  7         * Copyright (c) 1972 by Massachusetts Institute of        *
  8         * Technology and Honeywell Information Systems, Inc.      *
  9         *                                                         *
 10         *********************************************************** */
 11 
 12 
 13 wired_plm: proc ();
 14 
 15 /* RE Mullen, v2pl1, oct 1973 */
 16 /* NSS by BSG */
 17 /* BSG for lockless scheduler and global events, 9/20/77 */
 18 /* Modified 03/21/81, W. Olin Sibert, for ADP PTW formats */
 19 /* Metering added 04/17/81, WOS */
 20 /* No PD, 07/25/83, E. N. Kittlitz */
 21 
 22 dcl  apt_ptr ptr parameter;
 23 
 24 dcl  rastep bit (18) aligned;
 25 dcl  i fixed bin;
 26 dcl (astep, ap) ptr;
 27 dcl  sstp pointer;
 28 dcl  ptp pointer;
 29 
 30 dcl 1 p based (ap),
 31     2 a (0 : 1) bit (18) unaligned;
 32 
 33 dcl  page$pread entry (ptr, fixed bin, fixed bin (35));
 34 dcl  page$lock_ptl entry ();
 35 dcl  page$unlock_ptl entry ();
 36 
 37 dcl  pds$processid bit (36) aligned external static;
 38 dcl  pds$apt_ptr ptr external static;
 39 dcl  sst$astsize fixed bin external static;
 40 dcl  sst$astap pointer external static;
 41 dcl  sst$cmp pointer external static;
 42 dcl  sst$wired fixed bin external static;
 43 dcl  sys_info$system_type fixed bin external static;
 44 dcl  tcm$loading_page_waits fixed bin (35) external static;
 45 
 46 dcl  sst_seg$ external static;
 47 
 48 dcl (addr, addrel, ptr, rel) builtin;
 49 
 50 /* ^L */
 51 
 52 /* LOAD: Entry to load a process by wiring down all critical pages
 53    needed by the process. */
 54 
 55 wired_plm$load: entry (apt_ptr);
 56 
 57           aptep = apt_ptr;                                  /* Copy args */
 58           sstp = addr (sst_seg$);
 59           ap = addr (apte.asteps);                          /* get pointer to asteps array */
 60 
 61           call page$lock_ptl;
 62 
 63           do i = 0 to 1;                                    /* loop over the asteps */
 64                rastep = ap -> p.a (i);                      /* get i-th rel pointer */
 65                if rastep then do;                           /* if rel pointer non zero */
 66                     astep = ptr (sstp, rastep);
 67                     ptp = addrel (astep, sst$astsize);      /* get pointer to page table */
 68 
 69                     call load_this_page ();
 70                     end;
 71                end;                                         /* of loop through asteps */
 72 
 73           call page$unlock_ptl;
 74 
 75           return;                                           /* All done */
 76 
 77 /* ^L */
 78 
 79 load_this_page: proc ();
 80 
 81 dcl  wired_bit bit (1) aligned;
 82 dcl  os_bit bit (1) aligned;
 83 dcl  valid_bit bit (1) aligned;
 84 dcl  wait_event fixed bin (35);
 85 
 86 
 87           if sys_info$system_type = ADP_SYSTEM then do;     /* Get the interesting bits */
 88                valid_bit = adp_ptw.valid;
 89                os_bit = adp_ptw.os;
 90                wired_bit = adp_ptw.wired;
 91                end;
 92 
 93           else do;
 94                valid_bit = l68_ptw.valid;
 95                os_bit = l68_ptw.os;
 96                wired_bit = l68_ptw.wired;
 97                end;
 98 
 99           if ^wired_bit then do;                            /* If not already wired, wire it */
100                if sys_info$system_type = ADP_SYSTEM then
101                     adp_ptw.wired = "1"b;
102                else l68_ptw.wired = "1"b;
103                sst$wired = sst$wired + 1;
104                end;
105 
106           if ^valid_bit then do;                            /* Not now in core */
107                if os_bit then                               /* But should be arriving any minute now */
108                     wait_event = binary (rel (ptp), 18);
109                else call page$pread (astep, 0, wait_event); /* Otherwise, ask for it */
110 
111                if wait_event > 0 then                       /* Have an event, remember to wait for it */
112                     apte.wait_event = bit (bin (wait_event, 36), 36);
113 
114                if wait_event > 262143 then;                 /* Global event -- ignore it */
115                else do;                                     /* It will end up here, so notify */
116                     if sys_info$system_type = ADP_SYSTEM then
117                          cmep = addr (sst$cmp -> cma (adp_core_ptw.frame));
118                     else cmep = addr (sst$cmp -> cma (l68_core_ptw.frame));
119                     cme.notify_requested = "1"b;
120                     end;
121 
122 /* THIS IS COMMENTED OUT until there is room in tcm for the new metering cell -- WOS, 04/17/81
123                tcm$loading_page_waits = tcm$loading_page_waits + 1; /* Meter */
124                end;
125 
126           return;
127           end load_this_page;
128 
129 %page; %include apte;
130 %page; %include cmp;
131 %page; %include "ptw.l68";
132 %page; %include "ptw.adp";
133 %page; %include system_types;
134 
135      end wired_plm;