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 /*
 14                               put_aste (astep)
 15 
 16 
 17 
 18 
 19 FUNCTION -
 20 
 21 The procedure "put_aste" frees  the  ASTE  pointed  to  by  the  input  argument
 22 "astep".  No matter if the ASTE was in the circular list or not, "put_aste" will
 23 put it in the list associated with the size of its  page  table,  at  the  first
 24 position.
 25 
 26 It  does  not  concern  itself  with  the  AST lock. It assumes there is no race
 27 condition. It is the responsibility of the caller to make sure no race condition
 28 exists. If called by the initializer or  shutdown,  it  may  be  called  without
 29 locking  the AST. In normal cases, however, the caller must make sure the AST is
 30 locked before issuing the call and it will be unlocked upon return as soon as it
 31 is safe to do so.
 32 
 33 All items of the ASTE are zeroed except fp, bp, ptsi and marker. All  PTW's  are
 34 initialized with a page not core flag and a coded null disk address.
 35 
 36 
 37 
 38 MODIFICATIONS -
 39 
 40 04/17/75  A. Bensoussan - Modified for the new storage system.
 41 03/21/81  W. Olin Sibert, for ADP PTW formats
 42 04/17/81  WOS -- remove ptw.os trap, convert for ptw_util_
 43 11/01/82  J. Bongiovanni, for synchronized segments
 44 84-01-16  BIM to zero aste counters.
 45 
 46 */
 47 
 48 
 49 put_aste: procedure (a_astep);
 50 
 51 
 52 dcl  a_astep        ptr;
 53 dcl (i, pts)        fixed bin(17);
 54 dcl  ptsi           fixed bin (3);
 55 dcl  ptp            ptr;
 56 dcl  pt             (1: pts) bit (36) aligned based;
 57 
 58 dcl  hc_dm_util$deactivate    entry (fixed bin (3));
 59 dcl  ptw_util_$make_null      entry (pointer, bit (22) aligned);
 60 dcl  thread$cin               entry (ptr, bit (18) unal);
 61 dcl  thread$out               entry (ptr, bit (18) unal);
 62 
 63 dcl (addr, addwordno, fixed, rel) builtin;
 64 
 65 ^L
 66 
 67           sstp = addr (sst_seg$);                           /* get pointers */
 68           astep = a_astep;                                  /* copy argument */
 69 
 70           ptsi = fixed (astep -> aste.ptsi, 2);             /* get page table size index */
 71           pts = sstp -> sst.pts (ptsi);                     /* get page table size */
 72 
 73 
 74           if aste.synchronized
 75                then call hc_dm_util$deactivate (ptsi);
 76 
 77           if sst.ausedp(ptsi) ^= rel(astep) then            /* If ASTE not first in list, make it first */
 78                do;
 79                if aste.fp ^= "0"b then                      /* If ASTE is in the list, take it out */
 80                     call thread$out (astep, sst.ausedp(ptsi));
 81                call thread$cin (astep, sst.ausedp(ptsi));   /* Put ASTE at the end of the list */
 82                sst.ausedp (ptsi) = rel (astep);             /* Move current ptr to ASTE to make it first */
 83                end;
 84 
 85           aste.pvtx = 0;                                    /* Set pvtx to zero (unvalid pvtx) to prevent emergency
 86                                                               shutdown from updatig the vtoce with wrong addresses */
 87 
 88           aste.np, aste.csl, aste.records = ""b;            /* counters are irrelevant */
 89 
 90 /* There used to be a trap here which inspected ptw.os for each PTW, crashing if it was
 91    found on, but this trap has outlived its usefulness. */
 92 
 93           ptp = addwordno (astep, sst.astsize);             /* Start with page zero */
 94 
 95           do i = 1 to pts;                                  /* Write coded null addresses in all PTW's */
 96                call ptw_util_$make_null (addr (ptp -> pt (i)) , put_aste_null_addr);
 97           end;
 98 
 99           astep -> aste_part.two = "0"b;                    /* Zero the ASTE except fb, bp, ptsi and marker */
100 
101           return;
102 
103 %page; %include sst;
104 %page; %include aste;
105 %page; %include null_addresses;
106 
107           end put_aste;