COMPILATION LISTING OF SEGMENT patch_ring_zero Compiled by: Multics PL/I Compiler, Release 27d, of October 11, 1982 Compiled at: Honeywell LISD Phoenix, System M Compiled on: 11/15/82 1637.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 patch_ring_zero: 12 prz: 13 procedure () options (variable); 14 15 /* This procedure allows privileged users to patch locations in ring 0. 16* If necessary the descriptor segment is patched to give access to patch a non-write 17* permit segment */ 18 19 dcl tc fixed bin (21); 20 dcl tp pointer; 21 dcl targ char (tc) based (tp); 22 dcl code fixed bin (35); 23 dcl i fixed bin; 24 dcl first fixed bin; 25 dcl force_sw bit (1) aligned; 26 dcl processid bit (36) aligned; 27 dcl data (0 : 99) fixed bin (35); 28 dcl data1 (0 : 99) fixed bin (35); 29 dcl count fixed bin (18); 30 dcl datap pointer; 31 dcl data1p pointer; 32 dcl ok_to_patch bit (1) aligned; 33 dcl segptr pointer; 34 dcl dsp0 pointer; 35 dcl tsdwp pointer; 36 37 dcl 1 tsdw aligned like sdw automatic; 38 39 dcl error_table_$noarg fixed bin (35) external static; 40 41 dcl com_err_ entry options (variable); 42 dcl command_query_$yes_no entry options (variable); 43 dcl cv_oct_ entry (char (*)) returns (fixed bin (35)); 44 dcl cv_oct_check_ entry (char (*), fixed bin (35)) returns (fixed bin (35)); 45 dcl cu_$arg_ptr entry (fixed bin, pointer, fixed bin (21), fixed bin (35)); 46 dcl get_process_id_ entry () returns (bit (36) aligned); 47 dcl hphcs_$pxss_set_timax entry (bit (36) aligned, fixed bin (35)); 48 dcl hphcs_$ring_0_patch entry (pointer, pointer, fixed bin (18)); 49 dcl ioa_ entry options (variable); 50 dcl ring_zero_peek_ entry (pointer, pointer, fixed bin (18), fixed bin (35)); 51 dcl ring0_get_$segptr entry (char (*), char (*), pointer, fixed bin (35)); 52 53 dcl WHOAMI char (32) internal static options (constant) init ("patch_ring_zero"); 54 55 dcl (fixed, null, addr, baseno, baseptr, ptr) builtin; 56 57 /* */ 58 59 datap = addr (data); /* get pointer to data area */ 60 count = 0; 61 62 call cu_$arg_ptr (1, tp, tc, code); /* pick up the first arg (name/number) */ 63 if code = error_table_$noarg then do; 64 mess: call com_err_ (0, WHOAMI, "Usage: ^a name/segno offset value1 ... valueN", WHOAMI); 65 return; 66 end; 67 i = cv_oct_check_ (targ, code); /* get segment number */ 68 if code ^= 0 then do; /* didn't give number */ 69 segptr = null; /* if null we're still in trouble */ 70 call ring0_get_$segptr ("", targ, segptr, code); /* so assume ring 0 name */ 71 if segptr = null then do; 72 call com_err_ (0, WHOAMI, "^a not found.", targ); 73 return; 74 end; 75 i = fixed (baseno (segptr)); /* get segment number */ 76 end; 77 else segptr = baseptr (i); /* segment number given */ 78 79 call cu_$arg_ptr (2, tp, tc, code); /* pick up second arg (first word to dump ) */ 80 if code = error_table_$noarg then go to mess; 81 first = cv_oct_ (targ); 82 segptr = ptr (segptr, first); 83 call ring0_get_$segptr ("", "dseg", dsp0, code); 84 tsdwp = addr (dsp0 -> sdwa (i)); /* get a pointer to the SDW */ 85 86 87 /* Now pick off the arguments */ 88 89 i = 2; 90 loop: i = i + 1; /* get next argument */ 91 call cu_$arg_ptr (i, tp, tc, code); 92 if code = error_table_$noarg then go to endarg; 93 data1 (i-3) = cv_oct_ (targ); /* convert i'th arg */ 94 go to loop; 95 endarg: 96 count = i - 3; 97 if count = 0 then go to mess; 98 call ring_zero_peek_ (segptr, datap, count, code); 99 if code ^= 0 then do; 100 call com_err_ (code, WHOAMI); 101 return; 102 end; 103 do i = 0 to count-1; 104 call ioa_ ("^6o ^w to ^w", first+i, data (i), data1 (i)); 105 end; 106 107 call command_query_$yes_no (ok_to_patch, 0, WHOAMI, "", "Type ""yes"" if patches are correct:"); 108 if ^ok_to_patch then return; 109 110 /* Now set priority so that syserr messages dont hang process */ 111 112 processid = get_process_id_ (); 113 call hphcs_$pxss_set_timax (processid, 1); 114 115 /* Now check the access on the segment about to be patched */ 116 117 data1p = addr (data1); 118 call ring_zero_peek_ (tsdwp, addr (tsdw), size (tsdw), code); /* copy out the SDW */ 119 if code ^= 0 then do; 120 call com_err_ (code, WHOAMI, "Cannot get SDW for ^o", binary (baseno (segptr))); 121 return; 122 end; 123 124 if ^tsdw.write then do; 125 tsdw.write = "1"b; 126 force_sw = "1"b; 127 call hphcs_$ring_0_patch (addr (tsdw), tsdwp, size (tsdw)); 128 end; 129 else force_sw = "0"b; /* indicates we don't have to restore SDW */ 130 131 132 /* Now do the patches */ 133 134 call hphcs_$ring_0_patch (data1p, segptr, count); 135 136 /* Now reset access (in dseg) if necessary */ 137 138 if force_sw then do; 139 tsdw.write = "0"b; 140 call hphcs_$ring_0_patch (addr (tsdw), tsdwp, size (tsdw)); 141 end; 142 143 if processid ^= (36)"1"b then call hphcs_$pxss_set_timax (processid, -1); 144 145 return; 146 147 /* BEGIN INCLUDE FILE ... sdw.incl.pl1 ... last modified 12 May 1976 */ 1 2 1 3 dcl sdwp ptr; 1 4 1 5 dcl 1 sdw based (sdwp) aligned, /* Segment Descriptor Word */ 1 6 1 7 (2 add bit (24), /* main memory address of page table */ 1 8 2 (r1, r2, r3) bit (3), /* ring brackets for the segment */ 1 9 2 df bit (1), /* directed fault bit (0 => fault) */ 1 10 2 df_no bit (2), /* directed fault number */ 1 11 1 12 2 pad1 bit (1), 1 13 2 bound bit (14), /* boundary field (in 16 word blocks) */ 1 14 2 access, /* access bits */ 1 15 3 read bit (1), /* read permission bit */ 1 16 3 execute bit (1), /* execute permission bit */ 1 17 3 write bit (1), /* write permission bit */ 1 18 3 privileged bit (1), /* privileged bit */ 1 19 2 unpaged bit (1), /* segment is unpaged if this is 1 */ 1 20 2 entry_bound_sw bit (1), /* if this is 0 the entry bound is checked by hardware */ 1 21 2 cache bit (1), /* cache enable bit */ 1 22 2 entry_bound bit (14)) unaligned; /* entry bound */ 1 23 1 24 dcl 1 sdwa (0: 1) based (sdwp) aligned like sdw; /* SDW array (descriptor segment) */ 1 25 1 26 /* END INCLUDE FILE sdw.incl.pl1 */ 147 148 149 end; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/15/82 1505.7 patch_ring_zero.pl1 >dumps>old>recomp>patch_ring_zero.pl1 147 1 09/14/76 0759.8 sdw.incl.pl1 >ldd>include>sdw.incl.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. WHOAMI 000000 constant char(32) initial unaligned dcl 53 set ref 64* 64* 72* 100* 107* 120* access 1(15) 000436 automatic structure level 2 packed unaligned dcl 37 addr builtin function dcl 55 ref 59 84 117 118 118 127 127 140 140 baseno builtin function dcl 55 ref 75 120 120 baseptr builtin function dcl 55 ref 77 code 000104 automatic fixed bin(35,0) dcl 22 set ref 62* 63 67* 68 70* 79* 80 83* 91* 92 98* 99 100* 118* 119 120* com_err_ 000012 constant entry external dcl 41 ref 64 72 100 120 command_query_$yes_no 000014 constant entry external dcl 42 ref 107 count 000421 automatic fixed bin(18,0) dcl 29 set ref 60* 95* 97 98* 103 134* cu_$arg_ptr 000022 constant entry external dcl 45 ref 62 79 91 cv_oct_ 000016 constant entry external dcl 43 ref 81 93 cv_oct_check_ 000020 constant entry external dcl 44 ref 67 data 000111 automatic fixed bin(35,0) array dcl 27 set ref 59 104* data1 000255 automatic fixed bin(35,0) array dcl 28 set ref 93* 104* 117 data1p 000424 automatic pointer dcl 31 set ref 117* 134* datap 000422 automatic pointer dcl 30 set ref 59* 98* dsp0 000432 automatic pointer dcl 34 set ref 83* 84 error_table_$noarg 000010 external static fixed bin(35,0) dcl 39 ref 63 80 92 first 000106 automatic fixed bin(17,0) dcl 24 set ref 81* 82 104 fixed builtin function dcl 55 ref 75 force_sw 000107 automatic bit(1) dcl 25 set ref 126* 129* 138 get_process_id_ 000024 constant entry external dcl 46 ref 112 hphcs_$pxss_set_timax 000026 constant entry external dcl 47 ref 113 143 hphcs_$ring_0_patch 000030 constant entry external dcl 48 ref 127 134 140 i 000105 automatic fixed bin(17,0) dcl 23 set ref 67* 75* 77 84 89* 90* 90 91* 93 95 103* 104 104 104* ioa_ 000032 constant entry external dcl 49 ref 104 null builtin function dcl 55 ref 69 71 ok_to_patch 000426 automatic bit(1) dcl 32 set ref 107* 108 processid 000110 automatic bit(36) dcl 26 set ref 112* 113* 143 143* ptr builtin function dcl 55 ref 82 ring0_get_$segptr 000036 constant entry external dcl 51 ref 70 83 ring_zero_peek_ 000034 constant entry external dcl 50 ref 98 118 sdw based structure level 1 dcl 1-5 sdwa based structure array level 1 dcl 1-24 set ref 84 segptr 000430 automatic pointer dcl 33 set ref 69* 70* 71 75 77* 82* 82 98* 120 120 134* targ based char unaligned dcl 21 set ref 67* 70* 72* 81* 93* tc 000100 automatic fixed bin(21,0) dcl 19 set ref 62* 67 67 70 70 72 72 79* 81 81 91* 93 93 tp 000102 automatic pointer dcl 20 set ref 62* 67 70 72 79* 81 91* 93 tsdw 000436 automatic structure level 1 dcl 37 set ref 118 118 118 118 127 127 127 127 140 140 140 140 tsdwp 000434 automatic pointer dcl 35 set ref 84* 118* 127* 140* write 1(17) 000436 automatic bit(1) level 3 packed unaligned dcl 37 set ref 124 125* 139* NAME DECLARED BY DECLARE STATEMENT AND NEVER REFERENCED. sdwp automatic pointer dcl 1-3 NAMES DECLARED BY EXPLICIT CONTEXT. endarg 000472 constant label dcl 95 ref 92 loop 000427 constant label dcl 90 ref 94 mess 000137 constant label dcl 64 ref 80 97 patch_ring_zero 000105 constant entry external dcl 11 prz 000076 constant entry external dcl 11 NAMES DECLARED BY CONTEXT OR IMPLICATION. binary builtin function ref 120 120 size builtin function ref 118 118 127 127 140 140 STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 1234 1274 1055 1244 Length 1504 1055 40 173 156 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME prz 356 external procedure is an external procedure. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME prz 000100 tc prz 000102 tp prz 000104 code prz 000105 i prz 000106 first prz 000107 force_sw prz 000110 processid prz 000111 data prz 000255 data1 prz 000421 count prz 000422 datap prz 000424 data1p prz 000426 ok_to_patch prz 000430 segptr prz 000432 dsp0 prz 000434 tsdwp prz 000436 tsdw prz THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out_desc call_ext_out return ext_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. com_err_ command_query_$yes_no cu_$arg_ptr cv_oct_ cv_oct_check_ get_process_id_ hphcs_$pxss_set_timax hphcs_$ring_0_patch ioa_ ring0_get_$segptr ring_zero_peek_ THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$noarg LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 11 000075 59 000112 60 000114 62 000115 63 000133 64 000137 65 000167 67 000170 68 000214 69 000216 70 000220 71 000250 72 000254 73 000311 75 000312 76 000316 77 000317 79 000323 80 000342 81 000346 82 000367 83 000372 84 000421 89 000425 90 000427 91 000430 92 000445 93 000451 94 000471 95 000472 97 000475 98 000476 99 000512 100 000514 101 000531 103 000532 104 000541 105 000575 107 000577 108 000634 112 000637 113 000646 117 000661 118 000663 119 000704 120 000706 121 000745 124 000746 125 000751 126 000753 127 000755 128 000774 129 000775 134 000776 138 001011 139 001013 140 001015 143 001034 145 001052 ----------------------------------------------------------- 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