1 /****^  ******************************************************
 2         *                                                    *
 3         * Copyright, (C) Honeywell Bull Inc., 1987           *
 4         *                                                    *
 5         * Copyright (c) 1987 by Massachusetts Institute of   *
 6         * Technology and Honeywell Information Systems, Inc. *
 7         *                                                    *
 8         * Copyright (c) 1972 by Massachusetts Institute of   *
 9         * Technology and Honeywell Information Systems, Inc. *
10         *                                                    *
11         ****************************************************** */
12 
13 initialize_kst: proc ();
14 
15 /* Initialize_kst is called during system initialization and process creation
16    to initialize the Known Segment Table and the Reference Name Table.
17 
18    LAST MODIFIED:
19    Feb 1983 by E. N. Kittlitz to set kst.allow_256K_connect for inzr
20    Nov 1979 by Mike Grady to set pds$max_lot_size to kst size for inzr
21    June 1979 by Mike Grady to not set stack_base_segno to pds for stack sharing
22    September 1977 by B. Greenberg to keep Initialhzer KST below initsegs during initialization.
23    March 1977 by M. Weaver to move rnt, search rule initialization to makestack
24    October 1975 by R. Bratt to not preinitialize all kstes
25    October 1975 by R. Bratt for prelinking
26    March 1975 by R. Bratt for the new KST / RNT
27 
28    USAGE: - - - call initialize_kst();
29 
30    */
31 
32 % include kst;
33 % include slt;
34 
35 dcl (baseno, addr, fixed, string) builtin;
36 
37 
38 dcl  first_time bit (1),
39      this_is_initializer bit (1),
40      highseg fixed bin,
41      i fixed bin;
42 
43 dcl  kst_seg$ ext,
44      slt$ ext,
45      pds$max_lot_size (0:7) fixed bin ext,
46      pds$processid bit (36) aligned ext,
47      tc_data$initializer_id bit (36) aligned ext,
48 
49      dseg$ (0: 1) fixed bin (71) ext,
50      active_all_rings_data$stack_base_segno fixed bin (18) ext, /* segno of first stack segment */
51     (active_all_rings_data$hcscnt, active_all_rings_data$max_segno) ext fixed bin (17),
52      pds$ fixed bin ext;
53 
54 ^L
55           kstp = addr (kst_seg$);                           /* Get a pointer to the KST seg */
56           this_is_initializer = (pds$processid = tc_data$initializer_id); /* set initializer flag */
57 
58           if this_is_initializer then
59                if kst.lowseg ^= 0 then
60                     first_time = "0"b;
61                else first_time = "1"b;
62 
63           if this_is_initializer & first_time then do;
64                highseg = addr (slt$) -> slt.first_init_seg - 1;
65                kst.allow_256K_connect = "1"b;
66           end;
67           else highseg = active_all_rings_data$max_segno;
68 
69           if this_is_initializer & ^first_time then do;
70                kst.highseg = highseg;                       /* Expand mx limit, init segs gone. */
71                pds$max_lot_size (*) = highseg + 1;
72                return;
73           end;
74 
75           pds$kstp = kstp;                                  /* initialize pointer to kst */
76           if string (kst.prelinked_ring) = "0"b
77           then do;                                          /* only initialize if not prelinked process */
78                kst.lowseg = active_all_rings_data$hcscnt;
79                if kst.highseg = 0 then kst.highseg = highseg;
80                kst.highest_used_segno = kst.lowseg + 7;
81                kst.free_list = "0"b;
82                                                             /* reserve kstes for stacks */
83                do i = kst.lowseg to kst.lowseg + 7;
84                     kst.kst_entry (i).fp = (18)"1"b;
85                     kst.kst_entry (i).segno = i;
86                end;
87           end;
88 
89           return;
90 
91 
92 
93      end initialize_kst;