This source file includes following definitions.
- print_default_base_system_script
- do_ini_line
- set_default_base_system
- boot_skip
- do_execute_fault
- do_execute_switches
- do_restart
- set_sys_polling_interval
- set_sys_slow_polling_interval
- set_sys_poll_check_rate
- dps_debug_mme_cntdwn
- dps_debug_skip
- dps_debug_start
- dps_debug_stop
- dps_debug_break
- dps_debug_segno
- dps_debug_ringno
- dps_debug_bar
- abs_addr_n
- abs_addr
- lookup_book_segment
- add_book_segment
- add_book_component
- lookup_system_book_address
- lookup_address
- lookup_system_book_name
- list_source
- stack_trace
- list_source_at
- load_system_book
- add_system_book_entry
- lookup_system_book
- fetchSDW
- virtAddrN
- virt_address
- set_search_path
- brkbrk
- sbreak
- dfx1entry
- dfx1exit
- dv2scale
- dfx2entry
- mdfx3entry
- smfx1entry
- search_memory
- set_dbg_cpu_mask
- scraper
- clear_yield
- yield
- set_luf
- dbgevent_compar
- dbgevent_lookup
- set_dbgevent
- rewind_media
- load_media
- ready_media
- trkw
- trkr
- usr1_signal_handler
- systabInit
- hash32s
- dps8_init
- dps8_exit
- getAddress
- parse_addr
- fprint_addr
- fprint_sym
- parse_sym
- sys_show_config
- sys_set_break
- sys_show_break
- sys_set_config
- sys_reset
- dps8_init_strip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #include <stdio.h>
34 #if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32)
35 # include <signal.h>
36 # include <sys/mman.h>
37 #endif
38 #include <time.h>
39 #include <stdint.h>
40 #include <unistd.h>
41 #include <ctype.h>
42
43 #if defined(__APPLE__)
44 # include <pthread.h>
45 #endif
46
47 #include "dps8.h"
48 #include "dps8_sys.h"
49 #include "dps8_sir.h"
50 #include "dps8_iom.h"
51 #include "dps8_console.h"
52 #include "dps8_cable.h"
53 #include "dps8_cpu.h"
54 #include "dps8_faults.h"
55 #include "dps8_scu.h"
56 #include "dps8_state.h"
57 #include "dps8_ins.h"
58 #include "dps8_math.h"
59 #include "dps8_mt.h"
60 #include "dps8_socket_dev.h"
61 #include "dps8_disk.h"
62 #include "dps8_append.h"
63 #include "dps8_fnp2.h"
64 #include "dps8_crdrdr.h"
65 #include "dps8_crdpun.h"
66 #include "dps8_prt.h"
67 #include "dps8_urp.h"
68 #include "dps8_absi.h"
69 #include "dps8_mgp.h"
70 #include "dps8_net.h"
71 #include "dps8_utils.h"
72 #include "dps8_memalign.h"
73 #include "dps8_cache.h"
74 #include "shm.h"
75 #include "ver.h"
76
77 #include "../simh/sim_os_mem.h"
78
79 #if defined(THREADZ) || defined(LOCKLESS)
80 # include "threadz.h"
81 #endif
82
83 #include "panelScraper.h"
84
85 #include "segldr.h"
86
87 #if defined(NO_LOCALE)
88 # define xstrerror_l strerror
89 #endif
90
91 #define DBG_CTR cpu.cycleCnt
92
93 #define ASSUME0 0
94
95 #if defined(FREE)
96 # undef FREE
97 #endif
98 #define FREE(p) do \
99 { \
100 free((p)); \
101 (p) = NULL; \
102 } while(0)
103
104
105
106
107
108
109
110
111 struct system_state_s * system_state;
112
113 volAtomic word36 * M = NULL;
114
115
116
117
118
119 const char* appname = "dps8";
120 char sim_name[] = "DPS8/M";
121 int32 sim_emax = 4;
122 static void dps8_init(void);
123 static void dps8_exit (void);
124 void (*sim_vm_init) (void) = & dps8_init;
125 void (*sim_vm_exit) (void) = & dps8_exit;
126
127 #if defined(TESTING)
128 static t_addr parse_addr(DEVICE *dptr, const char *cptr, const char **optr);
129 static void fprint_addr(FILE *stream, DEVICE *dptr, t_addr addr);
130 #endif
131
132 int32 luf_flag = 1;
133
134
135
136
137
138
139
140
141
142
143
144
145 #if !defined(PERF_STRIP)
146 static char * default_base_system_script [] =
147 {
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236 "CABLE_RIPOUT",
237
238 "SET CPU NUNITS=6",
239 "SET IOM NUNITS=2",
240
241 "SET TAPE NUNITS=17",
242 "SET MTP NUNITS=1",
243
244
245
246
247 "SET IPC NUNITS=2",
248 "SET MSP NUNITS=2",
249 "SET DISK NUNITS=26",
250 "SET SCU NUNITS=4",
251 "SET OPC NUNITS=2",
252 "SET FNP NUNITS=8",
253 "SET URP NUNITS=10",
254 "SET RDR NUNITS=3",
255 "SET PUN NUNITS=3",
256 "SET PRT NUNITS=4",
257 # if defined (WITH_ABSI_DEV)
258 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32)
259 "SET ABSI NUNITS=1",
260 # endif
261 # endif
262
263 # if defined(WITH_MGP_DEV)
264 "SET MGP NUNITS=2",
265 # endif
266
267 # if defined(WITH_NET_DEV)
268 "SET NET NUNITS=2",
269 # endif
270
271 # if defined(WITH_SOCKET_DEV)
272 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32)
273 "SET SKC NUNITS=64",
274 # endif
275 # endif
276
277
278
279 "SET CPU0 CONFIG=FAULTBASE=Multics",
280
281 "SET CPU0 CONFIG=NUM=0",
282
283
284 "SET CPU0 CONFIG=DATA=024000717200",
285 "SET CPU0 CONFIG=ADDRESS=000000000000",
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303 "SET CPU0 CONFIG=PORT=A",
304 "SET CPU0 CONFIG=ASSIGNMENT=0",
305 "SET CPU0 CONFIG=INTERLACE=0",
306 "SET CPU0 CONFIG=ENABLE=1",
307 "SET CPU0 CONFIG=INIT_ENABLE=1",
308 "SET CPU0 CONFIG=STORE_SIZE=4M",
309
310 "SET CPU0 CONFIG=PORT=B",
311 "SET CPU0 CONFIG=ASSIGNMENT=1",
312 "SET CPU0 CONFIG=INTERLACE=0",
313 "SET CPU0 CONFIG=ENABLE=1",
314 "SET CPU0 CONFIG=INIT_ENABLE=1",
315 "SET CPU0 CONFIG=STORE_SIZE=4M",
316
317 "SET CPU0 CONFIG=PORT=C",
318 "SET CPU0 CONFIG=ASSIGNMENT=2",
319 "SET CPU0 CONFIG=INTERLACE=0",
320 "SET CPU0 CONFIG=ENABLE=1",
321 "SET CPU0 CONFIG=INIT_ENABLE=1",
322 "SET CPU0 CONFIG=STORE_SIZE=4M",
323
324 "SET CPU0 CONFIG=PORT=D",
325 "SET CPU0 CONFIG=ASSIGNMENT=3",
326 "SET CPU0 CONFIG=INTERLACE=0",
327 "SET CPU0 CONFIG=ENABLE=1",
328 "SET CPU0 CONFIG=INIT_ENABLE=1",
329 "SET CPU0 CONFIG=STORE_SIZE=4M",
330
331
332 "SET CPU0 CONFIG=MODE=Multics",
333
334 "SET CPU0 CONFIG=ENABLE_CACHE=enable",
335 "SET CPU0 CONFIG=SDWAM=enable",
336 "SET CPU0 CONFIG=PTWAM=enable",
337
338
339 "SET CPU0 CONFIG=SPEED=0",
340
341 "SET CPU0 CONFIG=DIS_ENABLE=enable",
342 "SET CPU0 CONFIG=STEADY_CLOCK=disable",
343 "SET CPU0 CONFIG=HALT_ON_UNIMPLEMENTED=disable",
344 "SET CPU0 CONFIG=ENABLE_WAM=disable",
345 "SET CPU0 CONFIG=REPORT_FAULTS=disable",
346 "SET CPU0 CONFIG=TRO_ENABLE=enable",
347 "SET CPU0 CONFIG=DRL_FATAL=disable",
348 "SET CPU0 CONFIG=USEMAP=disable",
349 "SET CPU0 CONFIG=PROM_INSTALLED=enable",
350 "SET CPU0 CONFIG=HEX_MODE_INSTALLED=disable",
351 "SET CPU0 CONFIG=CACHE_INSTALLED=enable",
352 "SET CPU0 CONFIG=CLOCK_SLAVE_INSTALLED=enable",
353
354
355
356 "SET CPU1 CONFIG=FAULTBASE=Multics",
357
358 "SET CPU1 CONFIG=NUM=1",
359
360
361 "SET CPU1 CONFIG=DATA=024000717200",
362 "SET CPU1 CONFIG=ADDRESS=000000000000",
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380 "SET CPU1 CONFIG=PORT=A",
381 "SET CPU1 CONFIG=ASSIGNMENT=0",
382 "SET CPU1 CONFIG=INTERLACE=0",
383 "SET CPU1 CONFIG=ENABLE=1",
384 "SET CPU1 CONFIG=INIT_ENABLE=1",
385 "SET CPU1 CONFIG=STORE_SIZE=4M",
386
387 "SET CPU1 CONFIG=PORT=B",
388 "SET CPU1 CONFIG=ASSIGNMENT=1",
389 "SET CPU1 CONFIG=INTERLACE=0",
390 "SET CPU1 CONFIG=ENABLE=1",
391 "SET CPU1 CONFIG=INIT_ENABLE=1",
392 "SET CPU1 CONFIG=STORE_SIZE=4M",
393
394 "SET CPU1 CONFIG=PORT=C",
395 "SET CPU1 CONFIG=ASSIGNMENT=2",
396 "SET CPU1 CONFIG=INTERLACE=0",
397 "SET CPU1 CONFIG=ENABLE=1",
398 "SET CPU1 CONFIG=INIT_ENABLE=1",
399 "SET CPU1 CONFIG=STORE_SIZE=4M",
400
401 "SET CPU1 CONFIG=PORT=D",
402 "SET CPU1 CONFIG=ASSIGNMENT=3",
403 "SET CPU1 CONFIG=INTERLACE=0",
404 "SET CPU1 CONFIG=ENABLE=1",
405 "SET CPU1 CONFIG=INIT_ENABLE=1",
406 "SET CPU1 CONFIG=STORE_SIZE=4M",
407
408
409 "SET CPU1 CONFIG=MODE=Multics",
410
411 "SET CPU1 CONFIG=ENABLE_CACHE=enable",
412 "SET CPU1 CONFIG=SDWAM=enable",
413 "SET CPU1 CONFIG=PTWAM=enable",
414
415
416 "SET CPU1 CONFIG=SPEED=0",
417
418 "SET CPU1 CONFIG=DIS_ENABLE=enable",
419 "SET CPU1 CONFIG=STEADY_CLOCK=disable",
420 "SET CPU1 CONFIG=HALT_ON_UNIMPLEMENTED=disable",
421 "SET CPU1 CONFIG=ENABLE_WAM=disable",
422 "SET CPU1 CONFIG=REPORT_FAULTS=disable",
423 "SET CPU1 CONFIG=TRO_ENABLE=enable",
424 "SET CPU1 CONFIG=DRL_FATAL=disable",
425 "SET CPU1 CONFIG=USEMAP=disable",
426 "SET CPU1 CONFIG=PROM_INSTALLED=enable",
427 "SET CPU1 CONFIG=HEX_MODE_INSTALLED=disable",
428 "SET CPU1 CONFIG=CACHE_INSTALLED=enable",
429 "SET CPU1 CONFIG=CLOCK_SLAVE_INSTALLED=enable",
430
431
432
433 "SET CPU2 CONFIG=FAULTBASE=Multics",
434
435 "SET CPU2 CONFIG=NUM=2",
436
437
438 "SET CPU2 CONFIG=DATA=024000717200",
439 "SET CPU2 CONFIG=ADDRESS=000000000000",
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457 "SET CPU2 CONFIG=PORT=A",
458 "SET CPU2 CONFIG=ASSIGNMENT=0",
459 "SET CPU2 CONFIG=INTERLACE=0",
460 "SET CPU2 CONFIG=ENABLE=1",
461 "SET CPU2 CONFIG=INIT_ENABLE=1",
462 "SET CPU2 CONFIG=STORE_SIZE=4M",
463
464 "SET CPU2 CONFIG=PORT=B",
465 "SET CPU2 CONFIG=ASSIGNMENT=1",
466 "SET CPU2 CONFIG=INTERLACE=0",
467 "SET CPU2 CONFIG=ENABLE=1",
468 "SET CPU2 CONFIG=INIT_ENABLE=1",
469 "SET CPU2 CONFIG=STORE_SIZE=4M",
470
471 "SET CPU2 CONFIG=PORT=C",
472 "SET CPU2 CONFIG=ASSIGNMENT=2",
473 "SET CPU2 CONFIG=INTERLACE=0",
474 "SET CPU2 CONFIG=ENABLE=1",
475 "SET CPU2 CONFIG=INIT_ENABLE=1",
476 "SET CPU2 CONFIG=STORE_SIZE=4M",
477
478 "SET CPU2 CONFIG=PORT=D",
479 "SET CPU2 CONFIG=ASSIGNMENT=3",
480 "SET CPU2 CONFIG=INTERLACE=0",
481 "SET CPU2 CONFIG=ENABLE=1",
482 "SET CPU2 CONFIG=INIT_ENABLE=1",
483 "SET CPU2 CONFIG=STORE_SIZE=4M",
484
485
486 "SET CPU2 CONFIG=MODE=Multics",
487
488 "SET CPU2 CONFIG=ENABLE_CACHE=enable",
489 "SET CPU2 CONFIG=SDWAM=enable",
490 "SET CPU2 CONFIG=PTWAM=enable",
491
492
493 "SET CPU2 CONFIG=SPEED=0",
494
495 "SET CPU2 CONFIG=DIS_ENABLE=enable",
496 "SET CPU2 CONFIG=STEADY_CLOCK=disable",
497 "SET CPU2 CONFIG=HALT_ON_UNIMPLEMENTED=disable",
498 "SET CPU2 CONFIG=ENABLE_WAM=disable",
499 "SET CPU2 CONFIG=REPORT_FAULTS=disable",
500 "SET CPU2 CONFIG=TRO_ENABLE=enable",
501 "SET CPU2 CONFIG=DRL_FATAL=disable",
502 "SET CPU2 CONFIG=USEMAP=disable",
503 "SET CPU2 CONFIG=PROM_INSTALLED=enable",
504 "SET CPU2 CONFIG=HEX_MODE_INSTALLED=disable",
505 "SET CPU2 CONFIG=CACHE_INSTALLED=enable",
506 "SET CPU2 CONFIG=CLOCK_SLAVE_INSTALLED=enable",
507
508
509
510 "SET CPU3 CONFIG=FAULTBASE=Multics",
511
512 "SET CPU3 CONFIG=NUM=3",
513
514
515 "SET CPU3 CONFIG=DATA=024000717200",
516 "SET CPU3 CONFIG=ADDRESS=000000000000",
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534 "SET CPU3 CONFIG=PORT=A",
535 "SET CPU3 CONFIG=ASSIGNMENT=0",
536 "SET CPU3 CONFIG=INTERLACE=0",
537 "SET CPU3 CONFIG=ENABLE=1",
538 "SET CPU3 CONFIG=INIT_ENABLE=1",
539 "SET CPU3 CONFIG=STORE_SIZE=4M",
540
541 "SET CPU3 CONFIG=PORT=B",
542 "SET CPU3 CONFIG=ASSIGNMENT=1",
543 "SET CPU3 CONFIG=INTERLACE=0",
544 "SET CPU3 CONFIG=ENABLE=1",
545 "SET CPU3 CONFIG=INIT_ENABLE=1",
546 "SET CPU3 CONFIG=STORE_SIZE=4M",
547
548 "SET CPU3 CONFIG=PORT=C",
549 "SET CPU3 CONFIG=ASSIGNMENT=2",
550 "SET CPU3 CONFIG=INTERLACE=0",
551 "SET CPU3 CONFIG=ENABLE=1",
552 "SET CPU3 CONFIG=INIT_ENABLE=1",
553 "SET CPU3 CONFIG=STORE_SIZE=4M",
554
555 "SET CPU3 CONFIG=PORT=D",
556 "SET CPU3 CONFIG=ASSIGNMENT=3",
557 "SET CPU3 CONFIG=INTERLACE=0",
558 "SET CPU3 CONFIG=ENABLE=1",
559 "SET CPU3 CONFIG=INIT_ENABLE=1",
560 "SET CPU3 CONFIG=STORE_SIZE=4M",
561
562
563 "SET CPU3 CONFIG=MODE=Multics",
564
565 "SET CPU3 CONFIG=ENABLE_CACHE=enable",
566 "SET CPU3 CONFIG=SDWAM=enable",
567 "SET CPU3 CONFIG=PTWAM=enable",
568
569
570 "SET CPU3 CONFIG=SPEED=0",
571
572 "SET CPU3 CONFIG=DIS_ENABLE=enable",
573 "SET CPU3 CONFIG=STEADY_CLOCK=disable",
574 "SET CPU3 CONFIG=HALT_ON_UNIMPLEMENTED=disable",
575 "SET CPU3 CONFIG=ENABLE_WAM=disable",
576 "SET CPU3 CONFIG=REPORT_FAULTS=disable",
577 "SET CPU3 CONFIG=TRO_ENABLE=enable",
578 "SET CPU3 CONFIG=DRL_FATAL=disable",
579 "SET CPU3 CONFIG=USEMAP=disable",
580 "SET CPU3 CONFIG=PROM_INSTALLED=enable",
581 "SET CPU3 CONFIG=HEX_MODE_INSTALLED=disable",
582 "SET CPU3 CONFIG=CACHE_INSTALLED=enable",
583 "SET CPU3 CONFIG=CLOCK_SLAVE_INSTALLED=enable",
584
585
586
587 "SET CPU4 CONFIG=FAULTBASE=Multics",
588
589 "SET CPU4 CONFIG=NUM=4",
590
591
592 "SET CPU4 CONFIG=DATA=024000717200",
593 "SET CPU4 CONFIG=ADDRESS=000000000000",
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611 "SET CPU4 CONFIG=PORT=A",
612 "SET CPU4 CONFIG=ASSIGNMENT=0",
613 "SET CPU4 CONFIG=INTERLACE=0",
614 "SET CPU4 CONFIG=ENABLE=1",
615 "SET CPU4 CONFIG=INIT_ENABLE=1",
616 "SET CPU4 CONFIG=STORE_SIZE=4M",
617
618 "SET CPU4 CONFIG=PORT=B",
619 "SET CPU4 CONFIG=ASSIGNMENT=1",
620 "SET CPU4 CONFIG=INTERLACE=0",
621 "SET CPU4 CONFIG=ENABLE=1",
622 "SET CPU4 CONFIG=INIT_ENABLE=1",
623 "SET CPU4 CONFIG=STORE_SIZE=4M",
624
625 "SET CPU4 CONFIG=PORT=C",
626 "SET CPU4 CONFIG=ASSIGNMENT=2",
627 "SET CPU4 CONFIG=INTERLACE=0",
628 "SET CPU4 CONFIG=ENABLE=1",
629 "SET CPU4 CONFIG=INIT_ENABLE=1",
630 "SET CPU4 CONFIG=STORE_SIZE=4M",
631
632 "SET CPU4 CONFIG=PORT=D",
633 "SET CPU4 CONFIG=ASSIGNMENT=3",
634 "SET CPU4 CONFIG=INTERLACE=0",
635 "SET CPU4 CONFIG=ENABLE=1",
636 "SET CPU4 CONFIG=INIT_ENABLE=1",
637 "SET CPU4 CONFIG=STORE_SIZE=4M",
638
639
640 "SET CPU4 CONFIG=MODE=Multics",
641
642 "SET CPU4 CONFIG=ENABLE_CACHE=enable",
643 "SET CPU4 CONFIG=SDWAM=enable",
644 "SET CPU4 CONFIG=PTWAM=enable",
645
646
647 "SET CPU4 CONFIG=SPEED=0",
648
649 "SET CPU4 CONFIG=DIS_ENABLE=enable",
650 "SET CPU4 CONFIG=STEADY_CLOCK=disable",
651 "SET CPU4 CONFIG=HALT_ON_UNIMPLEMENTED=disable",
652 "SET CPU4 CONFIG=ENABLE_WAM=disable",
653 "SET CPU4 CONFIG=REPORT_FAULTS=disable",
654 "SET CPU4 CONFIG=TRO_ENABLE=enable",
655 "SET CPU4 CONFIG=DRL_FATAL=disable",
656 "SET CPU4 CONFIG=USEMAP=disable",
657 "SET CPU4 CONFIG=PROM_INSTALLED=enable",
658 "SET CPU4 CONFIG=HEX_MODE_INSTALLED=disable",
659 "SET CPU4 CONFIG=CACHE_INSTALLED=enable",
660 "SET CPU4 CONFIG=CLOCK_SLAVE_INSTALLED=enable",
661
662
663
664 "SET CPU5 CONFIG=FAULTBASE=Multics",
665
666 "SET CPU5 CONFIG=NUM=5",
667
668
669 "SET CPU5 CONFIG=DATA=024000717200",
670 "SET CPU5 CONFIG=ADDRESS=000000000000",
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688 "SET CPU5 CONFIG=PORT=A",
689 "SET CPU5 CONFIG=ASSIGNMENT=0",
690 "SET CPU5 CONFIG=INTERLACE=0",
691 "SET CPU5 CONFIG=ENABLE=1",
692 "SET CPU5 CONFIG=INIT_ENABLE=1",
693 "SET CPU5 CONFIG=STORE_SIZE=4M",
694
695 "SET CPU5 CONFIG=PORT=B",
696 "SET CPU5 CONFIG=ASSIGNMENT=1",
697 "SET CPU5 CONFIG=INTERLACE=0",
698 "SET CPU5 CONFIG=ENABLE=1",
699 "SET CPU5 CONFIG=INIT_ENABLE=1",
700 "SET CPU5 CONFIG=STORE_SIZE=4M",
701
702 "SET CPU5 CONFIG=PORT=C",
703 "SET CPU5 CONFIG=ASSIGNMENT=2",
704 "SET CPU5 CONFIG=INTERLACE=0",
705 "SET CPU5 CONFIG=ENABLE=1",
706 "SET CPU5 CONFIG=INIT_ENABLE=1",
707 "SET CPU5 CONFIG=STORE_SIZE=4M",
708
709 "SET CPU5 CONFIG=PORT=D",
710 "SET CPU5 CONFIG=ASSIGNMENT=3",
711 "SET CPU5 CONFIG=INTERLACE=0",
712 "SET CPU5 CONFIG=ENABLE=1",
713 "SET CPU5 CONFIG=INIT_ENABLE=1",
714 "SET CPU5 CONFIG=STORE_SIZE=4M",
715
716
717 "SET CPU5 CONFIG=MODE=Multics",
718
719 "SET CPU5 CONFIG=ENABLE_CACHE=enable",
720 "SET CPU5 CONFIG=SDWAM=enable",
721 "SET CPU5 CONFIG=PTWAM=enable",
722
723
724 "SET CPU5 CONFIG=SPEED=0",
725
726 "SET CPU5 CONFIG=DIS_ENABLE=enable",
727 "SET CPU5 CONFIG=STEADY_CLOCK=disable",
728 "SET CPU5 CONFIG=HALT_ON_UNIMPLEMENTED=disable",
729 "SET CPU5 CONFIG=ENABLE_WAM=disable",
730 "SET CPU5 CONFIG=REPORT_FAULTS=disable",
731 "SET CPU5 CONFIG=TRO_ENABLE=enable",
732 "SET CPU5 CONFIG=DRL_FATAL=disable",
733 "SET CPU5 CONFIG=USEMAP=disable",
734 "SET CPU5 CONFIG=PROM_INSTALLED=enable",
735 "SET CPU5 CONFIG=HEX_MODE_INSTALLED=disable",
736 "SET CPU5 CONFIG=CACHE_INSTALLED=enable",
737 "SET CPU5 CONFIG=CLOCK_SLAVE_INSTALLED=enable",
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902 "SET IOM0 CONFIG=IOM_BASE=Multics",
903 "SET IOM0 CONFIG=MULTIPLEX_BASE=0120",
904 "SET IOM0 CONFIG=OS=Multics",
905 "SET IOM0 CONFIG=BOOT=tape",
906 "SET IOM0 CONFIG=TAPECHAN=012",
907 "SET IOM0 CONFIG=CARDCHAN=011",
908 "SET IOM0 CONFIG=SCUPORT=0",
909
910 "SET IOM0 CONFIG=PORT=0",
911 "SET IOM0 CONFIG=ADDR=0",
912 "SET IOM0 CONFIG=INTERLACE=0",
913 "SET IOM0 CONFIG=ENABLE=1",
914 "SET IOM0 CONFIG=INITENABLE=0",
915 "SET IOM0 CONFIG=HALFSIZE=0",
916 "SET IOM0 CONFIG=STORE_SIZE=4M",
917
918 "SET IOM0 CONFIG=PORT=1",
919 "SET IOM0 CONFIG=ADDR=1",
920 "SET IOM0 CONFIG=INTERLACE=0",
921 "SET IOM0 CONFIG=ENABLE=1",
922 "SET IOM0 CONFIG=INITENABLE=0",
923 "SET IOM0 CONFIG=HALFSIZE=0",
924 "SET IOM0 CONFIG=STORE_SIZE=4M",
925
926 "SET IOM0 CONFIG=PORT=2",
927 "SET IOM0 CONFIG=ADDR=2",
928 "SET IOM0 CONFIG=INTERLACE=0",
929 "SET IOM0 CONFIG=ENABLE=1",
930 "SET IOM0 CONFIG=INITENABLE=0",
931 "SET IOM0 CONFIG=HALFSIZE=0",
932 "SET IOM0 CONFIG=STORE_SIZE=4M",
933
934 "SET IOM0 CONFIG=PORT=3",
935 "SET IOM0 CONFIG=ADDR=3",
936 "SET IOM0 CONFIG=INTERLACE=0",
937 "SET IOM0 CONFIG=ENABLE=1",
938 "SET IOM0 CONFIG=INITENABLE=0",
939 "SET IOM0 CONFIG=HALFSIZE=0",
940 "SET IOM0 CONFIG=STORE_SIZE=4M",
941
942 "SET IOM0 CONFIG=PORT=4",
943 "SET IOM0 CONFIG=ENABLE=0",
944
945 "SET IOM0 CONFIG=PORT=5",
946 "SET IOM0 CONFIG=ENABLE=0",
947
948 "SET IOM0 CONFIG=PORT=6",
949 "SET IOM0 CONFIG=ENABLE=0",
950
951 "SET IOM0 CONFIG=PORT=7",
952 "SET IOM0 CONFIG=ENABLE=0",
953
954
955
956 "SET IOM1 CONFIG=IOM_BASE=Multics2",
957 "SET IOM1 CONFIG=MULTIPLEX_BASE=0121",
958 "SET IOM1 CONFIG=OS=Multics",
959 "SET IOM1 CONFIG=BOOT=tape",
960 "SET IOM1 CONFIG=TAPECHAN=012",
961 "SET IOM1 CONFIG=CARDCHAN=011",
962 "SET IOM1 CONFIG=SCUPORT=0",
963
964 "SET IOM1 CONFIG=PORT=0",
965 "SET IOM1 CONFIG=ADDR=0",
966 "SET IOM1 CONFIG=INTERLACE=0",
967 "SET IOM1 CONFIG=ENABLE=1",
968 "SET IOM1 CONFIG=INITENABLE=0",
969 "SET IOM1 CONFIG=HALFSIZE=0",
970
971 "SET IOM1 CONFIG=PORT=1",
972 "SET IOM1 CONFIG=ADDR=1",
973 "SET IOM1 CONFIG=INTERLACE=0",
974 "SET IOM1 CONFIG=ENABLE=1",
975 "SET IOM1 CONFIG=INITENABLE=0",
976 "SET IOM1 CONFIG=HALFSIZE=0",
977
978 "SET IOM1 CONFIG=PORT=2",
979 "SET IOM1 CONFIG=ENABLE=0",
980 "SET IOM1 CONFIG=PORT=3",
981 "SET IOM1 CONFIG=ENABLE=0",
982 "SET IOM1 CONFIG=PORT=4",
983 "SET IOM1 CONFIG=ENABLE=0",
984 "SET IOM1 CONFIG=PORT=5",
985 "SET IOM1 CONFIG=ENABLE=0",
986 "SET IOM1 CONFIG=PORT=6",
987 "SET IOM1 CONFIG=ENABLE=0",
988 "SET IOM1 CONFIG=PORT=7",
989 "SET IOM1 CONFIG=ENABLE=0",
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070 "SET SCU0 CONFIG=MODE=program",
1071 "SET SCU0 CONFIG=PORT0=enable",
1072 "SET SCU0 CONFIG=PORT1=enable",
1073 "SET SCU0 CONFIG=PORT2=enable",
1074 "SET SCU0 CONFIG=PORT3=enable",
1075 "SET SCU0 CONFIG=PORT4=enable",
1076 "SET SCU0 CONFIG=PORT5=enable",
1077 "SET SCU0 CONFIG=PORT6=enable",
1078 "SET SCU0 CONFIG=PORT7=enable",
1079 "SET SCU0 CONFIG=MASKA=7",
1080 "SET SCU0 CONFIG=MASKB=off",
1081 "SET SCU0 CONFIG=LWRSTORESIZE=7",
1082 "SET SCU0 CONFIG=CYCLIC=0040",
1083 "SET SCU0 CONFIG=NEA=0200",
1084 "SET SCU0 CONFIG=ONL=014",
1085 "SET SCU0 CONFIG=INT=0",
1086 "SET SCU0 CONFIG=LWR=0",
1087 "SET SCU0 CONFIG=CLOCK_DELTA=0",
1088
1089
1090
1091 "SET SCU1 CONFIG=MODE=program",
1092 "SET SCU1 CONFIG=PORT0=enable",
1093 "SET SCU1 CONFIG=PORT1=enable",
1094 "SET SCU1 CONFIG=PORT2=enable",
1095 "SET SCU1 CONFIG=PORT3=enable",
1096 "SET SCU1 CONFIG=PORT4=enable",
1097 "SET SCU1 CONFIG=PORT5=enable",
1098 "SET SCU1 CONFIG=PORT6=enable",
1099 "SET SCU1 CONFIG=PORT7=enable",
1100 "SET SCU1 CONFIG=MASKA=off",
1101 "SET SCU1 CONFIG=MASKB=off",
1102 "SET SCU1 CONFIG=LWRSTORESIZE=7",
1103 "SET SCU1 CONFIG=CYCLIC=0040",
1104 "SET SCU1 CONFIG=NEA=0200",
1105 "SET SCU1 CONFIG=ONL=014",
1106 "SET SCU1 CONFIG=INT=0",
1107 "SET SCU1 CONFIG=LWR=0",
1108 "SET SCU1 CONFIG=CLOCK_DELTA=0",
1109
1110
1111
1112 "SET SCU2 CONFIG=MODE=program",
1113 "SET SCU2 CONFIG=PORT0=enable",
1114 "SET SCU2 CONFIG=PORT1=enable",
1115 "SET SCU2 CONFIG=PORT2=enable",
1116 "SET SCU2 CONFIG=PORT3=enable",
1117 "SET SCU2 CONFIG=PORT4=enable",
1118 "SET SCU2 CONFIG=PORT5=enable",
1119 "SET SCU2 CONFIG=PORT6=enable",
1120 "SET SCU2 CONFIG=PORT7=enable",
1121 "SET SCU2 CONFIG=MASKA=off",
1122 "SET SCU2 CONFIG=MASKB=off",
1123 "SET SCU2 CONFIG=LWRSTORESIZE=7",
1124 "SET SCU2 CONFIG=CYCLIC=0040",
1125 "SET SCU2 CONFIG=NEA=0200",
1126 "SET SCU2 CONFIG=ONL=014",
1127 "SET SCU2 CONFIG=INT=0",
1128 "SET SCU2 CONFIG=LWR=0",
1129 "SET SCU2 CONFIG=CLOCK_DELTA=0",
1130
1131
1132
1133 "SET SCU3 CONFIG=MODE=program",
1134 "SET SCU3 CONFIG=PORT0=enable",
1135 "SET SCU3 CONFIG=PORT1=enable",
1136 "SET SCU3 CONFIG=PORT2=enable",
1137 "SET SCU3 CONFIG=PORT3=enable",
1138 "SET SCU3 CONFIG=PORT4=enable",
1139 "SET SCU3 CONFIG=PORT5=enable",
1140 "SET SCU3 CONFIG=PORT6=enable",
1141 "SET SCU3 CONFIG=PORT7=enable",
1142 "SET SCU3 CONFIG=MASKA=off",
1143 "SET SCU3 CONFIG=MASKB=off",
1144 "SET SCU3 CONFIG=LWRSTORESIZE=7",
1145 "SET SCU3 CONFIG=CYCLIC=0040",
1146 "SET SCU3 CONFIG=NEA=0200",
1147 "SET SCU3 CONFIG=ONL=014",
1148 "SET SCU3 CONFIG=INT=0",
1149 "SET SCU3 CONFIG=LWR=0",
1150 "SET SCU3 CONFIG=CLOCK_DELTA=0",
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252 "SET FNP0 CONFIG=MAILBOX=03400",
1253 "SET FNP0 IPC_NAME=fnp-a",
1254 "SET FNP1 CONFIG=MAILBOX=03700",
1255 "SET FNP1 IPC_NAME=fnp-b",
1256 "SET FNP2 CONFIG=MAILBOX=04200",
1257 "SET FNP2 IPC_NAME=fnp-c",
1258 "SET FNP3 CONFIG=MAILBOX=04500",
1259 "SET FNP3 IPC_NAME=fnp-d",
1260 "SET FNP4 CONFIG=MAILBOX=05000",
1261 "SET FNP4 IPC_NAME=fnp-e",
1262 "SET FNP5 CONFIG=MAILBOX=05300",
1263 "SET FNP5 IPC_NAME=fnp-f",
1264 "SET FNP6 CONFIG=MAILBOX=05600",
1265 "SET FNP6 IPC_NAME=fnp-g",
1266 "SET FNP7 CONFIG=MAILBOX=06100",
1267 "SET FNP7 IPC_NAME=fnp-h",
1268
1269
1270
1271 "SET MTP0 BOOT_DRIVE=0",
1272 "SET MTP0 NAME=MTP0",
1273
1274 "CABLE IOM0 012 MTP0 0",
1275 "CABLE IOM1 012 MTP0 1",
1276 "CABLE MTP0 1 TAPE1",
1277 "SET TAPE1 NAME=tapa_01",
1278 "CABLE MTP0 2 TAPE2",
1279 "SET TAPE2 NAME=tapa_02",
1280 "CABLE MTP0 3 TAPE3",
1281 "SET TAPE3 NAME=tapa_03",
1282 "CABLE MTP0 4 TAPE4",
1283 "SET TAPE4 NAME=tapa_04",
1284 "CABLE MTP0 5 TAPE5",
1285 "SET TAPE5 NAME=tapa_05",
1286 "CABLE MTP0 6 TAPE6",
1287 "SET TAPE6 NAME=tapa_06",
1288 "CABLE MTP0 7 TAPE7",
1289 "SET TAPE7 NAME=tapa_07",
1290 "CABLE MTP0 8 TAPE8",
1291 "SET TAPE8 NAME=tapa_08",
1292 "CABLE MTP0 9 TAPE9",
1293 "SET TAPE9 NAME=tapa_09",
1294 "CABLE MTP0 10 TAPE10",
1295 "SET TAPE10 NAME=tapa_10",
1296 "CABLE MTP0 11 TAPE11",
1297 "SET TAPE11 NAME=tapa_11",
1298 "CABLE MTP0 12 TAPE12",
1299 "SET TAPE12 NAME=tapa_12",
1300 "CABLE MTP0 13 TAPE13",
1301 "SET TAPE13 NAME=tapa_13",
1302 "CABLE MTP0 14 TAPE14",
1303 "SET TAPE14 NAME=tapa_14",
1304 "CABLE MTP0 15 TAPE15",
1305 "SET TAPE15 NAME=tapa_15",
1306 "CABLE MTP0 16 TAPE16",
1307 "SET TAPE16 NAME=tapa_16",
1308
1309
1310
1311 "SET IPC0 NAME=IPC0",
1312 "CABLE IOM0 013 IPC0 0",
1313 "CABLE IOM1 013 IPC0 1",
1314
1315 "CABLE IPC0 0 DISK0",
1316 "SET DISK0 TYPE=3381",
1317 "SET DISK0 NAME=dska_00",
1318
1319 "cable IPC0 1 DISK1",
1320 "set disk1 type=3381",
1321 "set disk1 name=dska_01",
1322
1323 "CABLE IPC0 2 DISK2",
1324 "SET DISK2 TYPE=3381",
1325 "SET DISK2 NAME=dska_02",
1326
1327 "CABLE IPC0 3 DISK3",
1328 "SET DISK3 TYPE=3381",
1329 "SET DISK3 NAME=dska_03",
1330
1331
1332 "SET MSP0 NAME=MSP0",
1333 "CABLE IOM0 014 MSP0 0",
1334 "CABLE IOM1 014 MSP0 1",
1335
1336
1337 "CABLE MSP0 1 DISK4",
1338 "SET disk4 TYPE=d501",
1339 "SET disk4 NAME=dskb_01",
1340
1341 "CABLE MSP0 2 DISK5",
1342 "SET DISK5 TYPE=d501",
1343 "SET DISK5 NAME=dskb_02",
1344
1345 "CABLE MSP0 3 DISK6",
1346 "SET DISK6 TYPE=d501",
1347 "SET DISK6 NAME=dskb_03",
1348
1349 "CABLE MSP0 4 DISK7",
1350 "SET DISK7 TYPE=d501",
1351 "SET DISK7 NAME=dskb_04",
1352
1353
1354 "CABLE MSP0 5 DISK8",
1355 "SET DISK8 TYPE=d451",
1356 "SET DISK8 NAME=dskb_05",
1357
1358 "CABLE MSP0 6 DISK9",
1359 "SET DISK9 TYPE=d451",
1360 "SET DISK9 NAME=dskb_06",
1361
1362 "CABLE MSP0 7 DISK10",
1363 "SET DISK10 TYPE=d451",
1364 "SET DISK10 NAME=dskb_07",
1365
1366 "CABLE MSP0 8 DISK11",
1367 "SET DISK11 TYPE=d451",
1368 "SET DISK11 NAME=dskb_08",
1369
1370 "CABLE MSP0 9 DISK12",
1371 "SET DISK12 TYPE=d500",
1372 "SET DISK12 NAME=dskb_09",
1373
1374 "CABLE MSP0 10 DISK13",
1375 "SET DISK13 TYPE=d500",
1376 "SET DISK13 NAME=dskb_10",
1377
1378
1379
1380 "CABLE IPC0 4 DISK14",
1381 "SET DISK14 TYPE=3381",
1382 "SET DISK14 NAME=dska_04",
1383
1384 "CABLE IPC0 5 DISK15",
1385 "SET DISK15 TYPE=3381",
1386 "SET DISK15 NAME=dska_05",
1387
1388 "CABLE IPC0 6 DISK16",
1389 "SET DISK16 TYPE=3381",
1390 "SET DISK16 NAME=dska_06",
1391
1392 "CABLE IPC0 7 DISK17",
1393 "SET DISK17 TYPE=3381",
1394 "SET DISK17 NAME=dska_07",
1395
1396 "CABLE IPC0 8 DISK18",
1397 "SET DISK18 TYPE=3381",
1398 "SET DISK18 NAME=dska_08",
1399
1400 "CABLE IPC0 9 DISK19",
1401 "SET DISK19 TYPE=3381",
1402 "SET DISK19 NAME=dska_09",
1403
1404 "CABLE IPC0 10 DISK20",
1405 "SET DISK20 TYPE=3381",
1406 "SET DISK20 NAME=dska_10",
1407
1408 "CABLE IPC0 11 DISK21",
1409 "SET DISK21 TYPE=3381",
1410 "SET DISK21 NAME=dska_11",
1411
1412 "CABLE IPC0 12 DISK22",
1413 "SET DISK22 TYPE=3381",
1414 "SET DISK22 NAME=dska_12",
1415
1416 "CABLE IPC0 13 DISK23",
1417 "SET DISK23 TYPE=3381",
1418 "SET DISK23 NAME=dska_13",
1419
1420 "CABLE IPC0 14 DISK24",
1421 "SET DISK24 TYPE=3381",
1422 "SET DISK24 NAME=dska_14",
1423
1424 "CABLE IPC0 15 DISK25",
1425 "SET DISK25 TYPE=3381",
1426 "SET DISK25 NAME=dska_15",
1427
1428
1429 "CABLE IOMA 036 OPC0",
1430
1431 "CABLE IOMA 053 OPC1",
1432 "SET OPC1 CONFIG=MODEL=m6601",
1433
1434
1435
1436
1437
1438
1439
1440 "CABLE IOMA 020 FNPD",
1441
1442 "CABLE IOMA 021 FNPA",
1443
1444 "CABLE IOMA 022 FNPB",
1445
1446 "CABLE IOMA 023 FNPC",
1447
1448 "CABLE IOMA 024 FNPE",
1449
1450 "CABLE IOMA 025 FNPF",
1451
1452 "CABLE IOMA 026 FNPG",
1453
1454 "CABLE IOMA 027 FNPH",
1455
1456
1457
1458
1459
1460
1461 "CABLE IOM0 015 URP0",
1462 "SET URP0 NAME=urpa",
1463
1464
1465 "CABLE URP0 1 RDR0",
1466 "SET RDR0 NAME=rdra",
1467
1468
1469 "CABLE IOM0 016 URP1",
1470 "SET URP1 NAME=urpb",
1471
1472
1473 "CABLE URP1 1 PUN0",
1474 "SET PUN0 NAME=puna",
1475
1476
1477 "CABLE IOM0 017 URP2",
1478 "SET URP2 NAME=urpc",
1479
1480
1481 "CABLE URP2 1 PRT0",
1482 "SET PRT0 NAME=prta",
1483
1484
1485
1486 "CABLE IOMA 050 URP3",
1487 "SET URP3 NAME=urpd",
1488
1489
1490 "CABLE URP3 1 PRT1",
1491 "SET PRT1 NAME=prtb",
1492
1493
1494
1495 "CABLE IOMA 051 URP4",
1496 "SET URP4 NAME=urpe",
1497
1498
1499 "CABLE URP4 1 PRT2",
1500 "SET PRT2 NAME=prtc",
1501
1502
1503
1504 "CABLE IOMA 052 URP5",
1505 "SET URP5 NAME=urpf",
1506
1507
1508 "CABLE URP5 1 PRT3",
1509 "SET PRT3 NAME=prtd",
1510
1511
1512
1513 "CABLE IOMA 055 URP6",
1514 "SET URP6 NAME=urpg",
1515
1516
1517 "CABLE URP6 1 RDRB",
1518 "SET RDR1 NAME=rdrb",
1519
1520
1521 "CABLE IOMA 056 URP7",
1522 "SET URP7 NAME=urph",
1523
1524
1525 "CABLE URP7 1 RDRC",
1526 "SET RDR2 NAME=rdrc",
1527
1528
1529 "CABLE IOMA 057 URP8",
1530 "SET URP8 NAME=urpi",
1531
1532
1533 "CABLE URP8 1 PUNB",
1534 "SET PUN1 NAME=punb",
1535
1536
1537 "CABLE IOMA 060 URP9",
1538 "SET URP9 NAME=urpj",
1539
1540
1541 "CABLE URP9 1 PUNC",
1542 "SET PUN2 NAME=punc",
1543
1544 # if defined(WITH_SOCKET_DEV)
1545 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW32) && !defined(CROSS_MINGW64)
1546 "CABLE IOMA 040 SKCA",
1547 "CABLE IOMA 041 SKCB",
1548 "CABLE IOMA 042 SKCC",
1549 "CABLE IOMA 043 SKCD",
1550 "CABLE IOMA 044 SKCE",
1551 "CABLE IOMA 045 SKCF",
1552 "CABLE IOMA 046 SKCG",
1553 "CABLE IOMA 047 SKCH",
1554 # endif
1555 # endif
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621 # if defined(WITH_ABSI_DEV)
1622 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32)
1623
1624 "CABLE IOM0 032 ABSI0",
1625 # endif
1626 # endif
1627
1628 # if defined(WITH_MGP_DEV)
1629
1630 "CABLE IOM0 033 MGP0",
1631
1632 "CABLE IOM0 034 MGP1",
1633 # endif
1634
1635 # if defined(WITH_NET_DEV)
1636
1637 "CABLE IOM0 061 NET0",
1638
1639 "CABLE IOM0 062 NET1",
1640 # endif
1641
1642
1643 "CABLE SCU0 0 IOM0 0",
1644
1645
1646 "CABLE SCU1 0 IOM0 1",
1647
1648
1649 "CABLE SCU2 0 IOM0 2",
1650
1651
1652 "CABLE SCU3 0 IOM0 3",
1653
1654
1655 "CABLE SCU0 1 IOM1 0",
1656
1657
1658 "CABLE SCU1 1 IOM1 1",
1659
1660
1661 "CABLE SCU2 1 IOM1 2",
1662
1663
1664 "CABLE SCU3 1 IOM1 3",
1665
1666
1667
1668
1669 "CABLE SCU0 7 CPU0 0",
1670
1671
1672 "CABLE SCU0 6 CPU1 0",
1673
1674
1675 "CABLE SCU0 5 CPU2 0",
1676
1677
1678 "CABLE SCU0 4 CPU3 0",
1679
1680
1681 "CABLE SCU0 3 CPU4 0",
1682
1683
1684 "CABLE SCU0 2 CPU5 0",
1685
1686
1687
1688
1689 "CABLE SCU1 7 CPU0 1",
1690
1691
1692 "CABLE SCU1 6 CPU1 1",
1693
1694
1695 "CABLE SCU1 5 CPU2 1",
1696
1697
1698 "CABLE SCU1 4 CPU3 1",
1699
1700
1701 "CABLE SCU1 3 CPU4 1",
1702
1703
1704 "CABLE SCU1 2 CPU5 1",
1705
1706
1707
1708
1709 "CABLE SCU2 7 CPU0 2",
1710
1711
1712 "CABLE SCU2 6 CPU1 2",
1713
1714
1715 "CABLE SCU2 5 CPU2 2",
1716
1717
1718 "CABLE SCU2 4 CPU3 2",
1719
1720
1721 "CABLE SCU2 3 CPU4 2",
1722
1723
1724 "CABLE SCU2 2 CPU5 2",
1725
1726
1727
1728
1729 "CABLE SCU3 7 CPU0 3",
1730
1731
1732 "CABLE SCU3 6 CPU1 3",
1733
1734
1735 "CABLE SCU3 5 CPU2 3",
1736
1737
1738 "CABLE SCU3 4 CPU3 3",
1739
1740
1741 "CABLE SCU3 3 CPU4 3",
1742
1743
1744 "CABLE SCU3 2 CPU5 3",
1745
1746 "SET CPU0 RESET",
1747 "SET SCU0 RESET",
1748 "SET SCU1 RESET",
1749 "SET SCU2 RESET",
1750 "SET SCU3 RESET",
1751 "SET IOM0 RESET",
1752
1753 # if defined(THREADZ) || defined(LOCKLESS)
1754 "SET CPU NUNITS=6",
1755 # else
1756 "SET CPU NUNITS=1",
1757 # endif
1758
1759
1760 "SET SYS CONFIG=CONNECT_TIME=-1",
1761 };
1762
1763 void print_default_base_system_script (void)
1764 {
1765 int n_lines = sizeof (default_base_system_script) / sizeof (char *);
1766 sim_printf ("; DEFAULT_BASE_SYSTEM_SCRIPT (%lu lines follow)\r\n",
1767 (unsigned long)n_lines);
1768 for (int line = 0; line < n_lines; line ++)
1769 sim_printf ("%s\r\n", default_base_system_script[line]);
1770 }
1771
1772
1773
1774 static void do_ini_line (char * text)
1775 {
1776
1777 char gbuf[257];
1778 const char * cptr = get_glyph (text, gbuf, 0);
1779 CTAB *cmdp;
1780 if ((cmdp = find_cmd (gbuf)))
1781 {
1782 t_stat stat = cmdp->action (cmdp->arg, cptr);
1783 if (stat != SCPE_OK)
1784 sim_warn ("%s: %s\r\n", sim_error_text (SCPE_UNK), text);
1785 }
1786 else
1787 sim_warn ("%s: %s\r\n", sim_error_text (SCPE_UNK), text);
1788 }
1789
1790
1791
1792
1793 static t_stat set_default_base_system (UNUSED int32 arg, UNUSED const char * buf)
1794 {
1795 # if defined(PERF_STRIP)
1796 cpu_dev.numunits = 1;
1797 # else
1798 int n_lines = sizeof (default_base_system_script) / sizeof (char *);
1799 for (int line = 0; line < n_lines; line ++)
1800 do_ini_line (default_base_system_script [line]);
1801 # endif
1802 return SCPE_OK;
1803 }
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816 static t_stat boot_skip (int32 UNUSED arg, const char * buf)
1817 {
1818 uint32 skipped;
1819 uint unit = 0;
1820 if (buf && * buf && sscanf (buf, "%u", & unit) != 1)
1821 return SCPE_ARG;
1822 if (unit >= N_MT_UNITS_MAX)
1823 return SCPE_ARG;
1824 t_stat rc = sim_tape_sprecsf (& mt_unit[unit], 1, & skipped);
1825 if (rc == SCPE_OK)
1826 tape_states[unit].rec_num ++;
1827 return rc;
1828 }
1829
1830
1831
1832
1833
1834 static t_stat do_execute_fault (UNUSED int32 arg, UNUSED const char * buf)
1835 {
1836
1837 setG7fault (0, FAULT_EXF);
1838 return SCPE_OK;
1839 }
1840
1841
1842
1843
1844 static t_stat do_execute_switches (UNUSED int32 arg, UNUSED const char * buf)
1845 {
1846
1847 press_execute_switches (0);
1848 return SCPE_OK;
1849 }
1850
1851
1852
1853
1854
1855
1856 static t_stat do_restart (UNUSED int32 arg, UNUSED const char * buf)
1857 {
1858 if (sim_is_running)
1859 {
1860 sim_printf ("Don't restart a running system....\r\n");
1861 return SCPE_ARG;
1862 }
1863 int n = 010000;
1864 if (buf)
1865 {
1866 n = (int) strtol (buf, NULL, 0);
1867 }
1868 sim_printf ("Restart entry 0%o\r\n", n);
1869
1870 cpu_state_t * cpup = _cpup;
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884 cpu_reset_unit_idx (0, false);
1885 cpu.restart = true;
1886 cpu.restart_address = (uint) n;
1887
1888 t_stat rc = run_cmd (RU_CONT, "");
1889 return rc;
1890 }
1891
1892 static t_stat set_sys_polling_interval (UNUSED int32 arg, const char * buf)
1893 {
1894 if (! buf)
1895 return SCPE_ARG;
1896 int n = atoi (buf);
1897 if (n < 1 || n > 1000)
1898 {
1899 sim_printf ("POLL %d: must be 1 (1 millisecond) to 1000 (1 second)\r\n", n);
1900 return SCPE_ARG;
1901 }
1902 sim_printf ("Polling set to %d milliseconds\r\n", n);
1903 sys_opts.sys_poll_interval = (uint) n;
1904 return SCPE_OK;
1905 }
1906
1907 static t_stat set_sys_slow_polling_interval (UNUSED int32 arg, const char * buf)
1908 {
1909 if (! buf)
1910 return SCPE_ARG;
1911 int n = atoi (buf);
1912 if (n < 1 || n > 1000)
1913 {
1914 sim_printf ("SLOWPOLL %d: must be 1 (1 slow poll per pol) to 1000 (1 slow poll per 1000 polls)\r\n", n);
1915 return SCPE_ARG;
1916 }
1917 sim_printf ("Slow polling set to %d polls\r\n", n);
1918 sys_opts.sys_slow_poll_interval = (uint) n;
1919 return SCPE_OK;
1920 }
1921
1922 static t_stat set_sys_poll_check_rate (UNUSED int32 arg, const char * buf)
1923 {
1924 if (! buf)
1925 return SCPE_ARG;
1926 int n = atoi (buf);
1927 if (n < 1 || n > 1024*1024)
1928 {
1929 sim_printf ("CHECKPOLL %d: must be 1 (check every cycle) to 1048576 (check every million cycles\r\n", n);
1930 return SCPE_ARG;
1931 }
1932 sim_printf ("Poll check rate set to %d CPU cycles\r\n", n);
1933 sys_opts.sys_poll_check_rate = (uint) n;
1934 return SCPE_OK;
1935 }
1936 #endif
1937
1938
1939
1940
1941
1942 #if defined(TESTING)
1943
1944
1945
1946
1947 uint64 sim_deb_start = 0;
1948
1949 uint64 sim_deb_stop = 0;
1950
1951 uint64 sim_deb_break = 0;
1952
1953 bool sim_deb_segno_on = false;
1954 # if defined(NO_C_ELLIPSIS)
1955 bool sim_deb_segno[DEBUG_SEGNO_LIMIT];
1956 # else
1957 bool sim_deb_segno[DEBUG_SEGNO_LIMIT] = { [0 ... DEBUG_SEGNO_LIMIT - 1] = false };
1958 # endif
1959
1960 uint64 sim_deb_ringno = NO_SUCH_RINGNO;
1961
1962
1963 uint64 sim_deb_skip_limit = 0;
1964
1965
1966 uint64 sim_deb_skip_cnt = 0;
1967
1968
1969 uint64 sim_deb_mme_cntdwn = 0;
1970
1971 uint dbgCPUMask = 0377;
1972
1973
1974 bool sim_deb_bar = false;
1975
1976
1977
1978 static t_stat dps_debug_mme_cntdwn (UNUSED int32 arg, const char * buf)
1979 {
1980 sim_deb_mme_cntdwn = strtoull (buf, NULL, 0);
1981 sim_msg ("Debug MME countdown set to %llu\r\n", (long long unsigned int)sim_deb_mme_cntdwn);
1982 return SCPE_OK;
1983 }
1984
1985 static t_stat dps_debug_skip (UNUSED int32 arg, const char * buf)
1986 {
1987 sim_deb_skip_cnt = 0;
1988 sim_deb_skip_limit = strtoull (buf, NULL, 0);
1989 sim_msg ("Debug skip set to %llu\r\n", (long long unsigned int)sim_deb_skip_limit);
1990 return SCPE_OK;
1991 }
1992
1993 static t_stat dps_debug_start (UNUSED int32 arg, const char * buf)
1994 {
1995 sim_deb_start = strtoull (buf, NULL, 0);
1996 sim_msg ("Debug set to start at cycle: %llu\r\n", (long long unsigned int)sim_deb_start);
1997 return SCPE_OK;
1998 }
1999
2000 static t_stat dps_debug_stop (UNUSED int32 arg, const char * buf)
2001 {
2002 sim_deb_stop = strtoull (buf, NULL, 0);
2003 sim_msg ("Debug set to stop at cycle: %llu\r\n", (long long unsigned int)sim_deb_stop);
2004 return SCPE_OK;
2005 }
2006
2007 static t_stat dps_debug_break (UNUSED int32 arg, const char * buf)
2008 {
2009 sim_deb_break = strtoull (buf, NULL, 0);
2010 if (buf[0] == '+')
2011 sim_deb_break += sim_deb_start;
2012 sim_msg ("Debug set to break at cycle: %llu\r\n", (long long unsigned int)sim_deb_break);
2013 return SCPE_OK;
2014 }
2015
2016 static t_stat dps_debug_segno (int32 arg, const char * buf)
2017 {
2018 if (arg)
2019 {
2020 unsigned long segno = strtoul (buf, NULL, 0);
2021 if (segno >= DEBUG_SEGNO_LIMIT)
2022 {
2023 sim_printf ("out of range; 0 to %u %d.\r\n", DEBUG_SEGNO_LIMIT, DEBUG_SEGNO_LIMIT);
2024 return SCPE_ARG;
2025 }
2026 sim_deb_segno[segno] = true;
2027 sim_deb_segno_on = true;
2028 sim_msg ("Debug set for segno %llo %llu.\r\n",
2029 (long long unsigned int)segno, (long long unsigned int) segno);
2030 }
2031 else
2032 {
2033 (void)memset (sim_deb_segno, 0, sizeof (sim_deb_segno));
2034 sim_deb_segno_on = false;
2035 sim_msg ("Debug set for all segments\r\n");
2036 }
2037 return SCPE_OK;
2038 }
2039
2040 static t_stat dps_debug_ringno (UNUSED int32 arg, const char * buf)
2041 {
2042 sim_deb_ringno = strtoull (buf, NULL, 0);
2043 sim_msg ("Debug set to ringno %llo\r\n", (long long unsigned int)sim_deb_ringno);
2044 return SCPE_OK;
2045 }
2046
2047 static t_stat dps_debug_bar (int32 arg, UNUSED const char * buf)
2048 {
2049 sim_deb_bar = arg;
2050 if (arg)
2051 sim_msg ("Debug set BAR %llo\r\n", (long long unsigned int)sim_deb_ringno);
2052 else
2053 sim_msg ("Debug unset BAR %llo\r\n", (long long unsigned int)sim_deb_ringno);
2054 return SCPE_OK;
2055 }
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269 static t_stat abs_addr_n (int segno, uint offset)
2270 {
2271 word24 res;
2272
2273
2274 if (dbgLookupAddress ((word18) segno, offset, & res, NULL))
2275 return SCPE_ARG;
2276
2277 sim_msg ("Address is %08o\r\n", res);
2278 return SCPE_OK;
2279 }
2280
2281
2282
2283
2284 static t_stat abs_addr (UNUSED int32 arg, const char * buf)
2285 {
2286 uint segno;
2287 uint offset;
2288 if (sscanf (buf, "%o:%o", & segno, & offset) != 2)
2289 return SCPE_ARG;
2290 return abs_addr_n ((int) segno, offset);
2291 }
2292
2293
2294
2295
2296
2297
2298 # define BOOT_SEGMENTS_MAX 1024
2299 # define BOOT_COMPONENTS_MAX 4096
2300 # define BOOK_SEGMENT_NAME_LEN 33
2301
2302 static struct book_segment
2303 {
2304 char * segname;
2305 int segno;
2306 } book_segments[BOOT_SEGMENTS_MAX];
2307
2308 static int n_book_segments = 0;
2309
2310 static struct book_component
2311 {
2312 char * compname;
2313 int book_segment_number;
2314 uint txt_start, txt_length;
2315 int intstat_start, intstat_length, symbol_start, symbol_length;
2316 } book_components[BOOT_COMPONENTS_MAX];
2317
2318 static int n_book_components = 0;
2319
2320 static int lookup_book_segment (char * name)
2321 {
2322 for (int i = 0; i < n_book_segments; i ++)
2323 if (strcmp (name, book_segments[i].segname) == 0)
2324 return i;
2325 return -1;
2326 }
2327
2328 static int add_book_segment (char * name, int segno)
2329 {
2330 int n = lookup_book_segment (name);
2331 if (n >= 0)
2332 return n;
2333 if (n_book_segments >= BOOT_SEGMENTS_MAX)
2334 return -1;
2335 book_segments[n_book_segments].segname = strdup (name);
2336 if (!book_segments[n_book_segments].segname)
2337 {
2338 (void)sir_emerg ("FATAL: Out of memory! Aborting at %s[%s:%d]",
2339 __func__, __FILE__, __LINE__);
2340 # if defined(USE_BACKTRACE)
2341 # if defined(SIGUSR2)
2342 (void)raise(SIGUSR2);
2343
2344 # endif
2345 # endif
2346 abort();
2347 }
2348 book_segments[n_book_segments].segno = segno;
2349 n = n_book_segments;
2350 n_book_segments ++;
2351 return n;
2352 }
2353
2354 static int add_book_component (int segnum, char * name, uint txt_start,
2355 uint txt_length, int intstat_start,
2356 int intstat_length, int symbol_start,
2357 int symbol_length)
2358 {
2359 if (n_book_components >= BOOT_COMPONENTS_MAX)
2360 return -1;
2361 book_components[n_book_components].compname = strdup (name);
2362 if (!book_components[n_book_components].compname)
2363 {
2364 (void)sir_emerg ("FATAL: Out of memory! Aborting at %s[%s:%d]",
2365 __func__, __FILE__, __LINE__);
2366 # if defined(USE_BACKTRACE)
2367 # if defined(SIGUSR2)
2368 (void)raise(SIGUSR2);
2369
2370 # endif
2371 # endif
2372 abort();
2373 }
2374 book_components[n_book_components].book_segment_number = segnum;
2375 book_components[n_book_components].txt_start = txt_start;
2376 book_components[n_book_components].txt_length = txt_length;
2377 book_components[n_book_components].intstat_start = intstat_start;
2378 book_components[n_book_components].intstat_length = intstat_length;
2379 book_components[n_book_components].symbol_start = symbol_start;
2380 book_components[n_book_components].symbol_length = symbol_length;
2381 int n = n_book_components;
2382 n_book_components ++;
2383 return n;
2384 }
2385
2386
2387
2388
2389
2390 static char * lookup_system_book_address (word18 segno, word18 offset,
2391 char * * compname, word18 * compoffset)
2392 {
2393 static char buf[129];
2394 int i;
2395
2396 for (i = 0; i < n_book_segments; i ++)
2397 if (book_segments[i].segno == (int) segno)
2398 break;
2399
2400 if (i >= n_book_segments)
2401 return NULL;
2402
2403 int best = -1;
2404 uint bestoffset = 0;
2405
2406 for (int j = 0; j < n_book_components; j ++)
2407 {
2408 if (book_components[j].book_segment_number != i)
2409 continue;
2410 if (book_components[j].txt_start <= offset &&
2411 book_components[j].txt_start + book_components[j].txt_length > offset)
2412 {
2413 (void)sprintf (buf, "%s:%s+0%0o", book_segments[i].segname,
2414 book_components[j].compname,
2415 offset - book_components[j].txt_start);
2416 if (compname)
2417 * compname = book_components[j].compname;
2418 if (compoffset)
2419 * compoffset = offset - book_components[j].txt_start;
2420 return buf;
2421 }
2422 if (book_components[j].txt_start <= offset &&
2423 book_components[j].txt_start > bestoffset)
2424 {
2425 best = j;
2426 bestoffset = book_components[j].txt_start;
2427 }
2428 }
2429
2430 if (best != -1)
2431 {
2432
2433
2434 if (compname)
2435 * compname = book_components[best].compname;
2436 if (compoffset)
2437 * compoffset = offset - book_components[best].txt_start;
2438 (void)sprintf (buf, "%s:%s+0%0o", book_segments[i].segname,
2439 book_components[best].compname,
2440 offset - book_components[best].txt_start);
2441 return buf;
2442 }
2443
2444
2445
2446
2447 if (compname)
2448 * compname = book_segments[i].segname;
2449 if (compoffset)
2450 * compoffset = offset;
2451 (void)sprintf (buf, "%s:+0%0o", book_segments[i].segname,
2452 offset);
2453 return buf;
2454 }
2455
2456
2457
2458
2459 char * lookup_address (word18 segno, word18 offset, char * * compname,
2460 word18 * compoffset)
2461 {
2462 if (compname)
2463 * compname = NULL;
2464 if (compoffset)
2465 * compoffset = 0;
2466
2467
2468
2469
2470
2471
2472
2473
2474 if (segno == 0322)
2475 segno = 0162;
2476 if (segno == 0310)
2477 segno = 041;
2478 if (segno == 0314)
2479 segno = 041;
2480 if (segno == 0313)
2481 segno = 040;
2482 if (segno == 0317)
2483 segno = 0161;
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516 char * ret = lookup_system_book_address (segno, offset, compname, compoffset);
2517 return ret;
2518 }
2519
2520
2521
2522
2523
2524 static int lookup_system_book_name (char * segname, char * compname, long * segno,
2525 long * offset)
2526 {
2527 int i;
2528 for (i = 0; i < n_book_segments; i ++)
2529 if (strcmp (book_segments[i].segname, segname) == 0)
2530 break;
2531 if (i >= n_book_segments)
2532 return -1;
2533
2534 for (int j = 0; j < n_book_components; j ++)
2535 {
2536 if (book_components[j].book_segment_number != i)
2537 continue;
2538 if (strcmp (book_components[j].compname, compname) == 0)
2539 {
2540 * segno = book_segments[i].segno;
2541 * offset = (long) book_components[j].txt_start;
2542 return 0;
2543 }
2544 }
2545
2546 return -1;
2547 }
2548
2549 static char * source_search_path = NULL;
2550
2551
2552
2553
2554
2555
2556 void list_source (char * compname, word18 offset, uint dflag)
2557 {
2558 cpu_state_t * cpup = _cpup;
2559 const int offset_str_len = 10;
2560
2561 char offset_str[17];
2562 (void)sprintf (offset_str, " %06o", offset);
2563
2564 char path[(source_search_path ? strlen (source_search_path) : 1) +
2565 1 +
2566 (compname ? strlen (compname) : 1) +
2567 1 + strlen (".list") + 1];
2568 char * searchp = source_search_path ? source_search_path : ".";
2569
2570 while (* searchp)
2571 {
2572 size_t pathlen = strcspn (searchp, ":");
2573 strncpy (path, searchp, pathlen);
2574 path[pathlen] = '\0';
2575 if (searchp[pathlen] == ':')
2576 searchp += pathlen + 1;
2577 else
2578 searchp += pathlen;
2579
2580 if (compname)
2581 {
2582 strcat (path, "/");
2583 strcat (path, compname);
2584 }
2585 strcat (path, ".list");
2586
2587 FILE * listing = fopen (path, "r");
2588 if (listing)
2589 {
2590 char line[1025];
2591 if (feof (listing))
2592 goto fileDone;
2593 fgets (line, 1024, listing);
2594 if (strncmp (line, "ASSEMBLY LISTING", 16) == 0)
2595 {
2596
2597
2598
2599
2600
2601 while (! feof (listing))
2602 {
2603 fgets (line, 1024, listing);
2604 if (strncmp (line, offset_str, (size_t) offset_str_len) == 0)
2605 {
2606 if (! dflag)
2607 sim_msg ("%s", line);
2608 else
2609 sim_debug (dflag, & cpu_dev, "%s", line);
2610
2611 }
2612 if (strcmp (line, "\fLITERALS\n") == 0)
2613 break;
2614 }
2615 }
2616 else if (strncmp (line, "\tCOMPILATION LISTING", 20) == 0)
2617 {
2618
2619
2620
2621
2622
2623 bool foundTable = false;
2624 while (! feof (listing))
2625 {
2626 fgets (line, 1024, listing);
2627 if (strncmp (line, " LINE LOC", 14) != 0)
2628 continue;
2629 foundTable = true;
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644 int best = -1;
2645 char bestLines[8] = {0, 0, 0, 0, 0, 0, 0};
2646 while (! feof (listing))
2647 {
2648 int loc[7];
2649 char linenos[7][8];
2650 (void)memset (linenos, 0, sizeof (linenos));
2651 fgets (line, 1024, listing);
2652
2653 while (strncmp (line,
2654 " ", 8 + 6 + 3) == 0)
2655 memmove (line, line + 8 + 6 + 3,
2656 strlen (line + 8 + 6 + 3));
2657
2658
2659 int cnt = sscanf (line,
2660
2661 "%8c%o%*3c"
2662 "%8c%o%*3c"
2663 "%8c%o%*3c"
2664 "%8c%o%*3c"
2665 "%8c%o%*3c"
2666 "%8c%o%*3c"
2667 "%8c%o",
2668 (char *) & linenos[0], (uint *) & loc[0],
2669 (char *) & linenos[1], (uint *) & loc[1],
2670 (char *) & linenos[2], (uint *) & loc[2],
2671 (char *) & linenos[3], (uint *) & loc[3],
2672 (char *) & linenos[4], (uint *) & loc[4],
2673 (char *) & linenos[5], (uint *) & loc[5],
2674 (char *) & linenos[6], (uint *) & loc[6]);
2675 if (! (cnt == 2 || cnt == 4 || cnt == 6 ||
2676 cnt == 8 || cnt == 10 || cnt == 12 ||
2677 cnt == 14))
2678 break;
2679 int n;
2680 for (n = 0; n < cnt / 2; n ++)
2681 {
2682 if (loc[n] > best && loc[n] <= (int) offset)
2683 {
2684 best = loc[n];
2685 memcpy (bestLines, linenos[n],
2686 sizeof (bestLines));
2687 }
2688 }
2689 if (best == (int) offset)
2690 break;
2691 }
2692 if (best == -1)
2693 goto fileDone;
2694
2695
2696
2697
2698
2699
2700 char searchPrefix[10];
2701 searchPrefix[0] = ' ';
2702 searchPrefix[1] = bestLines[0];
2703 searchPrefix[2] = bestLines[1];
2704 searchPrefix[3] = ' ';
2705 searchPrefix[4] = bestLines[2];
2706 searchPrefix[5] = bestLines[3];
2707 searchPrefix[6] = bestLines[4];
2708 searchPrefix[7] = bestLines[5];
2709 searchPrefix[8] = bestLines[6];
2710
2711
2712 searchPrefix[9] = '\0';
2713
2714
2715 rewind (listing);
2716 while (! feof (listing))
2717 {
2718 fgets (line, 1024, listing);
2719 if (strncmp (line, "\f\tSOURCE", 8) == 0)
2720 goto fileDone;
2721 char prefix[10];
2722 strncpy (prefix, line, 9);
2723 prefix[9] = '\0';
2724 if (strcmp (prefix, searchPrefix) != 0)
2725 continue;
2726
2727 if (!dflag)
2728 sim_msg ("%s", line);
2729 else
2730 sim_debug (dflag, & cpu_dev, "%s", line);
2731
2732 }
2733 goto fileDone;
2734 }
2735 if (! foundTable)
2736 {
2737
2738 rewind (listing);
2739 while (! feof (listing))
2740 {
2741 fgets (line, 1024, listing);
2742 if (strncmp (line,
2743 offset_str + 4,
2744 offset_str_len - 4) == 0)
2745 {
2746 if (! dflag)
2747 sim_msg ("%s", line);
2748 else
2749 sim_debug (dflag, & cpu_dev, "%s", line);
2750
2751 }
2752
2753
2754 }
2755 }
2756 }
2757
2758 fileDone:
2759 fclose (listing);
2760 }
2761 }
2762 }
2763
2764
2765
2766 static t_stat stack_trace (UNUSED int32 arg, UNUSED const char * buf)
2767 {
2768 cpu_state_t * cpup = _cpup;
2769 char * msg;
2770
2771 word15 icSegno = cpu.PPR.PSR;
2772 word18 icOffset = cpu.PPR.IC;
2773
2774 sim_msg ("Entry ptr %05o:%06o\r\n", icSegno, icOffset);
2775
2776 char * compname;
2777 word18 compoffset;
2778 char * where = lookup_address (icSegno, icOffset,
2779 & compname, & compoffset);
2780 if (where)
2781 {
2782 sim_msg ("%05o:%06o %s\r\n", icSegno, icOffset, where);
2783 list_source (compname, compoffset, 0);
2784 }
2785 sim_msg ("\r\n");
2786
2787
2788
2789
2790
2791
2792
2793
2794 word15 fpSegno = cpu.PR[6].SNR;
2795 word18 fpOffset = cpu.PR[6].WORDNO;
2796
2797 for (uint frameNo = 1; ; frameNo ++)
2798 {
2799 sim_msg ("Frame %d %05o:%06o\r\n",
2800 frameNo, fpSegno, fpOffset);
2801
2802 word24 fp;
2803 if (dbgLookupAddress (fpSegno, fpOffset, & fp, & msg))
2804 {
2805 sim_msg ("can't lookup fp (%05o:%06o) because %s\r\n",
2806 fpSegno, fpOffset, msg);
2807 break;
2808 }
2809
2810 word15 prevfpSegno = (word15) ((M[fp + 16] >> 18) & MASK15);
2811 word18 prevfpOffset = (word18) ((M[fp + 17] >> 18) & MASK18);
2812
2813 sim_msg ("Previous FP %05o:%06o\r\n", prevfpSegno, prevfpOffset);
2814
2815 word15 returnSegno = (word15) ((M[fp + 20] >> 18) & MASK15);
2816 word18 returnOffset = (word18) ((M[fp + 21] >> 18) & MASK18);
2817
2818 sim_msg ("Return ptr %05o:%06o\r\n", returnSegno, returnOffset);
2819
2820 if (returnOffset == 0)
2821 {
2822 if (frameNo == 1)
2823 {
2824
2825 sim_msg ("guessing X7 has a return address....\r\n");
2826 where = lookup_address (icSegno, cpu.rX[7] - 1,
2827 & compname, & compoffset);
2828 if (where)
2829 {
2830 sim_msg ("%05o:%06o %s\r\n", icSegno, cpu.rX[7] - 1, where);
2831 list_source (compname, compoffset, 0);
2832 }
2833 }
2834 }
2835 else
2836 {
2837 where = lookup_address (returnSegno, returnOffset - 1,
2838 & compname, & compoffset);
2839 if (where)
2840 {
2841 sim_msg ("%05o:%06o %s\r\n",
2842 returnSegno, returnOffset - 1, where);
2843 list_source (compname, compoffset, 0);
2844 }
2845 }
2846
2847 word15 entrySegno = (word15) ((M[fp + 22] >> 18) & MASK15);
2848 word18 entryOffset = (word18) ((M[fp + 23] >> 18) & MASK18);
2849
2850 sim_msg ("Entry ptr %05o:%06o\r\n", entrySegno, entryOffset);
2851
2852 where = lookup_address (entrySegno, entryOffset,
2853 & compname, & compoffset);
2854 if (where)
2855 {
2856 sim_msg ("%05o:%06o %s\r\n", entrySegno, entryOffset, where);
2857 list_source (compname, compoffset, 0);
2858 }
2859
2860 word15 argSegno = (word15) ((M[fp + 26] >> 18) & MASK15);
2861 word18 argOffset = (word18) ((M[fp + 27] >> 18) & MASK18);
2862 sim_msg ("Arg ptr %05o:%06o\r\n", argSegno, argOffset);
2863
2864 word24 ap;
2865 if (dbgLookupAddress (argSegno, argOffset, & ap, & msg))
2866 {
2867 sim_msg ("can't lookup arg ptr (%05o:%06o) because %s\r\n",
2868 argSegno, argOffset, msg);
2869 goto skipArgs;
2870 }
2871
2872 word16 argCount = (word16) ((M[ap + 0] >> 19) & MASK17);
2873 word18 callType = (word18) (M[ap + 0] & MASK18);
2874 word16 descCount = (word16) ((M[ap + 1] >> 19) & MASK17);
2875 sim_msg ("arg_count %d\r\n", argCount);
2876 switch (callType)
2877 {
2878 case 0u:
2879 sim_msg ("call_type Quick internal call\r\n");
2880 break;
2881 case 4u:
2882 sim_msg ("call_type Inter-segment\r\n");
2883 break;
2884 case 8u:
2885 sim_msg ("call_type Environment pointer\r\n");
2886 break;
2887 default:
2888 sim_msg ("call_type Unknown (%o)\r\n", callType);
2889 goto skipArgs;
2890 }
2891 sim_msg ("desc_count %d\r\n", descCount);
2892
2893
2894
2895
2896
2897
2898
2899
2900 {
2901 for (uint argno = 0; argno < argCount; argno ++)
2902 {
2903 uint argnoos = ap + 2 + argno * 2;
2904 word15 argnoSegno = (word15) ((M[argnoos] >> 18) & MASK15);
2905 word18 argnoOffset = (word18) ((M[argnoos + 1] >> 18) & MASK18);
2906 word24 argnop;
2907 if (dbgLookupAddress (argnoSegno, argnoOffset, & argnop, & msg))
2908 {
2909 sim_msg ("can't lookup arg%d ptr (%05o:%06o) because %s\r\n",
2910 argno, argSegno, argOffset, msg);
2911 continue;
2912 }
2913 word36 argv = M[argnop];
2914 sim_msg ("arg%d value %05o:%06o[%08o] "
2915 "%012llo (%llu)\r\n",
2916 argno, argSegno, argOffset, argnop,
2917 (unsigned long long int)argv, (unsigned long long int)argv);
2918 sim_msg ("\r\n");
2919 }
2920 }
2921 skipArgs:;
2922
2923 sim_msg ("End of frame %d\r\n\r\n", frameNo);
2924
2925 if (prevfpSegno == 077777 && prevfpOffset == 1)
2926 break;
2927 fpSegno = prevfpSegno;
2928 fpOffset = prevfpOffset;
2929 }
2930 return SCPE_OK;
2931 }
2932
2933 static t_stat list_source_at (UNUSED int32 arg, UNUSED const char * buf)
2934 {
2935
2936 uint segno;
2937 uint offset;
2938 if (sscanf (buf, "%o:%o", & segno, & offset) != 2)
2939 return SCPE_ARG;
2940 char * compname;
2941 word18 compoffset;
2942 char * where = lookup_address ((word18) segno, offset,
2943 & compname, & compoffset);
2944 if (where)
2945 {
2946 sim_msg ("%05o:%06o %s\r\n", segno, offset, where);
2947 list_source (compname, compoffset, 0);
2948 }
2949 return SCPE_OK;
2950 }
2951
2952 static t_stat load_system_book (UNUSED int32 arg, UNUSED const char * buf)
2953 {
2954
2955 # if !defined(SPEED)
2956
2957 uint c3 = 0244;
2958
2959 # define bufSz 257
2960 char filebuf[bufSz];
2961 int current = -1;
2962
2963 FILE * fp = fopen (buf, "r");
2964 if (! fp)
2965 {
2966 sim_msg ("error opening file %s\r\n", buf);
2967 return SCPE_ARG;
2968 }
2969 for (;;)
2970 {
2971 char * bufp = fgets (filebuf, bufSz, fp);
2972 if (! bufp)
2973 break;
2974
2975 char name[BOOK_SEGMENT_NAME_LEN];
2976 uint segno, p0, p1, p2;
2977
2978
2979 int cnt = sscanf (filebuf, "%32s %o (%o, %o, %o)", name, & segno,
2980 & p0, & p1, & p2);
2981 if (filebuf[0] != '\t' && cnt == 5)
2982 {
2983
2984 int rc = add_book_segment (name, (int) segno);
2985 if (rc < 0)
2986 {
2987 sim_warn ("error adding segment name\r\n");
2988 fclose (fp);
2989 return SCPE_ARG;
2990 }
2991 continue;
2992 }
2993 else
2994 {
2995
2996
2997 cnt = sscanf (filebuf, "%32s (%o, %o, %o)", name,
2998 & p0, & p1, & p2);
2999 if (filebuf[0] != '\t' && cnt == 4)
3000 {
3001 if (strstr (name, "fw.") || strstr (name, ".ec"))
3002 continue;
3003
3004 int rc = add_book_segment (name, (int) (c3 ++));
3005 if (rc < 0)
3006 {
3007 sim_warn ("error adding segment name\r\n");
3008 fclose (fp);
3009 return SCPE_ARG;
3010 }
3011 continue;
3012 }
3013 }
3014 cnt = sscanf (filebuf, "Bindmap for >ldd>h>e>%32s", name);
3015 if (cnt != 1)
3016 cnt = sscanf (filebuf, "Bindmap for >ldd>hard>e>%32s", name);
3017 if (cnt == 1)
3018 {
3019
3020
3021 int rc = lookup_book_segment (name);
3022 if (rc < 0)
3023 {
3024
3025
3026
3027 current = -1;
3028 continue;
3029
3030
3031 }
3032 current = rc;
3033 continue;
3034 }
3035
3036 uint txt_start, txt_length;
3037 int intstat_start, intstat_length, symbol_start, symbol_length;
3038 cnt = sscanf (filebuf, "%32s %o %o %o %o %o %o", name, & txt_start,
3039 & txt_length, & intstat_start, & intstat_length,
3040 & symbol_start, & symbol_length);
3041
3042 if (cnt == 7)
3043 {
3044
3045 if (current >= 0)
3046 {
3047 add_book_component (current, name, txt_start, txt_length,
3048 intstat_start, intstat_length, symbol_start,
3049 symbol_length);
3050 }
3051 continue;
3052 }
3053
3054 cnt = sscanf (filebuf, "%32s %o (%o, %o, %o)", name, & segno,
3055 & p0, & p1, & p2);
3056 if (filebuf[0] == '\t' && cnt == 5)
3057 {
3058
3059 int rc = add_book_segment (name, (int) segno);
3060 if (rc < 0)
3061 {
3062 sim_warn ("error adding segment name\r\n");
3063 fclose (fp);
3064 return SCPE_ARG;
3065 }
3066 continue;
3067 }
3068
3069 }
3070 fclose (fp);
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092 # endif
3093 return SCPE_OK;
3094 }
3095
3096 static t_stat add_system_book_entry (UNUSED int32 arg, const char * buf)
3097 {
3098
3099
3100 char segname[BOOK_SEGMENT_NAME_LEN];
3101 char compname[BOOK_SEGMENT_NAME_LEN];
3102 uint segno;
3103 uint txt_start, txt_len;
3104 uint intstat_start, intstat_length;
3105 uint symbol_start, symbol_length;
3106
3107
3108 if (sscanf (buf, "%32s %32s %o %o %o %o %o %o %o",
3109 segname, compname, & segno,
3110 & txt_start, & txt_len, & intstat_start, & intstat_length,
3111 & symbol_start, & symbol_length) != 9)
3112 return SCPE_ARG;
3113
3114 int idx = add_book_segment (segname, (int) segno);
3115 if (idx < 0)
3116 return SCPE_ARG;
3117
3118 if (add_book_component (idx, compname, txt_start, txt_len, (int) intstat_start,
3119 (int) intstat_length, (int) symbol_start,
3120 (int) symbol_length) < 0)
3121 return SCPE_ARG;
3122
3123 return SCPE_OK;
3124 }
3125
3126
3127
3128
3129
3130
3131
3132 static t_stat lookup_system_book (UNUSED int32 arg, const char * buf)
3133 {
3134 char w1[strlen (buf)];
3135 char w2[strlen (buf)];
3136 char w3[strlen (buf)];
3137 long segno, offset;
3138
3139 size_t colon = strcspn (buf, ":");
3140 if (buf[colon] != ':')
3141 return SCPE_ARG;
3142
3143 strncpy (w1, buf, colon);
3144 w1[colon] = '\0';
3145
3146
3147 size_t plus = strcspn (buf + colon + 1, "+");
3148 if (buf[colon + 1 + plus] == '+')
3149 {
3150 strncpy (w2, buf + colon + 1, plus);
3151 w2[plus] = '\0';
3152 (void)strcpy (w3, buf + colon + 1 + plus + 1);
3153 }
3154 else
3155 {
3156 (void)strcpy (w2, buf + colon + 1);
3157 (void)strcpy (w3, "");
3158 }
3159
3160
3161
3162
3163 char * end1;
3164 segno = strtol (w1, & end1, 8);
3165 char * end2;
3166 offset = strtol (w2, & end2, 8);
3167
3168 if (* end1 == '\0' && * end2 == '\0' && * w3 == '\0')
3169 {
3170
3171 char * ans = lookup_address ((word18) segno, (word18) offset, NULL, NULL);
3172 sim_warn ("%s\r\n", ans ? ans : "not found");
3173 }
3174 else
3175 {
3176 if (* w3)
3177 {
3178 char * end3;
3179 offset = strtol (w3, & end3, 8);
3180 if (* end3 != '\0')
3181 return SCPE_ARG;
3182 }
3183 else
3184 offset = 0;
3185 long comp_offset;
3186 int rc = lookup_system_book_name (w1, w2, & segno, & comp_offset);
3187 if (rc)
3188 {
3189 sim_warn ("not found\r\n");
3190 return SCPE_OK;
3191 }
3192 sim_msg ("0%o:0%o\r\n", (uint) segno, (uint) (comp_offset + offset));
3193 abs_addr_n ((int) segno, (uint) (comp_offset + offset));
3194 }
3195
3196
3197
3198
3199
3200
3201 return SCPE_OK;
3202 }
3203
3204
3205
3206 static sdw0_s *fetchSDW (word15 segno)
3207 {
3208 cpu_state_t * cpup = _cpup;
3209 word36 SDWeven, SDWodd;
3210
3211 core_read2 (cpup, (cpu.DSBR.ADDR + 2u * segno) & PAMASK, & SDWeven, & SDWodd,
3212 __func__);
3213
3214
3215
3216 sdw0_s *SDW = & cpu._s;
3217 (void)memset (SDW, 0, sizeof (cpu._s));
3218
3219 SDW->ADDR = (SDWeven >> 12) & 077777777;
3220 SDW->R1 = (SDWeven >> 9) & 7;
3221 SDW->R2 = (SDWeven >> 6) & 7;
3222 SDW->R3 = (SDWeven >> 3) & 7;
3223 SDW->DF = TSTBIT (SDWeven, 2);
3224 SDW->FC = SDWeven & 3;
3225
3226
3227 SDW->BOUND = (SDWodd >> 21) & 037777;
3228 SDW->R = TSTBIT (SDWodd, 20);
3229 SDW->E = TSTBIT (SDWodd, 19);
3230 SDW->W = TSTBIT (SDWodd, 18);
3231 SDW->P = TSTBIT (SDWodd, 17);
3232 SDW->U = TSTBIT (SDWodd, 16);
3233 SDW->G = TSTBIT (SDWodd, 15);
3234 SDW->C = TSTBIT (SDWodd, 14);
3235 SDW->EB = SDWodd & 037777;
3236
3237 return SDW;
3238 }
3239
3240 static t_stat virtAddrN (uint address)
3241 {
3242 cpu_state_t * cpup = _cpup;
3243 if (cpu.DSBR.U) {
3244 for(word15 segno = 0; 2u * segno < 16u * (cpu.DSBR.BND + 1u); segno += 1)
3245 {
3246 sdw0_s *s = fetchSDW(segno);
3247 if (address >= s -> ADDR && address < s -> ADDR + s -> BOUND * 16u)
3248 sim_msg (" %06o:%06o\r\n", segno, address - s -> ADDR);
3249 }
3250 } else {
3251 for(word15 segno = 0;
3252 2u * segno < 16u * (cpu.DSBR.BND + 1u);
3253 segno += 512u)
3254 {
3255 word24 y1 = (2u * segno) % 1024u;
3256 word24 x1 = (2u * segno - y1) / 1024u;
3257 word36 PTWx1;
3258 core_read (cpup, (cpu.DSBR.ADDR + x1) & PAMASK, & PTWx1, __func__);
3259
3260 ptw_s PTW1;
3261 PTW1.ADDR = GETHI(PTWx1);
3262 PTW1.U = TSTBIT(PTWx1, 9);
3263 PTW1.M = TSTBIT(PTWx1, 6);
3264 PTW1.DF = TSTBIT(PTWx1, 2);
3265 PTW1.FC = PTWx1 & 3;
3266
3267 if (PTW1.DF == 0)
3268 continue;
3269
3270
3271
3272 for (word15 tspt = 0; tspt < 512u; tspt ++)
3273 {
3274 word36 SDWeven, SDWodd;
3275 core_read2(cpup, ((PTW1.ADDR << 6) + tspt * 2u) & PAMASK, & SDWeven,
3276 & SDWodd, __func__);
3277 sdw0_s SDW0;
3278
3279 SDW0.ADDR = (SDWeven >> 12) & PAMASK;
3280 SDW0.R1 = (SDWeven >> 9) & 7u;
3281 SDW0.R2 = (SDWeven >> 6) & 7u;
3282 SDW0.R3 = (SDWeven >> 3) & 7u;
3283 SDW0.DF = TSTBIT(SDWeven, 2);
3284 SDW0.FC = SDWeven & 3u;
3285
3286
3287 SDW0.BOUND = (SDWodd >> 21) & 037777;
3288 SDW0.R = TSTBIT(SDWodd, 20);
3289 SDW0.E = TSTBIT(SDWodd, 19);
3290 SDW0.W = TSTBIT(SDWodd, 18);
3291 SDW0.P = TSTBIT(SDWodd, 17);
3292 SDW0.U = TSTBIT(SDWodd, 16);
3293 SDW0.G = TSTBIT(SDWodd, 15);
3294 SDW0.C = TSTBIT(SDWodd, 14);
3295 SDW0.EB = SDWodd & 037777;
3296
3297 if (SDW0.DF == 0)
3298 continue;
3299
3300
3301
3302
3303
3304
3305 if (SDW0.U == 0)
3306 {
3307 for (word18 offset = 0;
3308 offset < 16u * (SDW0.BOUND + 1u);
3309 offset += 1024)
3310 {
3311 word24 y2 = offset % 1024;
3312 word24 x2 = (offset - y2) / 1024;
3313
3314
3315
3316
3317 word36 PTWx2;
3318 core_read (cpup, (SDW0.ADDR + x2) & PAMASK, & PTWx2, __func__);
3319
3320 ptw_s PTW2;
3321 PTW2.ADDR = GETHI(PTWx2);
3322 PTW2.U = TSTBIT(PTWx2, 9);
3323 PTW2.M = TSTBIT(PTWx2, 6);
3324 PTW2.DF = TSTBIT(PTWx2, 2);
3325 PTW2.FC = PTWx2 & 3;
3326
3327
3328
3329
3330
3331 if (address >= PTW2.ADDR + offset &&
3332 address < PTW2.ADDR + offset + 1024)
3333 sim_msg (" %06o:%06o\r\n", tspt, (address - offset) - PTW2.ADDR);
3334
3335 }
3336 }
3337 else
3338 {
3339 if (address >= SDW0.ADDR &&
3340 address < SDW0.ADDR + SDW0.BOUND * 16u)
3341 sim_msg (" %06o:%06o\r\n", tspt, address - SDW0.ADDR);
3342 }
3343 }
3344 }
3345 }
3346
3347 return SCPE_OK;
3348
3349 }
3350
3351
3352
3353 static t_stat virt_address (UNUSED int32 arg, const char * buf)
3354 {
3355 uint address;
3356 if (sscanf (buf, "%o", & address) != 1)
3357 return SCPE_ARG;
3358 return virtAddrN (address);
3359 }
3360
3361
3362
3363 static t_stat set_search_path (UNUSED int32 arg, UNUSED const char * buf)
3364 {
3365
3366 # if !defined(SPEED)
3367 if (source_search_path)
3368 FREE (source_search_path);
3369 source_search_path = strdup (buf);
3370 if (!source_search_path)
3371 {
3372 (void)sir_emerg ("FATAL: Out of memory! Aborting at %s[%s:%d]",
3373 __func__, __FILE__, __LINE__);
3374 # if defined(USE_BACKTRACE)
3375 # if defined(SIGUSR2)
3376 (void)raise(SIGUSR2);
3377
3378 # endif
3379 # endif
3380 abort();
3381 }
3382 # endif
3383 return SCPE_OK;
3384 }
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394 t_stat brkbrk (UNUSED int32 arg, UNUSED const char * buf)
3395 {
3396
3397 return SCPE_OK;
3398 }
3399
3400
3401
3402 static t_stat sbreak (int32 arg, const char * buf)
3403 {
3404
3405 int segno, offset;
3406 int where;
3407 int cnt = sscanf (buf, "%o:%o%n", & segno, & offset, & where);
3408 if (cnt != 2)
3409 {
3410 return SCPE_ARG;
3411 }
3412 char reformatted[strlen (buf) + 20];
3413 (void)sprintf (reformatted, "0%04o%06o%s", segno, offset, buf + where);
3414
3415 t_stat rc = brk_cmd (arg, reformatted);
3416 return rc;
3417 }
3418
3419 # if defined(DVFDBG)
3420 static t_stat dfx1entry (UNUSED int32 arg, UNUSED const char * buf)
3421 {
3422
3423 sim_msg ("dfx1entry\r\n");
3424 sim_msg ("rA %012"PRIo64" (%llu)\r\n", rA, rA);
3425 sim_msg ("rQ %012"PRIo64" (%llu)\r\n", rQ, rQ);
3426
3427
3428 word24 pa;
3429 char * msg;
3430 if (dbgLookupAddress (cpu.PR[6].SNR, 046, & pa, & msg))
3431 {
3432 sim_msg ("text segment number lookup failed because %s\r\n", msg);
3433 }
3434 else
3435 {
3436 sim_msg ("text segno %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3437 }
3438 sim_msg ("%05o:%06o\r\n", cpu.PR[2].SNR, cpu.rX[0]);
3439
3440 if (dbgLookupAddress (cpu.PR[2].SNR, cpu.rX[0], & pa, & msg))
3441 {
3442 sim_msg ("return address lookup failed because %s\r\n", msg);
3443 }
3444 else
3445 {
3446 sim_msg ("scale %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3447 }
3448 if (dbgLookupAddress (cpu.PR[2].SNR, cpu.PR[2].WORDNO, & pa, & msg))
3449 {
3450 sim_msg ("divisor address lookup failed because %s\r\n", msg);
3451 }
3452 else
3453 {
3454 sim_msg ("divisor %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3455 }
3456 return SCPE_OK;
3457 }
3458
3459 static t_stat dfx1exit (UNUSED int32 arg, UNUSED const char * buf)
3460 {
3461 sim_msg ("dfx1exit\r\n");
3462 sim_msg ("rA %012"PRIo64" (%llu)\r\n", rA, rA);
3463 sim_msg ("rQ %012"PRIo64" (%llu)\r\n", rQ, rQ);
3464 return SCPE_OK;
3465 }
3466
3467 static t_stat dv2scale (UNUSED int32 arg, UNUSED const char * buf)
3468 {
3469 sim_msg ("dv2scale\r\n");
3470 sim_msg ("rQ %012"PRIo64" (%llu)\r\n", rQ, rQ);
3471 return SCPE_OK;
3472 }
3473
3474 static t_stat dfx2entry (UNUSED int32 arg, UNUSED const char * buf)
3475 {
3476
3477 sim_msg ("dfx2entry\r\n");
3478 sim_msg ("rA %012"PRIo64" (%llu)\r\n", rA, rA);
3479 sim_msg ("rQ %012"PRIo64" (%llu)\r\n", rQ, rQ);
3480
3481
3482 word24 pa;
3483 char * msg;
3484 if (dbgLookupAddress (cpu.PR[6].SNR, 046, & pa, & msg))
3485 {
3486 sim_msg ("text segment number lookup failed because %s\r\n", msg);
3487 }
3488 else
3489 {
3490 sim_msg ("text segno %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3491 }
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518 if (dbgLookupAddress (cpu.PR[2].SNR, cpu.PR[2].WORDNO, & pa, & msg))
3519 {
3520 sim_msg ("divisor address lookup failed because %s\r\n", msg);
3521 }
3522 else
3523 {
3524 sim_msg ("divisor %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3525 sim_msg ("divisor %012"PRIo64" (%llu)\r\n", M[pa + 1], M[pa + 1]);
3526 }
3527 return SCPE_OK;
3528 }
3529
3530 static t_stat mdfx3entry (UNUSED int32 arg, UNUSED const char * buf)
3531 {
3532
3533
3534
3535
3536 sim_msg ("mdfx3entry\r\n");
3537
3538 sim_msg ("rQ %012"PRIo64" (%llu)\r\n", rQ, rQ);
3539
3540
3541 word24 pa;
3542 char * msg;
3543 if (dbgLookupAddress (cpu.PR[6].SNR, 046, & pa, & msg))
3544 {
3545 sim_msg ("text segment number lookup failed because %s\r\n", msg);
3546 }
3547 else
3548 {
3549 sim_msg ("text segno %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3550 }
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563 if (dbgLookupAddress (cpu.PR[2].SNR, cpu.PR[2].WORDNO, & pa, & msg))
3564 {
3565 sim_msg ("divisor address lookup failed because %s\r\n", msg);
3566 }
3567 else
3568 {
3569 sim_msg ("divisor %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3570 }
3571 return SCPE_OK;
3572 }
3573
3574 static t_stat smfx1entry (UNUSED int32 arg, UNUSED const char * buf)
3575 {
3576
3577
3578
3579
3580 sim_msg ("smfx1entry\r\n");
3581
3582 sim_msg ("rQ %012"PRIo64" (%llu)\r\n", rQ, rQ);
3583
3584
3585 word24 pa;
3586 char * msg;
3587 if (dbgLookupAddress (cpu.PR[6].SNR, 046, & pa, & msg))
3588 {
3589 sim_msg ("text segment number lookup failed because %s\r\n", msg);
3590 }
3591 else
3592 {
3593 sim_msg ("text segno %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3594 }
3595 sim_msg ("%05o:%06o\r\n", cpu.PR[2].SNR, cpu.rX[0]);
3596
3597 if (dbgLookupAddress (cpu.PR[2].SNR, cpu.rX[0], & pa, & msg))
3598 {
3599 sim_msg ("return address lookup failed because %s\r\n", msg);
3600 }
3601 else
3602 {
3603 sim_msg ("scale %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3604 }
3605 if (dbgLookupAddress (cpu.PR[2].SNR, cpu.PR[2].WORDNO, & pa, & msg))
3606 {
3607 sim_msg ("divisor address lookup failed because %s\r\n", msg);
3608 }
3609 else
3610 {
3611 sim_msg ("divisor %012"PRIo64" (%llu)\r\n", M[pa], M[pa]);
3612 }
3613 return SCPE_OK;
3614 }
3615 # endif
3616
3617
3618
3619 static t_stat search_memory (UNUSED int32 arg, const char * buf)
3620 {
3621 word36 value;
3622 if (sscanf (buf, "%llo", & value) != 1)
3623 return SCPE_ARG;
3624
3625 uint i;
3626 for (i = 0; i < MEMSIZE; i ++)
3627 if ((M[i] & DMASK) == value)
3628 sim_msg ("%08o\r\n", i);
3629 return SCPE_OK;
3630 }
3631
3632 static t_stat set_dbg_cpu_mask (int32 UNUSED arg, const char * UNUSED buf)
3633 {
3634 uint msk;
3635 int cnt = sscanf (buf, "%u", & msk);
3636 if (cnt != 1)
3637 {
3638 sim_msg ("Huh?\r\n");
3639 return SCPE_ARG;
3640 }
3641 sim_msg ("mask set to %u\r\n", msk);
3642 dbgCPUMask = msk;
3643 return SCPE_OK;
3644 }
3645
3646 #endif
3647
3648
3649
3650
3651
3652 #if defined(PANEL68)
3653 static t_stat scraper (UNUSED int32 arg, const char * buf)
3654 {
3655 if (strcasecmp (buf, "start") == 0)
3656 return panelScraperStart ();
3657 if (strcasecmp (buf, "stop") == 0)
3658 return panelScraperStop ();
3659 if (strcasecmp (buf, "msg") == 0)
3660 {
3661 return panelScraperMsg (NULL);
3662 }
3663 if (strncasecmp (buf, "msg ", 4) == 0)
3664 {
3665 const char * p = buf + 4;
3666 while (* p == ' ')
3667 p ++;
3668 return panelScraperMsg (p);
3669 }
3670 sim_msg ("err: scraper start|stop|msg\r\n");
3671 return SCPE_ARG;
3672 }
3673 #endif
3674
3675 #if defined(YIELD)
3676 static t_stat clear_yield (int32 flag, UNUSED const char * cptr)
3677 {
3678 return SCPE_OK;
3679 }
3680
3681 static t_stat yield (int32 flag, UNUSED const char * cptr)
3682 {
3683 return SCPE_OK;
3684 }
3685 #endif
3686
3687 #if !defined(PERF_STRIP)
3688 static t_stat set_luf (int32 flag, UNUSED const char * cptr)
3689 {
3690 luf_flag = flag;
3691 return SCPE_OK;
3692 }
3693 #endif
3694
3695 #if defined(DBGEVENT)
3696 uint n_dbgevents;
3697 struct dbgevent_t dbgevents[max_dbgevents];
3698 struct timespec dbgevent_t0;
3699
3700 static int dbgevent_compar (const void * a, const void * b)
3701 {
3702 struct dbgevent_t * ea = (struct dbgevent_t *) a;
3703 struct dbgevent_t * eb = (struct dbgevent_t *) b;
3704 if (ea->segno < eb->segno)
3705 return -1;
3706 if (ea->segno > eb->segno)
3707 return 1;
3708 if (ea->offset < eb->offset)
3709 return -1;
3710 if (ea->offset > eb->offset)
3711 return 1;
3712 return 0;
3713 }
3714
3715 int dbgevent_lookup (word15 segno, word18 offset)
3716 {
3717 struct dbgevent_t key = {segno, offset, false};
3718 struct dbgevent_t * p = (struct dbgevent_t *) bsearch (& key, dbgevents, (size_t) n_dbgevents,
3719 sizeof (struct dbgevent_t), dbgevent_compar);
3720 if (! p)
3721 return -1;
3722 return (int) (p - dbgevents);
3723 }
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735 static t_stat set_dbgevent (int32 arg, const char * buf)
3736 {
3737 if (arg == 0 || arg == 1)
3738 {
3739 if (n_dbgevents >= max_dbgevents)
3740 {
3741 sim_printf ("too many dbgevents %u/%u\r\n", n_dbgevents, max_dbgevents);
3742 return SCPE_ARG;
3743 }
3744 if (strlen (buf) > dbgevent_tagsize - 1)
3745 {
3746 sim_printf ("command too long %lu/%u\r\n", strlen (buf), dbgevent_tagsize -1);
3747 return SCPE_ARG;
3748 }
3749
3750 uint segno;
3751 uint offset;
3752 if (sscanf (buf, "%o:%o", & segno, & offset) != 2)
3753 return SCPE_ARG;
3754 if (segno > MASK15 || offset > MASK18)
3755 return SCPE_ARG;
3756 if (dbgevent_lookup ((word15) segno, (word18) offset) != -1)
3757 {
3758 sim_printf ("not adding duplicate 0%o:0%o\r\n", segno, offset);
3759 return SCPE_ARG;
3760 }
3761 dbgevents[n_dbgevents].segno = (word15) segno;
3762 dbgevents[n_dbgevents].offset = (word18) offset;
3763 dbgevents[n_dbgevents].t0 = arg == 0;
3764 strncpy (dbgevents[n_dbgevents].tag, buf, dbgevent_tagsize - 1);
3765 dbgevents[n_dbgevents].tag[dbgevent_tagsize - 1] = 0;
3766 sim_printf ("%o:%o %u(%d) %s\r\n", dbgevents[n_dbgevents].segno,
3767 dbgevents[n_dbgevents].offset,
3768 dbgevents[n_dbgevents].t0, arg, dbgevents[n_dbgevents].tag);
3769 n_dbgevents ++;
3770 qsort (dbgevents, n_dbgevents, sizeof (struct dbgevent_t), dbgevent_compar);
3771 }
3772 else if (arg == 2)
3773 {
3774 uint segno;
3775 uint offset;
3776 if (sscanf (buf, "%o:%o", & segno, & offset) != 2)
3777 return SCPE_ARG;
3778 int n = dbgevent_lookup ((word15) segno, (word18) offset);
3779 if (n < 0)
3780 {
3781 sim_printf ("0%o:0%o not found\r\n", segno, offset);
3782 return SCPE_ARG;
3783 }
3784 for (int i = n; i < n_dbgevents - 1; i ++)
3785 dbgevents[i] = dbgevents[i + 1];
3786 n_dbgevents --;
3787 }
3788 else if (arg == 3)
3789 {
3790 for (int i = 0; i < n_dbgevents; i ++)
3791 sim_printf (" %s %05o:%06o %s\r\n", dbgevents[i].t0 ? "T0" : " ", dbgevents[i].segno,
3792 dbgevents[i].offset,dbgevents[i].tag);
3793 }
3794 else if (arg == 4)
3795 {
3796 n_dbgevents = 0;
3797 sim_printf ("dbgevents cleared\r\n");
3798 }
3799 else
3800 {
3801 sim_printf ("set_dbgevent bad arg %d\r\n", arg);
3802 return SCPE_ARG;
3803 }
3804 return SCPE_OK;
3805 }
3806 #endif
3807
3808
3809
3810
3811
3812
3813 t_stat rewind_media (int32 arg, const char * buf) {
3814 char name[strlen (buf) + 1];
3815
3816 int rc = sscanf (buf, "%s", name);
3817 if (rc != 1)
3818 return SCPE_ARG;
3819
3820 for (uint i = 0; i < N_MT_UNITS_MAX; i ++) {
3821 if (strcmp (tape_states[i].device_name, name) == 0) {
3822 UNIT * unitp = & mt_unit [i];
3823 return sim_tape_rewind (unitp);
3824 }
3825 }
3826
3827 sim_printf ("Can't find name '%s'\r\n", name);
3828 sim_printf ("REWIND device_name\r\n");
3829 return SCPE_ARG;
3830 }
3831
3832
3833
3834
3835
3836
3837
3838
3839 t_stat load_media (int32 arg, const char * buf)
3840 {
3841
3842
3843
3844 char name[strlen (buf) + 1];
3845 char fname[strlen (buf) + 1];
3846 char perm[strlen (buf) + 1];
3847 bool ro = false;
3848 if (arg)
3849 {
3850 int rc = sscanf (buf, "%s %s %s", name, fname, perm);
3851 if (rc != 3)
3852 return SCPE_ARG;
3853 if (strcasecmp (perm, "rw") == 0)
3854 ro = false;
3855 else if (strcasecmp (perm, "ro") == 0)
3856 ro = true;
3857 else
3858 {
3859 sim_print ("'%s' not 'ro' or 'rw'\r\n", perm);
3860 goto usage;
3861 }
3862 }
3863 else
3864 {
3865 int rc = sscanf (buf, "%s", name);
3866 if (rc != 1)
3867 return SCPE_ARG;
3868 }
3869
3870 for (uint i = 0; i < N_DSK_UNITS_MAX; i ++)
3871 if (strcmp (dsk_states[i].device_name, name) == 0)
3872 {
3873 if (arg)
3874 return loadDisk (i, fname, ro);
3875 return unloadDisk (i);
3876 }
3877
3878 for (uint i = 0; i < N_MT_UNITS_MAX; i ++)
3879 if (strcmp (tape_states[i].device_name, name) == 0)
3880 {
3881 if (arg)
3882 return loadTape (i, fname, ro);
3883 return unloadTape (i);
3884 }
3885
3886 sim_printf ("Can't find name '%s'\r\n", name);
3887 usage:
3888 sim_printf ("[UN]LOAD device_name image_name ro|rw\r\n");
3889 return SCPE_ARG;
3890 }
3891
3892 t_stat ready_media (int32 arg, const char * buf) {
3893 char name[strlen (buf) + 1];
3894 int rc = sscanf (buf, "%s", name);
3895 if (rc != 1)
3896 return SCPE_ARG;
3897
3898 for (uint i = 0; i < N_DSK_UNITS_MAX; i ++) {
3899 if (strcmp (dsk_states[i].device_name, name) == 0) {
3900 return signal_disk_ready (i);
3901 }
3902 }
3903
3904 for (uint i = 0; i < N_MT_UNITS_MAX; i ++) {
3905 if (strcmp (tape_states[i].device_name, name) == 0) {
3906 return signal_tape (i, 0, 020 );
3907 }
3908 }
3909
3910 sim_printf ("Can't find name '%s'\r\n", name);
3911 sim_printf ("[UN]LOAD device_name image_name ro|rw\r\n");
3912 return SCPE_ARG;
3913 }
3914
3915
3916
3917
3918
3919
3920 #if defined(TESTING)
3921 # include "tracker.h"
3922
3923 static t_stat trkw (UNUSED int32 arg, const char * buf)
3924 {
3925 trk_init (true);
3926 return SCPE_OK;
3927 }
3928
3929 static t_stat trkr (UNUSED int32 arg, const char * buf)
3930 {
3931 trk_init (false);
3932 return SCPE_OK;
3933 }
3934 #endif
3935
3936 #if !defined(PERF_STRIP)
3937 static CTAB dps8_cmds[] =
3938 {
3939
3940
3941
3942
3943 {"DEFAULT_BASE_SYSTEM", set_default_base_system, 0, "Set configuration to defaults\r\n", NULL, NULL},
3944
3945 {"CABLE", sys_cable, 0, "String a cable.\r\n", NULL, NULL},
3946 {"UNCABLE", sys_cable, 1, "Unstring a cable.\r\n", NULL, NULL},
3947 {"CABLE_RIPOUT", sys_cable_ripout, 0, "Remove all cables from the configuration.\r\n", NULL, NULL},
3948 {"CABLE_SHOW", sys_cable_show, 0, "Show the current cabling configuration.\r\n", NULL, NULL},
3949
3950 {"FNPSERVERPORT", set_fnp_server_port, 0, "Set the FNP dialin TELNET port number\r\n", NULL, NULL},
3951 {"FNPSERVERADDRESS", set_fnp_server_address, 0, "Set the FNP dialin server binding address\r\n", NULL, NULL},
3952 {"FNPSERVER3270PORT", set_fnp_3270_server_port, 0, "Set the FNP TN3270 dialin port number\r\n", NULL, NULL},
3953
3954
3955
3956
3957
3958 {"SKIPBOOT", boot_skip, 0, "Skip forward on boot tape (SKIPBOOT [unit])\r\n", NULL, NULL},
3959 {"FNPSTART", fnp_start, 0, "Directs the simulator to immediately start listening for FNP connections.\r\n",
3960 NULL, NULL},
3961 {"MOUNT", mount_tape, 0, "Mount tape image and signal Multics\r\n", NULL, NULL},
3962 {"LOAD", load_media, 1, "Mount disk or tape image and signal Multics\r\n", NULL, NULL},
3963 {"UNLOAD", load_media, 0, "Unmount disk or tape image and signal Multics\r\n", NULL, NULL},
3964 {"READY", ready_media, 0, "Signal Multics that media is ready\r\n", NULL, NULL},
3965 {"REWIND", rewind_media, 0, "Rewind tape\r\n", NULL, NULL},
3966 {"XF", do_execute_fault, 0, "Execute fault: Press the execute fault button\r\n", NULL, NULL},
3967 {"XS", do_execute_switches, 0, "Execute switches: Execute the instruction in the data switches\r\n", NULL, NULL},
3968 {"RESTART", do_restart, 0, "Execute fault: Press the execute fault button\r\n", NULL, NULL},
3969 {"POLL", set_sys_polling_interval, 0, "Set polling interval (in milliseconds)\r\n", NULL, NULL},
3970 {"SLOWPOLL", set_sys_slow_polling_interval, 0, "Set slow polling interval (in polling intervals).\r\n", NULL, NULL},
3971 {"CHECKPOLL", set_sys_poll_check_rate, 0, "Set polling check rate (in polling intervals).\r\n", NULL, NULL},
3972 {"BURST", burst_printer, 0, "Burst process output from printer.\r\n", NULL, NULL},
3973
3974
3975
3976
3977
3978 # if defined(TESTING)
3979 {"TRKW", trkw, 0, "Start tracking to track.dat\r\n", NULL, NULL},
3980 {"TRKR", trkr, 0, "Start comparing with track.dat\r\n", NULL, NULL},
3981 {"DBGMMECNTDWN", dps_debug_mme_cntdwn, 0, "Enable debug after n MMEs\r\n", NULL, NULL},
3982 {"DBGSKIP", dps_debug_skip, 0, "Skip first n TRACE debugs\r\n", NULL, NULL},
3983 {"DBGSTART", dps_debug_start, 0, "Limit debugging to N > Cycle count\r\n", NULL, NULL},
3984 {"DBGSTOP", dps_debug_stop, 0, "Limit debugging to N < Cycle count\r\n", NULL, NULL},
3985 {"DBGBREAK", dps_debug_break, 0, "Break when N >= Cycle count\r\n", NULL, NULL},
3986 {"DBGSEGNO", dps_debug_segno, 1, "Limit debugging to PSR == segno\r\n", NULL, NULL},
3987 {"NODBGSEGNO", dps_debug_segno, 0, "Reset to debugging all segments\r\n", NULL, NULL},
3988 {"DBGRINGNO", dps_debug_ringno, 0, "Limit debugging to PRR == ringno\r\n", NULL, NULL},
3989 {"DBGBAR", dps_debug_bar, 1, "Limit debugging to BAR mode\r\n", NULL, NULL},
3990 {"NODBGBAR", dps_debug_bar, 0, "Limit debugging to BAR mode\r\n", NULL, NULL},
3991 {"HDBG", hdbg_size, 0, "Set history debugger buffer size\r\n", NULL, NULL},
3992 {"HDSEG", hdbgSegmentNumber, 0, "Set history debugger segment number\r\n", NULL, NULL},
3993 {"HDBL", hdbgBlacklist, 0, "Set history debugger blacklist\r\n", NULL, NULL},
3994 {"PHDBG", hdbg_print, 0, "Dump history buffer to 'hdbg0000.list'\r\n", NULL, NULL},
3995 {"HDBG_CPU_MASK", hdbg_cpu_mask, 0, "Set which CPUs to track (by mask)\r\n", NULL, NULL},
3996 {"ABSOLUTE", abs_addr, 0, "Compute the absolute address of segno:offset\r\n", NULL, NULL},
3997 {"STK", stack_trace, 0, "Print a stack trace\r\n", NULL, NULL},
3998 {"LIST", list_source_at, 0, "List source for address / segno:offset\r\n", NULL, NULL},
3999 {"LD_SYSTEM_BOOK", load_system_book, 0, "Load a Multics system book for symbolic debugging\r\n", NULL, NULL},
4000 {"ASBE", add_system_book_entry, 0, "Add an entry to the system book\r\n", NULL, NULL},
4001 {"LOOKUP_SYSTEM_BOOK", lookup_system_book, 0, "Lookup an address or symbol in the Multics system book\r\n", NULL, NULL},
4002 {"LSB", lookup_system_book, 0, "Lookup an address or symbol in the Multics system book\r\n", NULL, NULL},
4003 {"VIRTUAL", virt_address, 0, "Compute the virtual address(es) of segno:offset\r\n", NULL, NULL},
4004 {"SPATH", set_search_path, 0, "Set source code search path\r\n", NULL, NULL},
4005 {"TEST", brkbrk, 0, "GDB test hook\r\n", NULL, NULL},
4006 # if defined(DBGEVENT)
4007 {"DBG0EVENT", set_dbgevent, 0, "Set t0 debug event\r\n", NULL, NULL},
4008 {"DBGEVENT", set_dbgevent, 1, "Set debug event\r\n", NULL, NULL},
4009 {"DBGNOEVENT", set_dbgevent, 2, "Clear debug event\r\n", NULL, NULL},
4010 {"DBGLISTEVENTS", set_dbgevent, 3, "List debug events\r\n", NULL, NULL},
4011 {"DBGCLEAREVENTS", set_dbgevent, 4, "Clear debug events\r\n", NULL, NULL},
4012 # endif
4013 # define SSH_ST 0
4014 # define SSH_SH 1
4015 # define SSH_CL 2
4016 {"SBREAK", sbreak, SSH_ST, "Set a breakpoint with segno:offset syntax\r\n", NULL, NULL},
4017 {"NOSBREAK", sbreak, SSH_CL, "Unset an SBREAK\r\n", NULL, NULL},
4018 # if defined(DVFDBG)
4019
4020 {"DFX1ENTRY", dfx1entry, 0, "\r\n", NULL, NULL},
4021 {"DFX2ENTRY", dfx2entry, 0, "\r\n", NULL, NULL},
4022 {"DFX1EXIT", dfx1exit, 0, "\r\n", NULL, NULL},
4023 {"DV2SCALE", dv2scale, 0, "\r\n", NULL, NULL},
4024 {"MDFX3ENTRY", mdfx3entry, 0, "\r\n", NULL, NULL},
4025 {"SMFX1ENTRY", smfx1entry, 0, "\r\n", NULL, NULL},
4026 # endif
4027 # if !defined(SPEED)
4028 {"WATCH", set_mem_watch, 1, "Watch memory location\r\n", NULL, NULL},
4029 {"NOWATCH", set_mem_watch, 0, "Unwatch memory location\r\n", NULL, NULL},
4030 # endif
4031 {"SEARCHMEMORY", search_memory, 0, "Search memory for value\r\n", NULL, NULL},
4032 {"DBGCPUMASK", set_dbg_cpu_mask, 0, "Set per-CPU debug enable mask\r\n", NULL, NULL},
4033 # endif
4034
4035 {"SEGLDR", segment_loader, 0, "Segment Loader\r\n", NULL, NULL},
4036
4037
4038
4039
4040
4041 # if defined(MATRIX)
4042 {"DISPLAYMATRIX", display_the_matrix, 0, "Display instruction usage counts\r\n", NULL, NULL},
4043 # endif
4044
4045
4046
4047
4048
4049 {"AUTOINPUT", add_opc_autoinput, 0, "Set primary console auto-input\r\n", NULL, NULL},
4050 {"AI", add_opc_autoinput, 0, "Set primary console auto-input\r\n", NULL, NULL},
4051 {"AUTOINPUT2", add_opc_autoinput, 1, "Set secondary console auto-input\r\n", NULL, NULL},
4052 {"AI2", add_opc_autoinput, 1, "Set secondary console auto-input\r\n", NULL, NULL},
4053 {"CLRAUTOINPUT", clear_opc_autoinput, 0, "Clear primary console auto-input\r\n", NULL, NULL},
4054 {"CLRAUTOINPUT2", clear_opc_autoinput, 1, "Clear secondary console auto-input\r\n", NULL, NULL},
4055
4056
4057
4058
4059
4060 # if YIELD
4061 {"CLEAR_YIELD", clear_yield, 1, "Clear yield data points\r\n", NULL, NULL},
4062 {"YIELD", yield, 1, "Define yield data point\r\n", NULL, NULL},
4063 # endif
4064
4065
4066
4067
4068
4069 {"LUF", set_luf, 1, "Enable normal LUF handling\r\n", NULL, NULL},
4070 {"NOLUF", set_luf, 0, "Disable normal LUF handling\r\n", NULL, NULL},
4071
4072
4073
4074
4075
4076 # if defined(PANEL68)
4077 {"SCRAPER", scraper, 0, "Control panel scraper\r\n", NULL, NULL},
4078 # endif
4079 { NULL, NULL, 0, NULL, NULL, NULL}
4080 };
4081
4082 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32) && !defined(PERF_STRIP)
4083 static void usr1_signal_handler (UNUSED int sig)
4084 {
4085 sim_msg ("USR1 signal caught; pressing the EXF button\r\n");
4086
4087 setG7fault (ASSUME0, FAULT_EXF);
4088 return;
4089 }
4090 # endif
4091
4092 static struct symbol_s symbols [] = {
4093 { "commit_id", SYM_STATE_OFFSET, SYM_STRING, offsetof (struct system_state_s, commit_id) },
4094 { "M[]", SYM_STATE_OFFSET, SYM_ARRAY, offsetof (struct system_state_s, M) },
4095 { "sizeof(*M)", SYM_STRUCT_SZ, SYM_SZ, sizeof (word36) },
4096
4097 { "cpus[]", SYM_STATE_OFFSET, SYM_ARRAY, offsetof (struct system_state_s, cpus) },
4098 { "sizeof(*cpus)", SYM_STRUCT_SZ, SYM_SZ, sizeof (cpu_state_t) },
4099
4100 { "cpus[].PPR", SYM_STRUCT_OFFSET, SYM_PTR, offsetof (cpu_state_t, PPR) },
4101 { "cpus[].PPR.PRR", SYM_STRUCT_OFFSET, SYM_UINT8_3, offsetof (struct ppr_s, PRR) },
4102 { "cpus[].PPR.PSR", SYM_STRUCT_OFFSET, SYM_UINT16_15, offsetof (struct ppr_s, PSR) },
4103 { "cpus[].PPR.P", SYM_STRUCT_OFFSET, SYM_UINT8_1, offsetof (struct ppr_s, P) },
4104 { "cpus[].PPR.IC", SYM_STRUCT_OFFSET, SYM_UINT32_18, offsetof (struct ppr_s, IC) },
4105
4106 { "cpus[].cu", SYM_STRUCT_OFFSET, SYM_PTR, offsetof (cpu_state_t, cu) },
4107 { "cpus[].cu.IWB", SYM_STRUCT_OFFSET, SYM_UINT64_36, offsetof (ctl_unit_data_t, IWB) },
4108 { "cpus[].cu.IR", SYM_STRUCT_OFFSET, SYM_UINT32_18, offsetof (ctl_unit_data_t, IR) },
4109
4110 { "cpus[].rA", SYM_STRUCT_OFFSET, SYM_UINT64_36, offsetof (cpu_state_t, rA) },
4111
4112 { "cpus[].rQ", SYM_STRUCT_OFFSET, SYM_UINT64_36, offsetof (cpu_state_t, rQ) },
4113
4114 { "cpus[].rE", SYM_STRUCT_OFFSET, SYM_UINT64_36, offsetof (cpu_state_t, rE) },
4115
4116 { "cpus[].rX[]", SYM_STRUCT_OFFSET, SYM_ARRAY, offsetof (cpu_state_t, rX) },
4117 { "sizeof(*rX)", SYM_STRUCT_SZ, SYM_SZ, sizeof (word18) },
4118 { "cpus[].rX", SYM_STRUCT_OFFSET, SYM_UINT32_18, 0 },
4119
4120 { "cpus[].rTR", SYM_STRUCT_OFFSET, SYM_UINT32_27, offsetof (cpu_state_t, rTR) },
4121
4122 { "cpus[].rRALR", SYM_STRUCT_OFFSET, SYM_UINT8_3, offsetof (cpu_state_t, rRALR) },
4123
4124 { "cpus[].PAR[]", SYM_STRUCT_OFFSET, SYM_ARRAY, offsetof (cpu_state_t, PAR) },
4125 { "sizeof(*PAR)", SYM_STRUCT_SZ, SYM_SZ, sizeof (struct par_s) },
4126
4127 { "cpus[].PAR[].SNR", SYM_STRUCT_OFFSET, SYM_UINT16_15, offsetof (struct par_s, SNR) },
4128 { "cpus[].PAR[].RNR", SYM_STRUCT_OFFSET, SYM_UINT8_3, offsetof (struct par_s, RNR) },
4129 { "cpus[].PAR[].PR_BITNO", SYM_STRUCT_OFFSET, SYM_UINT8_6, offsetof (struct par_s, PR_BITNO) },
4130 { "cpus[].PAR[].WORDNO", SYM_STRUCT_OFFSET, SYM_UINT32_18, offsetof (struct par_s, WORDNO) },
4131
4132 { "cpus[].BAR", SYM_STRUCT_OFFSET, SYM_PTR, offsetof (cpu_state_t, BAR) },
4133 { "cpus[].BAR.BASE", SYM_STRUCT_OFFSET, SYM_UINT16_9, offsetof (struct bar_s, BASE) },
4134 { "cpus[].BAR.BOUND", SYM_STRUCT_OFFSET, SYM_UINT16_9, offsetof (struct bar_s, BOUND) },
4135
4136 { "cpus[].TPR", SYM_STRUCT_OFFSET, SYM_PTR, offsetof (cpu_state_t, TPR) },
4137 { "cpus[].TPR.TRR", SYM_STRUCT_OFFSET, SYM_UINT8_3, offsetof (struct tpr_s, TRR) },
4138 { "cpus[].TPR.TSR", SYM_STRUCT_OFFSET, SYM_UINT16_15, offsetof (struct tpr_s, TSR) },
4139 { "cpus[].TPR.TBR", SYM_STRUCT_OFFSET, SYM_UINT8_6, offsetof (struct tpr_s, TBR) },
4140 { "cpus[].TPR.CA", SYM_STRUCT_OFFSET, SYM_UINT32_18, offsetof (struct tpr_s, CA) },
4141
4142 { "cpus[].DSBR", SYM_STRUCT_OFFSET, SYM_PTR, offsetof (cpu_state_t, DSBR) },
4143 { "cpus[].DSBR.ADDR", SYM_STRUCT_OFFSET, SYM_UINT32_24, offsetof (struct dsbr_s, ADDR) },
4144 { "cpus[].DSBR.BND", SYM_STRUCT_OFFSET, SYM_UINT16_14, offsetof (struct dsbr_s, BND) },
4145 { "cpus[].DSBR.U", SYM_STRUCT_OFFSET, SYM_UINT8_1, offsetof (struct dsbr_s, U) },
4146 { "cpus[].DSBR.STACK", SYM_STRUCT_OFFSET, SYM_UINT16_12, offsetof (struct dsbr_s, STACK) },
4147
4148 { "cpus[].faultNumber", SYM_STRUCT_OFFSET, SYM_UINT32, offsetof (cpu_state_t, faultNumber) },
4149 # define SYMTAB_ENUM32(e) { #e, SYM_ENUM, SYM_UINT32, e }
4150 SYMTAB_ENUM32 (FAULT_SDF),
4151 SYMTAB_ENUM32 (FAULT_STR),
4152 SYMTAB_ENUM32 (FAULT_MME),
4153 SYMTAB_ENUM32 (FAULT_F1),
4154 SYMTAB_ENUM32 (FAULT_TRO),
4155 SYMTAB_ENUM32 (FAULT_CMD),
4156 SYMTAB_ENUM32 (FAULT_DRL),
4157 SYMTAB_ENUM32 (FAULT_LUF),
4158 SYMTAB_ENUM32 (FAULT_CON),
4159 SYMTAB_ENUM32 (FAULT_PAR),
4160 SYMTAB_ENUM32 (FAULT_IPR),
4161 SYMTAB_ENUM32 (FAULT_ONC),
4162 SYMTAB_ENUM32 (FAULT_SUF),
4163 SYMTAB_ENUM32 (FAULT_OFL),
4164 SYMTAB_ENUM32 (FAULT_DIV),
4165 SYMTAB_ENUM32 (FAULT_EXF),
4166 SYMTAB_ENUM32 (FAULT_DF0),
4167 SYMTAB_ENUM32 (FAULT_DF1),
4168 SYMTAB_ENUM32 (FAULT_DF2),
4169 SYMTAB_ENUM32 (FAULT_DF3),
4170 SYMTAB_ENUM32 (FAULT_ACV),
4171 SYMTAB_ENUM32 (FAULT_MME2),
4172 SYMTAB_ENUM32 (FAULT_MME3),
4173 SYMTAB_ENUM32 (FAULT_MME4),
4174 SYMTAB_ENUM32 (FAULT_F2),
4175 SYMTAB_ENUM32 (FAULT_F3),
4176 SYMTAB_ENUM32 (FAULT_UN1),
4177 SYMTAB_ENUM32 (FAULT_UN2),
4178 SYMTAB_ENUM32 (FAULT_UN3),
4179 SYMTAB_ENUM32 (FAULT_UN4),
4180 SYMTAB_ENUM32 (FAULT_UN5),
4181 SYMTAB_ENUM32 (FAULT_TRB),
4182
4183 { "", SYM_EMPTY, SYM_UNDEF, 0 },
4184 };
4185
4186 static void systabInit (void) {
4187 strncpy (system_state->symbolTable.symtabHdr, SYMTAB_HDR, sizeof (system_state->symbolTable.symtabHdr));
4188 system_state->symbolTable.symtabVer = SYMTAB_VER;
4189 memcpy (system_state->symbolTable.symbols, symbols, sizeof (symbols));
4190 }
4191 #endif
4192
4193 static inline uint32_t
4194 hash32s(const void *buf, size_t len, uint32_t h)
4195 {
4196 const unsigned char *p = buf;
4197
4198 for (size_t i = 0; i < len; i++)
4199 h = h * 31 + p[i];
4200
4201 h ^= h >> 17;
4202 h *= UINT32_C(0xed5ad4bb);
4203 h ^= h >> 11;
4204 h *= UINT32_C(0xac4c1b51);
4205 h ^= h >> 15;
4206 h *= UINT32_C(0x31848bab);
4207 h ^= h >> 14;
4208
4209 return h;
4210 }
4211
4212
4213
4214 static void dps8_init (void) {
4215 int st1ret;
4216 (void)fflush(stderr);
4217 (void)fflush(stdout);
4218 #if !defined(PERF_STRIP)
4219 if (!sim_quiet) {
4220 # if defined(GENERATED_MAKE_VER_H) && defined(VER_H_GIT_VERSION)
4221 # if defined(VER_H_GIT_PATCH_INT) && defined(VER_H_GIT_PATCH)
4222 # if VER_H_GIT_PATCH_INT < 1
4223 sim_msg ("%s simulator %s (%ld-bit)",
4224 sim_name, VER_H_GIT_VERSION,
4225 (long)(CHAR_BIT*sizeof(void *)));
4226 # else
4227 sim_msg ("%s simulator %s+%s (%ld-bit)",
4228 sim_name, VER_H_GIT_VERSION, VER_H_GIT_PATCH,
4229 (long)(CHAR_BIT*sizeof(void *)));
4230 # endif
4231 # else
4232 sim_msg ("%s simulator %s (%ld-bit)",
4233 sim_name, VER_H_GIT_VERSION,
4234 (long)(CHAR_BIT*sizeof(void *)));
4235 # endif
4236 # endif
4237 # if !defined(VER_H_GIT_VERSION) || !defined(GENERATED_MAKE_VER_H)
4238 sim_msg ("%s simulator (%ld-bit)",
4239 sim_name, (long)(CHAR_BIT*sizeof(void *)));
4240 # endif
4241
4242
4243 # if defined(TESTING)
4244 sim_msg ("\r\n Options: ");
4245 # if !defined(HAVE_DPSOPT)
4246 # define HAVE_DPSOPT 1
4247 # endif
4248 sim_msg ("TESTING");
4249 # endif
4250
4251
4252 # if defined(ISOLTS)
4253 # if defined(HAVE_DPSOPT)
4254 sim_msg (", ");
4255 # else
4256 sim_msg ("\r\n Options: ");
4257 # endif
4258 # if !defined(HAVE_DPSOPT)
4259 # define HAVE_DPSOPT 1
4260 # endif
4261 sim_msg ("ISOLTS");
4262 # endif
4263
4264
4265 # if defined(NEED_128)
4266 # if defined(HAVE_DPSOPT)
4267 sim_msg (", ");
4268 # else
4269 sim_msg ("\r\n Options: ");
4270 # endif
4271 # if !defined(HAVE_DPSOPT)
4272 # define HAVE_DPSOPT 1
4273 # endif
4274 sim_msg ("NEED_128");
4275 # endif
4276
4277
4278 # if !defined(LOCKLESS)
4279 # if defined(HAVE_DPSOPT)
4280 sim_msg (", ");
4281 # else
4282 sim_msg ("\r\n Options: ");
4283 # endif
4284 # if !defined(HAVE_DPSOPT)
4285 # define HAVE_DPSOPT 1
4286 # endif
4287 sim_msg ("NO_LOCKLESS");
4288 # endif
4289
4290
4291 # if defined(PANEL68)
4292 # if defined(HAVE_DPSOPT)
4293 sim_msg (", ");
4294 # else
4295 sim_msg ("\r\n Options: ");
4296 # endif
4297 # if !defined(HAVE_DPSOPT)
4298 # define HAVE_DPSOPT 1
4299 # endif
4300 sim_msg ("PANEL68");
4301 # endif
4302
4303
4304 # if defined(WITH_ABSI_DEV)
4305 # if defined(HAVE_DPSOPT)
4306 sim_msg (", ");
4307 # else
4308 sim_msg ("\r\n Options: ");
4309 # endif
4310 # if !defined(HAVE_DPSOPT)
4311 # define HAVE_DPSOPT 1
4312 # endif
4313 sim_msg ("ABSI");
4314 # endif
4315
4316
4317 # if defined(WITH_SOCKET_DEV)
4318 # if defined(HAVE_DPSOPT)
4319 sim_msg (", ");
4320 # else
4321 sim_msg ("\r\n Options: ");
4322 # endif
4323 # if !defined(HAVE_DPSOPT)
4324 # define HAVE_DPSOPT 1
4325 # endif
4326 sim_msg ("SOCKET");
4327 # endif
4328
4329
4330 # if !defined(WITH_MGP_DEV)
4331 # if defined(HAVE_DPSOPT)
4332 sim_msg (", ");
4333 # else
4334 sim_msg ("\r\n Options: ");
4335 # endif
4336 # if !defined(HAVE_DPSOPT)
4337 # define HAVE_DPSOPT 1
4338 # endif
4339 sim_msg ("NO_CHAOSNET");
4340 # endif
4341
4342
4343 # if !defined(WITH_NET_DEV)
4344 # if defined(HAVE_DPSOPT)
4345 sim_msg (", ");
4346 # else
4347 sim_msg ("\r\n Options: ");
4348 # endif
4349 # if !defined(HAVE_DPSOPT)
4350 # define HAVE_DPSOPT 1
4351 # endif
4352 sim_msg ("NO_INTERNET");
4353 # endif
4354
4355
4356 # if defined(USE_DUMA)
4357 # if defined(HAVE_DPSOPT)
4358 sim_msg (", ");
4359 # else
4360 sim_msg ("\r\n Options: ");
4361 # endif
4362 # if !defined(HAVE_DPSOPT)
4363 # define HAVE_DPSOPT 1
4364 # endif
4365 sim_msg ("DUMA");
4366 # endif
4367
4368 # if defined(GENERATED_MAKE_VER_H) && defined(VER_H_GIT_HASH)
4369 sim_msg ("\r\n Commit: %s", VER_H_GIT_HASH);
4370 # endif
4371 sim_msg ("\r\n\r\n");
4372 (void)fflush(stderr);
4373 (void)fflush(stdout);
4374 }
4375
4376
4377
4378 # if defined(TESTING)
4379
4380 sim_vm_parse_addr = parse_addr;
4381 sim_vm_fprint_addr = fprint_addr;
4382 # endif
4383
4384 sim_vm_cmd = dps8_cmds;
4385
4386
4387 sim_brk_types = sim_brk_dflt = SWMASK ('E');
4388
4389 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW32) && !defined(CROSS_MINGW64)
4390
4391 signal (SIGUSR1, usr1_signal_handler);
4392
4393 signal(SIGPIPE, SIG_IGN);
4394 # endif
4395
4396 #endif
4397
4398 #if defined(__MINGW64__) || defined(__MINGW32__)
4399 # include "bsd_random.h"
4400 # define random bsd_random
4401 # define srandom bsd_srandom
4402 #endif
4403
4404 char rcap = 0;
4405 char rnum = 0;
4406 struct timespec ts;
4407
4408 char rssuffix[24];
4409 (void)memset(rssuffix, 0, 24);
4410
4411 char statenme[32];
4412 (void)memset(statenme, 0, 32);
4413
4414 #if defined(USE_MONOTONIC)
4415 st1ret = clock_gettime(CLOCK_MONOTONIC, &ts);
4416 #else
4417 st1ret = clock_gettime(CLOCK_REALTIME, &ts);
4418 #endif
4419 if (st1ret != 0)
4420 {
4421 (void)sir_emerg ("FATAL: clock_gettime failure! Aborting at %s[%s:%d]",
4422 __func__, __FILE__, __LINE__);
4423 #if defined(USE_BACKTRACE)
4424 # if defined(SIGUSR2)
4425 (void)raise(SIGUSR2);
4426
4427 # endif
4428 #endif
4429 abort();
4430 }
4431
4432 uint32_t h = 0;
4433 #if __STDC_VERSION__ < 201112L
4434
4435 void *(*mallocptr)() = malloc;
4436 h = hash32s(&mallocptr, sizeof(mallocptr), h);
4437 #endif
4438 void *ptr = &ptr;
4439 h = hash32s(&ptr, sizeof(ptr), h);
4440 time_t t = time(0);
4441 h = hash32s(&t, sizeof(t), h);
4442 #if !defined(_AIX) && !defined(__managarm__)
4443 for (int i = 0; i < 1000; i++)
4444 {
4445 unsigned long counter = 0;
4446 clock_t start = clock();
4447 while (clock() == start)
4448 {
4449 counter++;
4450 }
4451 h = hash32s(&start, sizeof(start), h);
4452 h = hash32s(&counter, sizeof(counter), h);
4453 }
4454 #endif
4455 int mypid = (int)_sir_getpid();
4456 h = hash32s(&mypid, sizeof(mypid), h);
4457 char rnd[4];
4458 FILE *f = fopen("/dev/urandom", "rb");
4459 if (f)
4460 {
4461 if (fread(rnd, sizeof(rnd), 1, f))
4462 {
4463 h = hash32s(rnd, sizeof(rnd), h);
4464 }
4465 fclose(f);
4466 }
4467 srandom(h);
4468
4469 for (int i = 1; i < 21; ++i) {
4470 rcap = (int)random() % 2;
4471 rnum = (int)random() % 3;
4472 if (!rnum) rnum = (((int)random() % 10) + 48);
4473 if (!rcap) rcap = 33;
4474 if (rnum >= 48) rssuffix[i-1]=rnum;
4475 else rssuffix[i-1]=(char)(((long)random() % 26) + 64) + rcap;
4476 }
4477
4478 #if defined(__MINGW64__) || \
4479 defined(__MINGW32__) || \
4480 defined(CROSS_MINGW32) || \
4481 defined(CROSS_MINGW64)
4482 system_state = aligned_malloc (sizeof (struct system_state_s));
4483 #else
4484 if (sim_randstate)
4485 (void)sprintf(statenme, "%s.state", rssuffix);
4486 else
4487 (void)sprintf(statenme, "state");
4488 if (!sim_nostate)
4489 system_state = (struct system_state_s *)
4490 create_shm (statenme, sizeof (struct system_state_s));
4491 else
4492 # if !defined(_AIX)
4493 system_state = aligned_malloc (sizeof (struct system_state_s));
4494 # else
4495 system_state = malloc (sizeof (struct system_state_s));
4496 # endif
4497 #endif
4498
4499 if (!system_state) {
4500 int svErrno = errno;
4501 (void)fflush(stderr);
4502 (void)fflush(stdout);
4503 (void)sir_emerg ("FATAL: %s: aborting at %s[%s:%d]",
4504 xstrerror_l(svErrno), __func__, __FILE__, __LINE__);
4505 #if defined(USE_BACKTRACE)
4506 # if defined(SIGUSR2)
4507 (void)raise(SIGUSR2);
4508
4509 # endif
4510 #endif
4511 exit (svErrno);
4512 }
4513 #if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32) && !defined(__PASE__)
4514 if (!sim_nostate) {
4515 if (0 == sim_free_memory || sim_free_memory >= 192000000) {
4516 if (mlock(system_state, sizeof(struct system_state_s)) == -1) {
4517 mlock_failure = true;
4518 }
4519 } else {
4520 # if defined(TESTING)
4521 sim_warn ("No memory locking attempted.\r\n");
4522 # else
4523 (void)system_state;
4524 # endif
4525 }
4526 }
4527 #endif
4528
4529 #if !defined(PERF_STRIP)
4530
4531 # if !defined(VER_H_GIT_HASH)
4532 # define VER_H_GIT_HASH "0000000000000000000000000000000000000000"
4533 # endif
4534
4535 (void)fflush(stdout);
4536 (void)fflush(stderr);
4537
4538
4539 bool fresh_state = sim_nostate;
4540 # if defined(__MINGW64__) || defined(__MINGW32__) || defined(CROSS_MINGW64) || defined(CROSS_MINGW32)
4541 fresh_state = true;
4542 # endif
4543 if (fresh_state) {
4544 (void)memset (system_state, 0, sizeof (*system_state));
4545 } else if (system_state->commit_id[0] == '\0') {
4546 if (!sim_quiet && sim_randstate && sim_randompst)
4547 sim_printf ("Initialized new system state file \"dps8m.%s\"\r\n",
4548 statenme);
4549 } else {
4550 if (strncmp (system_state->commit_id, VER_H_GIT_HASH,
4551 sizeof (system_state->commit_id)) != 0) {
4552 (void)memset(system_state, 0, sizeof(*system_state));
4553 sim_warn ("NOTE: State hash mismatch; system state reset.\r\n");
4554 }
4555 }
4556 (void)fflush(stderr);
4557 (void)fflush(stdout);
4558
4559 strncpy (system_state->stateHdr, STATE_HDR, sizeof (system_state->stateHdr));
4560 system_state->stateVer = STATE_VER;
4561 strncpy (system_state->commit_id, VER_H_GIT_HASH, sizeof (system_state->commit_id));
4562
4563 systabInit ();
4564
4565
4566 (void)memset (& sys_opts, 0, sizeof (sys_opts));
4567
4568 sys_opts.sys_poll_interval = 10;
4569
4570 sys_opts.sys_slow_poll_interval = 100;
4571
4572 sys_opts.sys_poll_check_rate = 1024;
4573 #endif
4574
4575 #if defined(PERF_STRIP)
4576 cpu_init ();
4577 #else
4578 sysCableInit ();
4579 iom_init ();
4580 disk_init ();
4581 mt_init ();
4582 # if defined(WITH_SOCKET_DEV)
4583 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32)
4584 sk_init ();
4585 # endif
4586 # endif
4587 fnpInit ();
4588 console_init ();
4589 scu_init ();
4590 cpu_init ();
4591 rdr_init ();
4592 pun_init ();
4593 prt_init ();
4594 urp_init ();
4595
4596 # if defined(WITH_ABSI_DEV)
4597 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW64) && !defined(CROSS_MINGW32)
4598 absi_init ();
4599 # endif
4600 # endif
4601
4602 # if defined(WITH_MGP_DEV)
4603 mgp_init ();
4604 # endif
4605
4606 # if defined(WITH_NET_DEV)
4607 net_init ();
4608 # endif
4609
4610 set_default_base_system (0, NULL);
4611 # if defined(PANEL68)
4612 panelScraperInit ();
4613 # endif
4614 #endif
4615 #if defined(THREADZ) || defined(LOCKLESS)
4616 initThreadz ();
4617 #endif
4618 }
4619
4620
4621
4622 static void dps8_exit (void) {
4623 cpu_stop_poll_timer ();
4624 console_exit ();
4625 mt_exit ();
4626 fnpExit ();
4627 }
4628
4629 #if defined(TESTING)
4630 static struct pr_table
4631 {
4632 char * alias;
4633 int n;
4634 } _prtab[] =
4635 {
4636 { "pr0", 0 },
4637 { "pr1", 1 },
4638 { "pr2", 2 },
4639 { "pr3", 3 },
4640 { "pr4", 4 },
4641 { "pr5", 5 },
4642 { "pr6", 6 },
4643 { "pr7", 7 },
4644
4645 { "pr[0]", 0 },
4646 { "pr[1]", 1 },
4647 { "pr[2]", 2 },
4648 { "pr[3]", 3 },
4649 { "pr[4]", 4 },
4650 { "pr[5]", 5 },
4651 { "pr[6]", 6 },
4652 { "pr[7]", 7 },
4653
4654
4655 { "ap", 0 },
4656 { "ab", 1 },
4657 { "bp", 2 },
4658 { "bb", 3 },
4659 { "lp", 4 },
4660 { "lb", 5 },
4661 { "sp", 6 },
4662 { "sb", 7 },
4663 { 0, 0 }
4664 };
4665
4666 static int getAddress(int segno, int offset)
4667 {
4668
4669
4670
4671 sdw0_s *s = fetchSDW ((word15) segno);
4672
4673 return (s->ADDR + (word18) offset) & 0xffffff;
4674 }
4675
4676 static t_addr parse_addr (UNUSED DEVICE * dptr, const char *cptr,
4677 const char **optr)
4678 {
4679 cpu_state_t * cpup = _cpup;
4680
4681 if (strchr(cptr, '|'))
4682 {
4683 static char addspec[256];
4684 (void)strcpy(addspec, cptr);
4685
4686 *strchr(addspec, '|') = ' ';
4687
4688 char seg[256], off[256];
4689 int params = sscanf(addspec, "%s %s", seg, off);
4690 if (params != 2)
4691 {
4692 sim_warn("parse_addr(): illegal number of parameters\r\n");
4693 *optr = cptr;
4694 return 0;
4695 }
4696
4697
4698 char *endp;
4699 word18 PRoffset = 0;
4700 int segno = (int)strtoll(seg, &endp, 8);
4701 if (endp == seg)
4702 {
4703
4704
4705 struct pr_table *prt = _prtab;
4706 while (prt->alias)
4707 {
4708 if (strcasecmp(seg, prt->alias) == 0)
4709 {
4710 segno = cpu.PR[prt->n].SNR;
4711 PRoffset = cpu.PR[prt->n].WORDNO;
4712 break;
4713 }
4714
4715 prt += 1;
4716 }
4717
4718 if (!prt->alias)
4719 {
4720 return 0;
4721 }
4722 }
4723
4724
4725 uint offset = (uint)strtoll(off, &endp, 8);
4726 if (endp == off)
4727 {
4728
4729 return 0;
4730 }
4731
4732
4733
4734
4735
4736 word24 abs_addr = (word24) getAddress(segno, (int) (offset + PRoffset));
4737
4738
4739 *optr = endp;
4740
4741 return abs_addr;
4742 }
4743 else
4744 {
4745
4746 int segno = 0;
4747 word24 offset = 0;
4748 struct pr_table *prt = _prtab;
4749 while (prt->alias)
4750 {
4751 if (strncasecmp(cptr, prt->alias, strlen(prt->alias)) == 0)
4752 {
4753 segno = cpu.PR[prt->n].SNR;
4754 offset = cpu.PR[prt->n].WORDNO;
4755 break;
4756 }
4757
4758 prt += 1;
4759 }
4760 if (prt->alias)
4761 {
4762 word24 abs_addr = (word24) getAddress(segno, (int) offset);
4763 *optr = cptr + strlen(prt->alias);
4764
4765 return abs_addr;
4766 }
4767 }
4768
4769
4770 return (t_addr)strtol(cptr, (char **) optr, 8);
4771 }
4772 #endif
4773
4774 #if defined(TESTING)
4775 static void fprint_addr (FILE * stream, UNUSED DEVICE * dptr, t_addr simh_addr)
4776 {
4777 (void)fprintf(stream, "%06o", simh_addr);
4778 }
4779 #endif
4780
4781
4782
4783
4784
4785
4786
4787 t_stat fprint_sym (UNUSED FILE * ofile, UNUSED t_addr addr,
4788 UNUSED t_value *val, UNUSED UNIT *uptr, int32 UNUSED sw)
4789 {
4790 #if defined(TESTING)
4791
4792
4793
4794
4795
4796 cpu_state_t * cpup = _cpup;
4797
4798 if (!((uint) sw & SWMASK ('M')))
4799 return SCPE_ARG;
4800
4801 if (uptr == &cpu_dev.units[0])
4802 {
4803 word36 word1 = *val;
4804 char buf[256];
4805
4806 char *d = disassemble(buf, word1);
4807
4808 (void)fprintf(ofile, "%s", d);
4809
4810
4811 DCDstruct ci;
4812 DCDstruct * p = & ci;
4813 decode_instruction (cpup, word1, p);
4814
4815
4816 if (p->info->ndes > 1)
4817 {
4818
4819
4820
4821 for(uint n = 0 ; n < p->info->ndes; n += 1)
4822 (void)fprintf(ofile, " %012llo", (unsigned long long int)val[n + 1]);
4823
4824 return (t_stat) -p->info->ndes;
4825 }
4826
4827 return SCPE_OK;
4828
4829
4830
4831 }
4832 #endif
4833 return SCPE_ARG;
4834 }
4835
4836
4837
4838
4839
4840 t_stat parse_sym (UNUSED const char * cptr, UNUSED t_addr addr,
4841 UNUSED UNIT * uptr, UNUSED t_value * val, UNUSED int32 sswitch)
4842 {
4843 return SCPE_ARG;
4844 }
4845
4846 #if defined(THREADZ) || defined(LOCKLESS)
4847 volAtomic bool syncClockMode;
4848 volAtomic uint syncClockModeMasterIdx;
4849 #endif
4850
4851
4852
4853 sysinfo_t sys_opts;
4854
4855 static t_stat sys_show_config (UNUSED FILE * st, UNUSED UNIT * uptr,
4856 UNUSED int val, UNUSED const void * desc)
4857 {
4858 sim_msg ("IOM connect time: %d\r\n", sys_opts.iom_times.connect);
4859 sim_msg ("nosync %d\r\n", sys_opts.nosync);
4860 sim_msg ("tandd_io %d\r\n", sys_opts.tandd_io);
4861 return SCPE_OK;
4862 }
4863
4864 static config_value_list_t cfg_timing_list[] =
4865 {
4866 { "disable", -1 },
4867 { NULL, 0 }
4868 };
4869
4870 bool breakEnable = false;
4871
4872 static t_stat sys_set_break (UNUSED UNIT * uptr, int32 value,
4873 UNUSED const char * cptr, UNUSED void * desc)
4874 {
4875 breakEnable = !! value;
4876 return SCPE_OK;
4877 }
4878
4879 static t_stat sys_show_break (UNUSED FILE * st, UNUSED UNIT * uptr,
4880 UNUSED int val, UNUSED const void * desc)
4881 {
4882 sim_msg ("BREAK %s\r\n", breakEnable ? "ON" : "OFF" );
4883 return SCPE_OK;
4884 }
4885
4886 static config_value_list_t cfg_on_off [] =
4887 {
4888 { "off", 0 },
4889 { "on", 1 },
4890 { "disable", 0 },
4891 { "enable", 1 },
4892 { NULL, 0 }
4893 };
4894
4895 static config_list_t sys_config_list[] =
4896 {
4897 { "connect_time", -1, 100000, cfg_timing_list },
4898 { "nosync", 0, 1, cfg_on_off },
4899 { "color", 0, 1, cfg_on_off },
4900 { "tandd_io", 0, 1, cfg_on_off },
4901 { NULL, 0, 0, NULL }
4902 };
4903
4904 static t_stat sys_set_config (UNUSED UNIT * uptr, UNUSED int32 value,
4905 const char * cptr, UNUSED void * desc)
4906 {
4907 config_state_t cfg_state = { NULL, NULL };
4908
4909 for (;;)
4910 {
4911 int64_t v;
4912 int rc = cfg_parse ("sys_set_config", cptr, sys_config_list, & cfg_state,
4913 & v);
4914 if (rc == -1)
4915 {
4916 break;
4917 }
4918 if (rc == -2)
4919 {
4920 cfg_parse_done (& cfg_state);
4921 return SCPE_ARG;
4922 }
4923
4924 const char * p = sys_config_list[rc].name;
4925 if (strcmp (p, "connect_time") == 0)
4926 sys_opts.iom_times.connect = (int) v;
4927 else if (strcmp (p, "color") == 0)
4928 sys_opts.no_color = ! v;
4929 else if (strcmp (p, "nosync") == 0)
4930 sys_opts.nosync = !! v;
4931 else if (strcmp (p, "tandd_io") == 0)
4932 sys_opts.tandd_io = !! v;
4933 else
4934 {
4935 sim_msg ("error: sys_set_config: Invalid cfg_parse rc <%ld>\r\n", (long) rc);
4936 cfg_parse_done (& cfg_state);
4937 return SCPE_ARG;
4938 }
4939 }
4940 cfg_parse_done (& cfg_state);
4941 return SCPE_OK;
4942 }
4943
4944 static MTAB sys_mod[] =
4945 {
4946 {
4947 MTAB_dev_value,
4948 0,
4949 (char *) "CONFIG",
4950 (char *) "CONFIG",
4951 sys_set_config,
4952 sys_show_config,
4953 NULL,
4954 NULL,
4955 },
4956 {
4957 MTAB_dev_novalue,
4958 1,
4959 (char *) "BREAK",
4960 (char *) "BREAK",
4961 sys_set_break,
4962 sys_show_break,
4963 NULL,
4964 NULL,
4965 },
4966 {
4967 MTAB_dev_novalue,
4968 0,
4969 (char *) "NOBREAK",
4970 (char *) "NOBREAK",
4971 sys_set_break,
4972 sys_show_break,
4973 NULL,
4974 NULL,
4975 },
4976 MTAB_eol
4977 };
4978
4979 static t_stat sys_reset (UNUSED DEVICE * dptr)
4980 {
4981 return SCPE_OK;
4982 }
4983
4984 static DEVICE sys_dev = {
4985 "SYS",
4986 NULL,
4987 NULL,
4988 sys_mod,
4989 0,
4990 8,
4991 PASIZE,
4992 1,
4993 8,
4994 36,
4995 NULL,
4996 NULL,
4997 & sys_reset,
4998 NULL,
4999 NULL,
5000 NULL,
5001 NULL,
5002 0,
5003 0,
5004 0,
5005 NULL,
5006 NULL,
5007 NULL,
5008 NULL,
5009 NULL,
5010 NULL,
5011 NULL
5012 };
5013
5014
5015 DEVICE * sim_devices[] =
5016 {
5017 & cpu_dev,
5018 & iom_dev,
5019 & tape_dev,
5020 #if defined(WITH_SOCKET_DEV)
5021 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW32) && !defined(CROSS_MINGW64)
5022 & skc_dev,
5023 # endif
5024 #endif
5025 & mtp_dev,
5026 & fnp_dev,
5027 & dsk_dev,
5028 & ipc_dev,
5029 & msp_dev,
5030 & scu_dev,
5031 & opc_dev,
5032 & sys_dev,
5033 & urp_dev,
5034 & rdr_dev,
5035 & pun_dev,
5036 & prt_dev,
5037
5038 #if defined(WITH_ABSI_DEV)
5039 # if !defined(__MINGW64__) && !defined(__MINGW32__) && !defined(CROSS_MINGW32) && !defined(CROSS_MINGW64)
5040 & absi_dev,
5041 # endif
5042 #endif
5043
5044 #if defined(WITH_MGP_DEV)
5045 & mgp_dev,
5046 #endif
5047
5048 #if defined(WITH_NET_DEV)
5049 & net_dev,
5050 #endif
5051
5052 NULL
5053 };
5054
5055 #if defined(PERF_STRIP)
5056 void dps8_init_strip (void)
5057 {
5058 dps8_init ();
5059 }
5060 #endif