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 " HISTORY COMMENTS:
 14 "  1) change(87-03-02,Lippard), approve(87-04-06,MCR7658),
 15 "     audit(87-06-10,Fawcett), install(87-07-17,MR12.1-1043):
 16 "     Modified to complete cam_wait race fix.  (This fix from SGH (UNCA).)
 17 "                                                      END HISTORY COMMENTS
 18 
 19 
 20 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
 21 "
 22 "         wired_fim
 23 "
 24 "         Last Modified: (Date and Reason)
 25 "         Written 1/70 S.Webber
 26 "         Modified by S.Webber 01/01/72 for followon
 27 "         Modified by S.Webber 10/15/73 to add SPL/LPL code for all faults
 28 "         Modified by S.Webber 12/18/73 to remove page fault code
 29 "         Modified by Noel I. Morris 2/11/76 for new connect faults
 30 "         Modified by Mike Grady 6/79 to do stop on prds
 31 "         Modified by J. A. Bush 3/80 to store execute fault time in machine conditions
 32 "         Modified by J. Bongiovanni 1/81 for fault_counters
 33 "         Modified by J. Bongiovanni 2/81 for fast connect code,
 34 "                   traffic control race condition
 35 "         Modified by J. A. Bush 6/3/81 to save fault time for unexpected faults
 36 "         Modified by J. Bongiovanni 1/05/82 to fix CPU start wait bug
 37 "         Modified by R. Coppola 10/12/83 to meter faults on a per-cpu basis
 38 "         Modified 84-03-13 BIM (after Steve Harris) to close cam_wait race
 39 "
 40 "         The following entries exist within this procedure:
 41 "
 42 "         connect_handler     handles inter-processor communication
 43 "
 44 "         pre_empt_return     return from pxss after pre-empt
 45 "
 46 "         ignore              certain faults are ignored here
 47 "
 48 "         timer_runout        timer runout faults are mapped into
 49 "                             pre-empts
 50 "
 51 "         unexp_fault         unexpected faults come here during
 52 "                             system initialization
 53 "
 54 "         xec_fault           execute faults will cause return to BOS
 55 "
 56 "
 57 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
 58 
 59 
 60           name      wired_fim
 61 
 62 " ^L
 63 
 64           include   pxss_page_stack
 65 
 66 " ^L
 67 
 68           segdef    prs,scuinfo
 69           segdef    int_scuinfo
 70           segdef    trouble_prs,trouble_scuinfo
 71           segdef    ignore_scuinfo,ignore_pl
 72           segdef    my_linkage_ptr
 73 
 74           segdef    pre_empt_return
 75           segdef    ignore
 76           segdef    timer_runout
 77           segdef    connect_handler
 78           segdef    unexp_fault
 79           segdef    xec_fault
 80 
 81 
 82 
 83 
 84 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
 85 "
 86 "         The following variables are set up during initialization.
 87 "
 88 "
 89 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
 90 
 91           even
 92 prs:      bss       ,2
 93 scuinfo:  bss       ,2
 94 
 95 int_scuinfo:
 96           bss       ,2
 97 
 98 trouble_prs:
 99           bss       ,2
100 trouble_scuinfo:
101           bss       ,2
102 ignore_pl:
103           bss       ,2
104 ignore_scuinfo:
105           bss       ,2
106 
107 my_linkage_ptr:
108           bss       ,2
109 
110 "^L
111 
112 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
113 "
114 "         CONNECT_HANDLER -- Handle Connect Faults.
115 "
116 "         Connect faults may be sent for the following reasons:
117 "         1.        To cause a system trouble abort.
118 "         2.        To clear cache and associative memory.
119 "                   (the clearing has already been done by
120 "                    prds$fast_connect_code by the time we get here)
121 "         3.        To wait for a new CPU to start up.
122 "         4.        To cause a processor to delete itself.
123 "         5.        To cause a process pre-empt.
124 "         6.        To cause a process stop.
125 "         7.        To cause an IPS event to be signalled.
126 "
127 "
128 "         By the time this entry has been called, the fast connect
129 "         in the prds has been called.  This code has done the
130 "         following:
131 "
132 "         1.        If scs$fast_cam_pending was set for this cpu,
133 "                   AND this is not a cam_wait exchange,
134 "                   xed  scs$cam_pair
135 "                   stz  scs$fast_cam_pending + <processor tag>
136 "         2.        Added 1 to the counter
137 "                   wired_hardcore_data$fault_counters + <FAULT_NO_CON>
138 "
139 "         In the cam_wait case the clearing of the fast_cam_pending
140 "         must await our being done with the pds, since it may be
141 "         under eviction to move it to another scu. Clearing fast_cam_pending
142 "         informs cam_cache that we are in fact looping on scs$cam_wait,
143 "         AND NOTHING ELSE.
144 "
145 "
146 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
147 
148           inhibit   on        <+><+><+><+><+><+><+><+><+><+><+><+>
149           even
150 connect_handler:
151           spri      prs,*               save prs
152           eppbp     prs,*               bp -> place for machine conditions
153           sreg      bp|mc.regs          save regs
154           spl       bp|mc.eis_info      save EIS ptrs and lgths
155           epplp     my_linkage_ptr,*    set up linkage ptr
156 
157           tsx0      fim_util$v_time_init  start virtual time metering
158 
159           lda       scs$sys_trouble_pending  system trouble?
160           cana      prds$processor_pattern  for this CPU?
161           tnz       sys_trouble$sys_trouble  go handle it
162 
163           tsx0      fim_util$check_mct  go save M.C.s and hregs if trace is on
164           nop                           " return ic +1
165           tsx0      fim_util$reset_mode_reg  start up hist regs again
166 
167           lda       prds$processor_pattern        see if we're waiting for
168           cana      scs$cam_wait                  for all cams to clear
169           tnz       cam_wait                      yes--go do it
170 
171           cana      scs$processor_start_wait  waiting for CPU to start up?
172           tnz       start_wait          if so, go wait
173 
174           lxl1      prds$processor_tag  CPU tag in X1
175           lda       scs$processor_data,1  look at CPU flags
176           cana      processor_data.delete_cpu,du  is this CPU to delete itself?
177           tnz       delete_cpu          if so, cause a pre-emption
178 
179 more:     epplb     pds$apt_ptr,*       lb -> APT entry for this process
180           lda       lb|apte.flags       look at process flags
181           cana      apte.stop_pending,du  stop?
182           tnz       stop                go handle stop
183 
184           cana      apte.pre_empt_pending,du  pre-empt?
185           tnz       pre_empt            go handle pre-empt
186 
187           lda       lb|apte.ips_message IPS message?
188           tnz       ips                 go handle IPS
189           tra       exit                drop through to exit
190 
191 "^L
192 
193 ralr_set_1:
194           lda       1,dl                cannot handle fault now
195           sta       pds$alarm_ring      defer it until later
196 
197           odd
198 exit:
199           tsx0      fim_util$v_time_calc  calculate virtual time
200 
201 exit_1:
202           lpl       bp|mc.eis_info      restore EIS ptrs and lths
203           lra       pds$alarm_ring      FIM may have reset this
204           lreg      bp|mc.regs          restore regs
205           lpri      bp|mc.prs           and prs
206           rcu       scuinfo,*           good-bye
207 
208 
209 
210 " ^L
211 
212 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
213 "
214 "         IGNORE -- several faults are ignored by directing them
215 "                   to this entry.
216 "
217 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
218 
219 ignore:
220           spl       ignore_pl,*         make EIS happy
221           lpl       ignore_pl,*
222           rcu       ignore_scuinfo,*    restore the machine conditions
223 
224 
225 
226 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
227 "
228 "         XEC_FAULT and UNEXP_FAULT -- These entries cause
229 "                   the system to abort.
230 "
231 "
232 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
233 
234 xec_fault:
235           spri      trouble_prs,*       save prs
236           eppbp     trouble_prs,*       bp -> machine conditions
237           sreg      bp|mc.regs          save regs
238           spl       bp|mc.eis_info      save EIS ptrs and lths
239           epplp     my_linkage_ptr,*    establish linkage ptr
240           rccl      sys_info$clock_,*   read the clock
241           staq      bp|mc.fault_time    and save in machine conditions
242 
243           lca       trbl_exec_flt,dl    set sys trouble indicator
244           sta       scs$sys_trouble_pending  ..
245           lda       pds$processid       save our process ID
246           stac      scs$trouble_processid if we're the first
247           tra       sys_trouble$sys_trouble  map into sys_trouble code
248 
249 
250 unexp_fault:
251           spri      trouble_prs,*       save prs
252           eppbp     trouble_prs,*       bp -> machine conditions
253           sreg      bp|mc.regs          save regs
254           spl       bp|mc.eis_info      save EIS ptrs and lths
255           epplp     my_linkage_ptr,*    establish linkage ptr
256           rccl      sys_info$clock_,*   read the clock
257           staq      bp|mc.fault_time    and save in machine conditions
258 
259           lca       trbl_unexp_flt,dl   set sys trouble indicator
260           sta       scs$sys_trouble_pending  ..
261           lda       pds$processid       save our process ID
262           stac      scs$trouble_processid if we're the first
263           tra       sys_trouble$sys_trouble  map into sys_trouble code
264 
265 " ^L
266 
267 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
268 "
269 "         TIMER_RUNOUT - Timer runouts are mapped into pre-empts.
270 "
271 "
272 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
273 
274           even
275 timer_runout:
276           spri      prs,*               save prs
277           eppbp     prs,*               bp -> machine conditions
278 
279           sreg      bp|mc.regs          save regs
280           spl       bp|mc.eis_info      save EIS ptrs and lths
281           epplp     my_linkage_ptr,*    establish linkage ptr
282 
283           tsx0      fim_util$v_time_init  start virtual time meter
284 
285           tsx0      fim_util$check_mct  go save M.Cs ad hregs if trace is on
286           nop                           " return ic +1
287           tsx0      fim_util$reset_mode_reg  start up hist regs
288           lda       prds$processor_tag  get cpu num in A for index
289           xec       fault_ctr_table,al  LB => per-cpu flt ctr array
290           aos       lb|0+FAULT_NO_TRO
291 
292 cause_pre_empt:
293           epplb     pds$apt_ptr,*       lb -> APT entry for this process
294           ldx0      apte.pre_empt_pending,du  get pre-empt indicator flag
295           orsx0     lb|apte.flags       set pre-empt flag
296 
297           tra       pre_empt            join common code
298 
299 fault_ctr_table:
300           epplb     wired_hardcore_data$cpu_a_flt_ctr_array
301           epplb     wired_hardcore_data$cpu_b_flt_ctr_array
302           epplb     wired_hardcore_data$cpu_c_flt_ctr_array
303           epplb     wired_hardcore_data$cpu_d_flt_ctr_array
304           epplb     wired_hardcore_data$cpu_e_flt_ctr_array
305           epplb     wired_hardcore_data$cpu_f_flt_ctr_array
306           epplb     wired_hardcore_data$cpu_g_flt_ctr_array
307           epplb     wired_hardcore_data$cpu_h_flt_ctr_array
308 
309 
310 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
311 "
312 "         DELETE_CPU - Cause a pre-empt to stop CPU.
313 "
314 "
315 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
316 
317 delete_cpu:
318           lca       1,dl                all ones in A
319           era       prds$processor_pattern  get bit for CPU to be deleted
320           ansa      scs$connect_lock    undo the connect lock
321 
322           tra       cause_pre_empt      now, cause a pre-empt to take place
323 
324 " ^L
325 
326 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
327 "
328 "         CAM_WAIT -- Wait for all cpus to clear, and originator to
329 "                     give "Go"
330 "
331 "
332 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
333 
334 cam_wait:
335           eppsb     prds$               push a frame onto the prds
336           ldx7      push                ..
337           tsx0      fim_util$push_stack_32  ..
338 
339           eppap     notify_regs         ap -> place to copy conditions
340           tsx0      fim_util$copy_mc    copy the conditions into stack
341 
342 " NB: once scs$fast_cam_pending is cleared by this processor it must
343 " not reference anything that the originator of the cam_wait condition
344 " might be in the process of moving -- see evict_page.alm.  This includes
345 " pds and prds pages which may exist outside of bootload memory.
346 
347           tsx0      fim_util$set_mask   must uninhibit to prevent lockup
348 
349           lda       prds$processor_pattern  get bit for this CPU
350 
351           xed       scs$cam_pair        clear AM (and maybe cache?)
352           lxl7      prds$processor_tag
353           stz       scs$fast_cam_pending,x7 signal that we are out of the way
354 
355           inhibit   off       <-><-><-><-><-><-><-><-><-><-><-><->
356 
357           cana      scs$cam_wait        still waiting?
358           tze       *+4                 if not, exit loop
359           llr       72
360           llr       72
361           tra       *-4                 if so, wait more
362 
363           tsx0      fim_util$restore_mask  can inhibit again
364           inhibit   on        <+><+><+><+><+><+><+><+><+><+><+><+>
365 
366           cams      0                   now, clear A.M.'s
367           camp      0                   a second time
368 
369           eppap     prs,*               prepare to copy machine conditions back
370           tsx0      fim_util$copy_mc    ..
371 
372           eppap     sp|-32              get original stack end pointer
373           spriap    sb|stack_header.stack_end_ptr  pop our stack frame
374           tra       more                and leave
375 
376 " ^L
377 
378 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
379 "
380 "         START_WAIT - Wait until new CPU has started up.
381 "
382 "
383 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
384 
385 start_wait:
386           lca       1,dl                all ones in A
387           era       prds$processor_pattern  turn off bit for this CPU
388           ansa      scs$processor_start_wait  check ourselves off
389 
390           eppsb     prds$               push a frame onto the prds
391           ldx7      push                ..
392           tsx0      fim_util$push_stack_32  ..
393 
394           eppap     notify_regs         ap -> place to copy conditions
395           tsx0      fim_util$copy_mc    copy the conditions into stack
396 
397           tsx0      fim_util$set_mask   uninhibit to prevent lockups
398           inhibit   off       <-><-><-><-><-><-><-><-><-><-><-><->
399 
400           szn       scs$connect_lock    test connect lock
401           tze       *+4                 wait until it is cleared
402           llr       72
403           llr       72
404           tra       *-4
405 
406           tsx0      fim_util$restore_mask  can inhibit again
407           inhibit   on        <+><+><+><+><+><+><+><+><+><+><+><+>
408 
409           eppap     prs,*               prepare to copy machine conditions back
410           tsx0      fim_util$copy_mc    ..
411 
412           eppap     sp|-32              get original stack end pointer
413           spriap    sb|stack_header.stack_end_ptr  pop our stack frame
414           tra       exit                all finished waiting
415 
416 " ^L
417 
418 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
419 "
420 "         PRE_EMPT - Handle process pre-emptions.
421 "
422 "
423 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
424 
425 pre_empt:
426           tsx0      ring_test           ring 0 & not idle?
427           tra       ralr_set_1          if so, delay this for later
428 
429           eppap     pds$page_fault_data copy machine conditions
430           tsx0      fim_util$copy_mc    ..
431 
432           tsx0      fim_util$set_mask   mask system controller
433 
434           eppsb     prds$               establish stack frame on the prds
435           ldx7      push                ..
436           tsx0      fim_util$push_stack ..
437           inhibit   off       <-><-><-><-><-><-><-><-><-><-><-><->
438 
439           tra       pxss$pre_empt       go to pxss
440 
441 
442 
443 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
444 "
445 "         PRE_EMPT_RETURN -- Transferred to when pre_empt has been processed
446 "
447 "
448 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
449 
450 pre_empt_return:
451           epplp     my_linkage_ptr,*
452           eppbp     pds$page_fault_data get pointer to machine conditions
453 
454           tsx0      fim_util$restore_mask  restore old controller mask
455           inhibit   on        <+><+><+><+><+><+><+><+><+><+><+><+>
456 
457           ldaq      sb|stack_header.stack_begin_ptr  restore prds to virgin state
458           staq      sb|stack_header.stack_end_ptr  ..
459 
460           odd
461           tsx0      fim_util$v_time_calc  compute virtual time
462 
463           lpl       bp|mc.eis_info      restore EIS ptrs and lths
464           lreg      bp|mc.regs          restore regs
465           lpri      bp|mc.prs           and prs
466           rcu       int_scuinfo,*       bye-bye
467 
468 " ^L
469 
470 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
471 "
472 "         STOP - Handle process stop
473 "
474 "
475 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
476 
477 stop:
478           tsx0      ring_test           ring 0 & not idle?
479           tra       ralr_set_1          if so, delay handling this
480 
481           eppap     pds$page_fault_data copy machine conditions
482           tsx0      fim_util$copy_mc    ..
483 
484           tsx0      fim_util$set_mask   mask system controller
485 
486           eppsb     prds$               Establish stack on prds
487           ldx7      push                ..
488           tsx0      fim_util$push_stack ..
489           inhibit   off       <-><-><-><-><-><-><-><-><-><-><-><->
490 
491           tra       pxss$force_stop     go to pxss
492 
493           inhibit   on        <+><+><+><+><+><+><+><+><+><+><+><+>
494 
495 " ^L
496 
497 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
498 "
499 "         IPS - Handle Interprocess Signals
500 "
501 "
502 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
503 
504 ips:
505           tsx0      ring_test           ring 0 & not idle?
506           tra       ralr_set_1          we'll hear about this later
507 
508           eppap     pds$signal_data     copy the machine conditions
509           tsx0      fim_util$copy_mc    ..
510 
511           eppsb     pds$stack_0_ptr,*   Establish pageable stack.
512           ldx7      push                ..
513           tsx0      fim_util$push_stack ..
514 
515           tsx0      fim_util$v_time_calc  compute virtual time
516           inhibit   off       <-><-><-><-><-><-><-><-><-><-><-><->
517 
518           call      proc_int_handler$proc_int_handler
519 
520           inhibit   on        <+><+><+><+><+><+><+><+><+><+><+><+>
521           eppap     prs,*               copy SCU data only back
522           mlr       (pr),(pr)           ..
523           desc9a    bp|mc.scu,8*4
524           desc9a    ap|mc.scu,8*4
525 
526           sprisp    sb|stack_header.stack_end_ptr  release our stack frame
527           tra       exit_1              all finished
528 
529 " ^L
530 
531 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
532 "
533 "         RING_TEST - internal subroutine to see if process
534 "                   is in ring 0 and not an idle process
535 "
536 "
537 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "
538 
539 ring_test:
540           lda       bp|mc.scu.ppr.prr_word  get PRR
541           ana       scu.ppr.prr_mask,du ..
542           tnz       1,0                 if outer ring, take second return
543 
544           lda       lb|apte.flags       get process flags
545           cana      apte.idle,du        idle process?
546           tze       0,0                 if not, take first return
547 
548           epaq      sp|0                get stack pointer in AQ
549           eax7      0,au                stack segno in X7
550           cmpx7     trouble_scuinfo     is it prds?
551           tze       0,0                 if so, go away
552           tra       1,0                 if not, take second return
553 
554 " ^L
555 
556 push:     push
557 
558 
559           include   mc
560 
561 " ^L
562 
563           include   stack_header
564 
565 " ^L
566 
567           include   scs
568 
569           include   sys_trouble_codes
570 
571 " ^L
572 
573           include   apte
574 "^L
575           include   fault_vector
576 
577 
578 
579 
580 
581           end