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 tc_shutdown: proc;
14 
15 /* Modified by E Stone on 5/74 to call deactivate_segs rather than deact_proc and to turn wait enable on */
16 
17 dcl  aptptr ptr,                                            /* pointer to apt entry */
18      sstp ptr,                                              /* pointer to SST */
19      pds_astep ptr;                                         /* pointer to the aste for the pds of a process */
20 
21 dcl  i fixed bin,                                           /* variable used to loop through APT */
22      state fixed bin,                                       /* executation state of a process */
23      size fixed bin,                                        /* number of entries in APT */
24      length fixed bin;                                      /* number of words per apte */
25 
26 dcl  sst_seg$ fixed bin ext,
27      tc_data$apt_size fixed bin ext,
28      tc_data$apt_entry_size fixed bin ext,
29      tc_data$initializer_id ext bit (36) aligned,
30      tc_data$system_shutdown fixed bin ext,
31      tc_data$wait_enable fixed bin ext,
32      tc_data$apt fixed bin ext;
33 
34 dcl  deactivate_segs entry (ptr);
35 
36 dcl (addr, addrel, bin) builtin;
37 
38 % include apte;
39 
40 /* ^L
41    */
42 
43           tc_data$system_shutdown = 1;
44           tc_data$wait_enable = 0;                          /* make sure we are only process running */
45 
46           aptptr = addr (tc_data$apt);
47           size = tc_data$apt_size;
48           length = tc_data$apt_entry_size;
49           sstp = addr (sst_seg$);
50 
51 /* destroy all processes except initializer and idle processes */
52 
53           do i = 1 to size;
54                state = bin(aptptr -> apte.flags.state, 18);
55                if state = 0 | state = 5
56                     then go to end_apt_loop;
57                if aptptr -> apte.processid = tc_data$initializer_id
58                     then go to end_apt_loop;
59                if aptptr -> apte.flags.idle
60                     | aptptr -> apte.flags.hproc
61                     then go to end_apt_loop;
62                pds_astep = ptr (sstp, aptptr -> apte.asteps.pds);
63                call deactivate_segs (pds_astep);
64 
65 end_apt_loop:
66                aptptr = addrel (aptptr, length);
67           end;
68 
69 /*        return;                                 /* All done */
70 
71      end tc_shutdown;