COMPILATION LISTING OF SEGMENT flush Compiled by: Multics PL/I Compiler, Release 27d, of October 11, 1982 Compiled at: Honeywell LISD Phoenix, System M Compiled on: 11/15/82 1743.4 mst Mon Options: optimize map 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 4* * * 5* * Copyright (c) 1972 by Massachusetts Institute of * 6* * Technology and Honeywell Information Systems, Inc. * 7* * * 8* *********************************************************** */ 9 10 11 flush: proc; 12 13 /* Program to flush the contents of main memory by touching a 14* sufficient number of pages in temporary segments created for 15* this purpose. The number of pages to flush is determined 16* from sst$nused (it defaults to 1024 is the user does not 17* have sufficient access to examine sst$nused). The temporary 18* segments are named flush., and they are 19* created either in thr process directory (the default) or in 20* a directory supplied by the user via the -temp_dir control 21* argument. In order for all pages of main memory to be flushed, 22* the directory used must have sufficient quota (the aggregate 23* quota used by the temporary segments is the value of sst$nused). 24* There is a mildly interesting hack to prevent a fatal process 25* error if the temporary directory is the process directory and 26* there is not enough quota to flush all of main memory. 27* Prior to the flush, the next page of the stack is written to, 28* ensuring that there's enough stack to do the minimal condition 29* handling if a reqord quota overflow occurs. 30* 31* Completely rewritten by J. Bongiovanni in June 1981 */ 32 33 34 /* Automatic */ 35 36 dcl arg_no fixed bin; /* current argument number */ 37 dcl argl fixed bin (21); /* length of current argument */ 38 dcl argp ptr; /* pointer to current argument */ 39 dcl code fixed bin (35); /* standard error code */ 40 dcl dir_name char (168); /* name of directory for temp segments */ 41 dcl flush_seg_no pic "zzzz9"; /* for constructing temp segment names */ 42 dcl garbage fixed bin (35); /* just what it says */ 43 dcl n_args fixed bin; /* number of arguments */ 44 dcl n_flush_segs fixed bin; /* number of temporary segs */ 45 dcl n_pages fixed bin; /* number of pages in memory to flush */ 46 dcl n_pages_flushed fixed bin; /* count of pages flushed */ 47 dcl n_pages_left fixed bin; /* used in creating temp segs */ 48 dcl other_error bit (1); /* ON => seg_fault_error occurred during flush */ 49 dcl pages_per_seg fixed bin; /* number of pages per segment */ 50 dcl pagex fixed bin; /* index to array of pages */ 51 dcl quota_overflow bit (1); /* ON => RQO occurred during flush */ 52 dcl segx fixed bin; /* index into control structure */ 53 dcl tempp ptr; /* pointer to temp seg */ 54 55 /* Static */ 56 57 dcl DEFAULT_PAGES_TO_FLUSH fixed bin int static options (constant) init (1024); 58 dcl MYNAME char (5) int static options (constant) init ("flush"); 59 dcl TEMP_SEG_PREFIX char (6) int static options (constant) init ("flush."); 60 61 /* Based */ 62 63 dcl arg char (argl) based (argp); /* current argument */ 64 dcl 1 flush_segs aligned based (tempp), /* control structure */ 65 2 n_segs fixed bin, /* number of temp segs */ 66 2 segs (0 refer (n_segs)), 67 3 segp ptr, /* pointer to segment */ 68 3 seg_pages fixed bin; /* number of pages to touch in this seg */ 69 dcl 1 segment aligned based, /* used for touching pages during flush */ 70 2 page (256), 71 3 word (1024) fixed bin (35); 72 73 /* Entry */ 74 75 dcl absolute_pathname_ entry (char(*), char(*), fixed bin(35)); 76 dcl com_err_ entry options (variable); 77 dcl cu_$arg_count entry (fixed bin, fixed bin(35)); 78 dcl cu_$arg_ptr entry (fixed bin, ptr, fixed bin(21), fixed bin(35)); 79 dcl get_pdir_ entry() returns(char(168)); 80 dcl get_temp_segment_ entry (char(*), ptr, fixed bin(35)); 81 dcl hcs_$delentry_seg entry (ptr, fixed bin(35)); 82 dcl hcs_$make_seg entry (char(*), char(*), char(*), fixed bin(5), ptr, fixed bin(35)); 83 dcl ioa_$ioa_switch entry options (variable); 84 dcl release_temp_segment_ entry (char(*), ptr, fixed bin(35)); 85 dcl ring_zero_peek_$by_definition entry (char(*), char(*), fixed bin(18), ptr, fixed bin(19), fixed bin(35)); 86 87 /* External */ 88 89 dcl error_table_$badopt fixed bin (35) external; 90 dcl iox_$error_output ptr external; 91 dcl sys_info$max_seg_size fixed bin (19) external; 92 dcl sys_info$page_size fixed bin external; 93 94 /* Condition */ 95 96 dcl cleanup condition; 97 dcl record_quota_overflow condition; 98 dcl seg_fault_error condition; 99 100 /* Builtin */ 101 102 dcl addr builtin; 103 dcl ltrim builtin; 104 dcl null builtin; 105 dcl stackframeptr builtin; 106 107 108 /* Pick up arguments and validate */ 109 110 dir_name = get_pdir_ (); /* default temp dir = [pd] */ 111 112 call cu_$arg_count (n_args, code); 113 if code ^= 0 then do; /* active function not allowed */ 114 call com_err_ (code, MYNAME); 115 return; 116 end; 117 118 do arg_no = 1 to n_args; 119 call cu_$arg_ptr (arg_no, argp, argl, code); 120 if arg = "-temp_dir" | arg = "-td" then do; 121 arg_no = arg_no + 1; 122 call cu_$arg_ptr (arg_no, argp, argl, code); 123 if code^= 0 then do; 124 call com_err_ (code, MYNAME, "Temp directory name"); 125 return; 126 end; 127 call absolute_pathname_ (arg, dir_name, code); 128 if code ^= 0 then do; 129 call com_err_ (code, MYNAME, arg); 130 return; 131 end; 132 end; 133 else do; 134 call com_err_ (error_table_$badopt, MYNAME, arg); 135 return; 136 end; 137 end; 138 139 140 /* Get a temp segment for the control structure. Find out how many pages 141* we should flush, and create the temporary segments needed in the 142* appropriate directory */ 143 144 tempp = null (); 145 on cleanup call clean_out; 146 147 call get_temp_segment_ (MYNAME, tempp, code); 148 if code ^= 0 then do; 149 call com_err_ (code, MYNAME, "Getting temp segment"); 150 call clean_out; 151 return; 152 end; 153 154 call ring_zero_peek_$by_definition ("sst", "nused", 0, addr (n_pages), 1, code); 155 if code ^= 0 then 156 n_pages = DEFAULT_PAGES_TO_FLUSH; 157 158 pages_per_seg = divide (sys_info$max_seg_size, sys_info$page_size, 17); 159 n_flush_segs = divide (n_pages, pages_per_seg, 17); 160 n_pages_left = n_pages; 161 do segx = 1 to n_flush_segs; 162 flush_seg_no = segx; 163 call hcs_$make_seg (dir_name, TEMP_SEG_PREFIX || ltrim (flush_seg_no), "", 164 01010b, flush_segs.segs (segx).segp, code); 165 if flush_segs.segs (segx).segp = null () then do; 166 call com_err_ (code, MYNAME, "Creating ^[>^1s^;^a>^]^a", 167 (dir_name = ">"), dir_name, TEMP_SEG_PREFIX || ltrim (flush_seg_no)); 168 call clean_out; 169 return; 170 end; 171 flush_segs.segs (segx).seg_pages = min (pages_per_seg, n_pages_left); 172 flush_segs.n_segs = segx; 173 n_pages_left = n_pages_left - flush_segs.segs (segx).seg_pages; 174 end; 175 176 177 /* Do the flush, after making sure there's enough stack to handle a 178* record_quota_overflow condition */ 179 180 stackframeptr () -> segment.page (2).word (1) = 1; 181 quota_overflow = "0"b; 182 other_error = "0"b; 183 184 on record_quota_overflow begin; 185 quota_overflow = "1"b; 186 goto END_FLUSH; 187 end; 188 189 on seg_fault_error begin; /* most likely out of room on LV */ 190 other_error = "1"b; 191 goto END_FLUSH; 192 end; 193 194 n_pages_flushed = 0; 195 196 do segx = 1 to n_flush_segs; 197 do pagex = 1 to flush_segs.segs (segx).seg_pages; 198 garbage = flush_segs.segs (segx).segp -> segment.page (pagex).word (1); 199 n_pages_flushed = n_pages_flushed + 1; 200 end; 201 end; 202 203 END_FLUSH: 204 revert record_quota_overflow; 205 call clean_out; 206 207 if quota_overflow then 208 call ioa_$ioa_switch (iox_$error_output, 209 "Insufficient quota for full flush - flushed ^d out of ^d pages", 210 n_pages_flushed, n_pages); 211 212 if other_error then 213 call ioa_$ioa_switch (iox_$error_output, 214 "Error during flush - flushed ^d out of ^d pages", 215 n_pages_flushed, n_pages); 216 217 return; 218 219 220 /* Internal procedure to clean up after ourselves */ 221 222 clean_out: 223 proc; 224 225 if tempp ^= null () then do; 226 do segx = 1 to flush_segs.n_segs; 227 call hcs_$delentry_seg (flush_segs.segs (segx).segp, code); 228 end; 229 call release_temp_segment_ (MYNAME, tempp, code); 230 tempp = null (); 231 end; 232 233 end clean_out; 234 235 236 end flush; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/15/82 1526.2 flush.pl1 >dumps>old>recomp>flush.pl1 NAMES DECLARED IN THIS COMPILATION. IDENTIFIER OFFSET LOC STORAGE CLASS DATA TYPE ATTRIBUTES AND REFERENCES (* indicates a set context) NAMES DECLARED BY DECLARE STATEMENT. DEFAULT_PAGES_TO_FLUSH constant fixed bin(17,0) initial dcl 57 ref 155 MYNAME 000002 constant char(5) initial unaligned dcl 58 set ref 114* 124* 129* 134* 147* 149* 166* 229* TEMP_SEG_PREFIX 000000 constant char(6) initial unaligned dcl 59 ref 163 166 absolute_pathname_ 000010 constant entry external dcl 75 ref 127 addr builtin function dcl 102 ref 154 154 arg based char unaligned dcl 63 set ref 120 120 127* 129* 134* arg_no 000100 automatic fixed bin(17,0) dcl 36 set ref 118* 119* 121* 121 122* argl 000101 automatic fixed bin(21,0) dcl 37 set ref 119* 120 120 122* 127 127 129 129 134 134 argp 000102 automatic pointer dcl 38 set ref 119* 120 120 122* 127 129 134 cleanup 000200 stack reference condition dcl 96 ref 145 code 000104 automatic fixed bin(35,0) dcl 39 set ref 112* 113 114* 119* 122* 123 124* 127* 128 129* 147* 148 149* 154* 155 163* 166* 227* 229* com_err_ 000012 constant entry external dcl 76 ref 114 124 129 134 149 166 cu_$arg_count 000014 constant entry external dcl 77 ref 112 cu_$arg_ptr 000016 constant entry external dcl 78 ref 119 122 dir_name 000105 automatic char(168) unaligned dcl 40 set ref 110* 127* 163* 166 166* error_table_$badopt 000036 external static fixed bin(35,0) dcl 89 set ref 134* flush_seg_no 000160 automatic picture(5) unaligned dcl 41 set ref 162* 163 166 flush_segs based structure level 1 dcl 64 garbage 000162 automatic fixed bin(35,0) dcl 42 set ref 198* get_pdir_ 000020 constant entry external dcl 79 ref 110 get_temp_segment_ 000022 constant entry external dcl 80 ref 147 hcs_$delentry_seg 000024 constant entry external dcl 81 ref 227 hcs_$make_seg 000026 constant entry external dcl 82 ref 163 ioa_$ioa_switch 000030 constant entry external dcl 83 ref 207 212 iox_$error_output 000040 external static pointer dcl 90 set ref 207* 212* ltrim builtin function dcl 103 ref 163 166 n_args 000163 automatic fixed bin(17,0) dcl 43 set ref 112* 118 n_flush_segs 000164 automatic fixed bin(17,0) dcl 44 set ref 159* 161 196 n_pages 000165 automatic fixed bin(17,0) dcl 45 set ref 154 154 155* 159 160 207* 212* n_pages_flushed 000166 automatic fixed bin(17,0) dcl 46 set ref 194* 199* 199 207* 212* n_pages_left 000167 automatic fixed bin(17,0) dcl 47 set ref 160* 171 173* 173 n_segs based fixed bin(17,0) level 2 dcl 64 set ref 172* 226 null builtin function dcl 104 ref 144 165 225 230 other_error 000170 automatic bit(1) unaligned dcl 48 set ref 182* 190* 212 page based structure array level 2 dcl 69 pages_per_seg 000171 automatic fixed bin(17,0) dcl 49 set ref 158* 159 171 pagex 000172 automatic fixed bin(17,0) dcl 50 set ref 197* 198* quota_overflow 000173 automatic bit(1) unaligned dcl 51 set ref 181* 185* 207 record_quota_overflow 000206 stack reference condition dcl 97 ref 184 203 release_temp_segment_ 000032 constant entry external dcl 84 ref 229 ring_zero_peek_$by_definition 000034 constant entry external dcl 85 ref 154 seg_fault_error 000214 stack reference condition dcl 98 ref 189 seg_pages 4 based fixed bin(17,0) array level 3 dcl 64 set ref 171* 173 197 segment based structure level 1 dcl 69 segp 2 based pointer array level 3 dcl 64 set ref 163* 165 198 227* segs 2 based structure array level 2 dcl 64 segx 000174 automatic fixed bin(17,0) dcl 52 set ref 161* 162 163 165 171 172 173* 196* 197 198* 226* 227* stackframeptr builtin function dcl 105 ref 180 sys_info$max_seg_size 000042 external static fixed bin(19,0) dcl 91 ref 158 sys_info$page_size 000044 external static fixed bin(17,0) dcl 92 ref 158 tempp 000176 automatic pointer dcl 53 set ref 144* 147* 163 165 171 172 173 197 198 225 226 227 229* 230* word based fixed bin(35,0) array level 3 dcl 69 set ref 180* 198 NAMES DECLARED BY EXPLICIT CONTEXT. END_FLUSH 001140 constant label dcl 203 set ref 186 191 clean_out 001231 constant entry internal dcl 222 ref 145 150 168 205 flush 000130 constant entry external dcl 11 NAMES DECLARED BY CONTEXT OR IMPLICATION. divide builtin function ref 158 159 min builtin function ref 171 STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 1566 1634 1320 1576 Length 2032 1320 46 162 245 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME flush 238 external procedure is an external procedure. on unit on line 145 64 on unit on unit on line 184 64 on unit on unit on line 189 64 on unit clean_out 86 internal procedure is called by several nonquick procedures. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME flush 000100 arg_no flush 000101 argl flush 000102 argp flush 000104 code flush 000105 dir_name flush 000160 flush_seg_no flush 000162 garbage flush 000163 n_args flush 000164 n_flush_segs flush 000165 n_pages flush 000166 n_pages_flushed flush 000167 n_pages_left flush 000170 other_error flush 000171 pages_per_seg flush 000172 pagex flush 000173 quota_overflow flush 000174 segx flush 000176 tempp flush THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. r_e_as alloc_cs call_ext_out_desc call_ext_out call_int_this call_int_other return tra_ext enable shorten_stack ext_entry int_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. absolute_pathname_ com_err_ cu_$arg_count cu_$arg_ptr get_pdir_ get_temp_segment_ hcs_$delentry_seg hcs_$make_seg ioa_$ioa_switch release_temp_segment_ ring_zero_peek_$by_definition THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$badopt iox_$error_output sys_info$max_seg_size sys_info$page_size LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 11 000127 110 000135 112 000143 113 000154 114 000156 115 000173 118 000174 119 000203 120 000220 121 000232 122 000233 123 000250 124 000252 125 000301 127 000302 128 000326 129 000330 130 000354 132 000355 134 000356 135 000402 137 000403 144 000405 145 000407 147 000431 148 000452 149 000454 150 000500 151 000504 154 000505 155 000553 158 000557 159 000563 160 000566 161 000570 162 000577 163 000607 165 000702 166 000713 168 001007 169 001014 171 001015 172 001023 173 001025 174 001027 180 001031 181 001034 182 001035 184 001036 185 001052 186 001055 189 001060 190 001074 191 001077 194 001102 196 001103 197 001112 198 001122 199 001133 200 001134 201 001136 203 001140 205 001141 207 001145 212 001176 217 001227 222 001230 225 001236 226 001243 227 001253 228 001266 229 001271 230 001312 233 001315 ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved