1 " ***********************************************************
2 " * *
3 " * Copyright, C Honeywell Bull Inc., 1987 *
4 " * *
5 " * Copyright, C Honeywell Information Systems Inc., 1984 *
6 " * *
7 " * Copyright c 1972 by Massachusetts Institute of *
8 " * Technology and Honeywell Information Systems, Inc. *
9 " * *
10 " ***********************************************************
11
12 "
13 " EMERGENCY_SHUTDOWN
14
15 name emergency_shutdown
16
17 "
18 " This module is designed to be entered from BOS after a crash,
19 " It will attempt to salvage the contents of core by
20 " 1. set up an initial environment to clear I/O devices,
21 " 2. flushing out all unwired pages
22 " 3. deactivating all segments
23 "
24 " Last Modified: Date and Reason
25 "
26 " 10/11/83, Keith Loepere for paged unpaged stacks.
27 " 09/18/83, E. A. Ranzenbach to call syserr_real$syserr_reset before ocdcm_$esd_reset
28 " 06/20/83, E. A. Ranzenbach, for new ocdcm_$esd_reset call
29 " 09/28/82, J. Bongiovanni, to run on any CPU
30 " 03/01/81, W. Olin Sibert, for ADP conversion Phase One
31 " 01/20/81 by C. Hornig for io_manager
32 " 05/10/79 by B. Greenberg for shared stack_0's
33 " 03/10/76 by S. Webber
34 " 08/31/73 by R.B.Snyder to remove tra 0 at entry.
35 " 07/21/71 by Richard H. Gumpertz to get rid of prds$+<stb_pointer>, etc.
36 " Redesigned: N. I. Morris, 5/71
37 " Modified for new file system: S. H. Webber, 4/69
38 " Initial coding: T. H. Van Vleck, 2/69
39 " Design: N. I. Morris, 11/68
40 "
41
42 iftarget adp
43 warn This has not been converted yet for the ADP. Beware.
44 ifend
45
46
47
48 segdef entry,lp,pp
49
50 include sdw
51 include ptw
52 include scs
53 include stack_header
54
55 include apte
56 include state_equs
57
58 include stack_frame
59
60 include sst
61
62 include unpaged_page_tables
63 equ bsmbx,0
64
65 tempd arglist2 argument list
66 tempd temp_ptr temporary pointer
67
68
69
70
71
72 "
73 "^L
74 inhibit on <+><+><+><+><+><+><+><+><+><+><+><+>
75
76 entry: epplp lp-*,ic* get linkage pointer
77 epbpap pp-*,ic* get procedure segno
78 tra ap|*+1 enter appending mode
79
80 " Disable the traffic controller and indicate
81 " system is in the throes of a shutdown.
82
83 stz tc_data$wait_enable turn OFF multiprogramming
84 lca 1,dl
85 sta tc_data$apt_lock unlock the APT
86 stc1 tc_data$metering_lock unlock metering lock
87 eppbp tc_data$apt unlock APTEs
88 lxl1 tc_data$apt_size
89 ul_apte: eax1 -1,1
90 tmi ul_apte_done
91 stc1 bp|apte.lock
92 eppbp bp|size_of_apt_entry
93 tra ul_apte
94 ul_apte_done:
95 stc1 tc_data$system_shutdown for simplified actions
96
97 " We have only one processor running we hope! so
98 " must tell the system before any page faults cause connect
99
100 lda prds$processor_pattern use the processor we were returned on
101 sta scs$processor and no others
102 stz scs$connect_lock undo connect lock
103 stz scs$cam_wait undo cam wait flags
104 stz scs$sys_trouble_pending undo sys trouble cells
105 stz scs$trouble_flags ..
106 stz scs$bos_restart_flags ..
107
108 " Set this processor as the BOS processor, and set up the SCS appropriately
109 " Since BOS came here, we have an interrupt mask.
110
111 lxl1 prds$processor_tag needed for masking, etc.
112 sxl1 scs$bos_processor_tag We can now RTB
113 lxl0 scs$interrupt_controller Bootload SCU number
114 eppab scs$port_addressing_word,x0 ab -> word containing port number for Bootload SCU
115 sprpab scs$mask_ptr,x1 Set mask pointer this CPU
116 lda rmcm_instruction
117 sta scs$read_mask,x1 Set RMCM instruction
118 lda smcm_instruction
119 sta scs$set_mask,x1 Set SMCM instruction
120
121 " Mask down to sys_level. No interrupts may be taken now.
122
123 ldaq scs$sys_level mask down
124 lprpab scs$mask_ptr,1
125 xec scs$set_mask,1
126
127
128 " ^L
129
130 " Now switch to the idle process for this processor
131
132 lprpbp scs$idle_aptep,1
133 ldbr bp|apte.dbr note that prds is already good
134
135 " Now turn ON delete_cpu for all other processor in case they start up
136
137 lda 3,dl start with last CPU tag
138 ldq processor_data.delete_cpu,du
139 on_loop:
140 cmpa prds$processor_tag skip our own
141 tze skip_ours
142 orsq scs$processor_data,al turn ON bit
143 skip_ours:sbla 1,dl
144 tpl on_loop
145
146
147
148 " ^L
149
150 " Establish stack frame at base of PRDS.
151
152 eppsp prds$+stack_header.stack_begin_ptr,*
153 epbpsb sp|0 generate pointer to base of stack
154 ldx7 push get size of stack frame in X7
155 eppap sp|0,7 next SP
156 spriap sp|stack_frame.next_sp
157 spriap sb|stack_header.stack_end_ptr
158 ldaq null null last SP
159 staq sp|stack_frame.prev_sp
160
161 " Reset locks and switches to allow smooth shutdown.
162
163 stz sst_seg$+sst.astl unlock the global AST lock
164 stz scs$reconfig_lock undo the reconfiguration lock
165
166 " Call ocdcm_$esd_reset to reset the oc_data and syserr_real$syserr_reset to
167 " reset the log_data.
168
169 eppbp syserr_real$syserr_reset
170 stz arglist
171 stz arglist+1
172 tsx7 call_out
173
174 eppbp ocdcm_$esd_reset
175 tsx7 call_out
176
177
178 " RESET IOM_MANAGER. Clear out any pending iom status.
179
180 eppbp =1 bp -> constant 1
181 spribp arglist+2 set argument list
182 fld =1b24,dl set argument list header
183 ora =o4,dl ..
184 staq arglist ..
185
186 eppbp io_manager$reset bp -> iom_manager$iom_reset entry
187 tsx7 call_out make the call
188
189 eppbp page$esd_reset reset paging dims
190 tsx7 call_out
191
192 eppbp pc_recover_sst$pc_recover_sst recompute page control state.
193 tsx7 call_out
194
195 eppbp page$time_out
196 tsx7 call_out
197
198 eppbp disk_emergency$test_all_drives_masked
199 tsx7 call_out
200 " ^L
201
202 " Abandon the prds and use some reasonable stack.
203
204 ldaq prds$+stack_header.stack_begin_ptr
205 staq prds$+stack_header.stack_end_ptr
206
207 eppsp =its-11,* This just keeps page faults from crashing
208
209 " Now get ourselves a PDS to work with. We will use the template_pds by copying
210 " our header into it, wiring the first page, and then placing the SDW for template_pds
211 " in the slot for PDS.
212
213 epaq template_pds$+0 get segno of template_pds
214 als 1 times 2 for DSEG index
215 eax0 0,au save for later
216 lda dseg$+0,au pick up SDW for template_pds
217 arl sdw.add_shift adjust page table address
218 sbla sst$+sst.ptwbase convert to SST offset
219 ldq ptw.wired,dl turn wired bit ON in the first PTW
220 orsq sst$+0,al ..
221
222 " Now touch the page, causing a page fault probably
223
224 szn template_pds$+0 PAGE FAULT I HOPE IT WORKS
225
226 epaq pds$+0 get segment number of PDS
227 als 1 times 2 for DSEG index
228 eax1 0,au save for later
229
230 lda dseg$+sdw.bound_word,x1 " Get bound from SDW
231 arl sdw.bound_shift
232 ana sdw.bound_mask,dl " Mask it off
233 adla 1,dl " Add one to convert to 16 word blocks
234 als 18+4+2 " And convert to a character count, in AU
235
236 eppbp pds$ get pointers to data to move
237 eppbb template_pds$+0 ..
238 mlr prrl,prrl,fill0
239 desc9a bp|0,au
240 desc9a bb|0,au
241
242 ldaq dseg$,0 now move the SDW
243 staq dseg$,1 ..
244 cams
245 camp
246
247
248 "
249 " Use initialization stack.
250 "
251 " "From dust to dust....
252 "
253 eppsb inzr_stk0$
254 epaq sb|0
255 als 1
256 sprisb pds$stack_0_ptr
257 eppbp dseg$,au
258 spribp pds$stack_0_sdwp
259
260 " Re-init the stack end pointer.
261 "
262 eppsp sb|128
263 sprisp sb|stack_header.stack_begin_ptr
264 sprisp sb|stack_header.stack_end_ptr
265
266 " Make sure none of the pages of the stack are wired now,
267 " just so pmut will understand the starting state.
268
269 lda bp|0 get the first word of the SDW
270 arl sdw.add_shift shift to leave the address
271 cmpa unpaged_page_tables$0+upt.sst_last_loc page table out of sst
272 tpnz unpaged => unpaged
273 sbla unpaged_page_tables$0+upt.sst_absloc offset SDW addr in SST
274 tmi unpaged
275
276 eppbb sst$ get ptr to SST
277 eppbb bb|0,al bb -> PTW's of stack
278
279 lca ptw.wired+1,dl form mask to reset wired bits
280
281 ldq bp|1 get bound field from stack SDW
282 qrl 9 shift to get number of PTW's - 1
283 eax0 0,qu put into X0 for loop count
284
285 uw_loop: ansa bb|0,0 mask out ptw.wired
286 eax0 -1,0 count
287 tpl uw_loop process all PTW's about 16?
288
289 unpaged: tra wired_shutdown$wired_emergency
290
291 " ^L
292
293 " All calls out are made by this subroutine.
294
295 call_out:
296 call bp|0arglist make the call
297
298 tra 0,7 and return to caller
299
300
301 " ^L
302
303 " Storage & constants.
304
305 even
306 lp: its 0,0 somebody must set these.
307 pp: its 0,0
308 null: its -1,1
309
310 push: push " to get stack frame size
311
312 inhibit on <+><+><+><+><+><+><+><+><+><+><+><+><+><+><+>
313
314 rmcm_instruction:
315 rmcm ab|0,*
316 smcm_instruction:
317 smcm ab|0,*
318
319 inhibit off <-><-><-><-><-><-><-><-><-><-><-><-><-><-><->
320
321 end