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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
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
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
|
/****************************************************************************
THIS SOFTWARE IS NOT COPYRIGHTED
HP offers the following for use in the public domain. HP makes no
warranty with regard to the software or its performance and the
user accepts the software "AS IS" with all faults.
HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
****************************************************************************/
.space $TEXT$
.subspa $CODE$,access=0x2c
#include "diagnose.h"
#if 0
#include "iva_table.h"
#endif
R_gr0 .equ 0
R_gr1 .equ 4
R_gr2 .equ 8
R_gr3 .equ 12
R_gr4 .equ 16
R_gr5 .equ 20
R_gr6 .equ 24
R_gr7 .equ 28
R_gr8 .equ 32
R_gr9 .equ 36
R_gr10 .equ 40
R_gr11 .equ 44
R_gr12 .equ 48
R_gr13 .equ 52
R_gr14 .equ 56
R_gr15 .equ 60
R_gr16 .equ 64
R_gr17 .equ 68
R_gr18 .equ 72
R_gr19 .equ 76
R_gr20 .equ 80
R_gr21 .equ 84
R_gr22 .equ 88
R_gr23 .equ 92
R_gr24 .equ 96
R_gr25 .equ 100
R_gr26 .equ 104
R_gr27 .equ 108
R_gr28 .equ 112
R_gr29 .equ 116
R_gr30 .equ 120
R_gr31 .equ 124
R_rctr .equ 160
R_cpu0 .equ 164
R_pidr1 .equ 168
R_pidr2 .equ 172
R_ccr .equ 176
R_sar .equ 180
R_pidr3 .equ 184
R_pidr4 .equ 188
R_iva .equ 192
R_eiem .equ 196
R_itmr .equ 200
R_pcsqH .equ 204
R_pcoqH .equ 208
R_iir .equ 212
R_pcsqT .equ 216
R_pcoqT .equ 220
R_isr .equ 224
R_ior .equ 228
R_ipsw .equ 232
R_eirr .equ 236
R_tr0 .equ 240
R_tr1 .equ 244
R_tr2 .equ 248
R_tr3 .equ 252
R_tr4 .equ 256
R_tr5 .equ 260
R_tr6 .equ 264
R_tr7 .equ 268
R_SIZE .equ 300
.import putc,code
.import puts,code
.import putnum,code
.import put_led,code
.import save_regs,code
.import STUB_RESTORE,code
.import RegBlk,data
.export iva_table,data
.IMPORT led_putnum,code
.IMPORT delay,code
.IMPORT putnum,code
.IMPORT outbyte,code
.IMPORT print,code
.align 2048
iva_table
.blockz 32 ; entry 0 is reserved
.align 32
hpmc
nop
b,n hpmc_handler
nop
.word 0
.word 0
.word 0
.word hpmc_handler
.word 0
.align 32
power_fail
; PrintString Str02,0x2
ldi 1,%r26
bl,n putnum,%r2
nop
.align 32
recovery
;; PrintString Str03,0x3
ldi 2,%r26
bl,n putnum,%r2
nop
ldi 3,%r1
b,n handle_rcc
nop
.align 32
external
; PrintString Str04,0x4
ldi 3,%r26
bl,n putnum,%r2
nop
.align 32
lpmc
; PrintString Str05,0x5
ldi 4,%r26
bl,n putnum,%r2
nop
.align 32
itlb_miss
; PrintString Str06,0x6
ldi 5,%r26
bl,n putnum,%r2
nop
.align 32
imem_protection
; PrintString Str07,0x7
ldi 6,%r26
bl,n putnum,%r2
nop
.align 32
illegal_inst
; PrintString Str08,0x8
ldi 7,%r26
bl,n putnum,%r2
nop
.align 32
break
b,n break_handler
nop
.align 32
privileged_op
; PrintString Str0a,0xa
ldi 8,%r26
bl,n putnum,%r2
nop
.align 32
privileged_reg
; PrintString Str0b,0xb
ldi 9,%r26
bl,n putnum,%r2
nop
.align 32
overflow
; PrintString Str0c,0xc
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
conditional
; PrintString Str0d,0xd
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
assist_excep
; PrintString Str0e,0xe
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
dtlb_miss
; PrintString Str0f,0xf
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
na_itlb
; PrintString Str10,0x10
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
na_dtlb
; PrintString Str11,0x11
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
dmem_protection
; PrintString Str12,0x12
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
dmem_break
; PrintString Str13,0x13
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
tlb_dirty
; PrintString Str14,0x14
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
page_ref
; PrintString Str15,0x15
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
assist_emul
; PrintString Str16,0x16
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
high_priv
; PrintString Str17,0x17
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
low_priv
; PrintString Str18,0x18
ldi 32,%r26
bl,n putnum,%r2
nop
.align 32
branch_taken
; PrintString Str19,0x19
ldi 32,%r26
bl,n putnum,%r2
nop
/*
* foobar -- debug procedure calling between C and assembler
*/
.EXPORT foobar,ENTRY,ARGW0=GR,RTNVAL=GR
foobar
.PROC
.CALLINFO CALLER,FRAME=128,SAVE_RP
.ENTRY
stw %r2,-20(0,%r30) ; stash the return pointer
ldo 128(%r30),%r30 ; push up the stack pointer
ldi 8, %r26
bl,n led_putnum,%r2
nop
ldil L'900000,%r26
ldo R'900000(%r26),%r26
bl,n delay,%r2
nop
ldi 8, %r26
bl,n led_putnum,%r2
nop
ldil L'900000,%r26
ldo R'900000(%r26),%r26
bl,n delay,%r2
nop
;; copy %r26,%r26
;; bl,n putnum,%r2
nop
ldw -148(0,%r30),%r2 ; retrieve the return pointer
ldo -128(%r30),%r30 ; reset the stack pointer
bv,n 0(%r2)
nop
.EXIT
.PROCEND
/*
* setup_vectors -- add vectors for GDB to the vector table.
* %r3 - current vector table
* %r4 - new vector table
*/
.EXPORT setup_vectors,ENTRY,ARGW0=GR,RTNVAL=GR
setup_vectors
.PROC
.CALLINFO CALLER,FRAME=128,SAVE_RP
.ENTRY
stw %r2,-20(0,%r30) ; stash the return pointer
ldo 128(%r30),%r30 ; push up the stack pointer
mfctl %iva,%r3
ldil L%iva_table,%r4 ; Get the new vector table
ldo R%iva_table(%r4),%r4 ; address
ldil L%break_handler,%r5 ; Get the breakpoint
ldo R%break_handler(%r5),%r5 ; handler vector
ldil L%break_default,%r6 ; Get the default handler
ldo R%break_default(%r6),%r6 ; vector
stw %r6,4(%r4) ; ad the default vector
stw %r5,36(%r4) ; add the break vector
mtctl %r4,%iva
ldw -148(0,%r30),%r2 ; retrieve the return pointer
ldo -128(%r30),%r30 ; reset the stack pointer
bv,n 0(%r2)
nop
.EXIT
.PROCEND
;-------------------------------------------------------------------------------
hpmc_handler
bl,n save_state,%r25
nop
bl print_intr,%rp
ldi Str01-Str01,%arg0
bl print_state,%rp
nop
ldil L%0xf0000000,%r1
ldw (%r1),%r1 ; read from ROM to reset HPMC
mfcpu_c 0,%r1
mfcpu_c 0,%r1
depi 0,CPU_DIAG_0_PREV_HPMC_PREP_BIT,1,%r1 ; clear Prev HPMC bit
#ifdef PCXL
depi 0,CPU_DIAG_0_L2DHPMC_BIT,1,%r1
depi 0,CPU_DIAG_0_L2IHPMC_BIT,1,%r1
depi 0,CPU_DIAG_0_L1IHPMC_BIT,1,%r1
depi 0,CPU_DIAG_0_L2PARERR_BIT,4,%r1
#else /* PCXT */
depi 0,CPU_DIAG_0_DHPMC_BIT,1,%r1 ; don't clear DHPMC
depi 0,CPU_DIAG_0_ILPMC_BIT,1,%r1 ; don't clear ILPMC
depi 0,CPU_DIAG_0_HTOC_BIT,1,%r1 ; don't clear HTOC
#endif
mtcpu %r1,0
mtcpu %r1,0
b,n restore_to_STUB
ldi 0x1,%r1
/*
* break_handler -- this is the main entry point for an exception
*/
.ALIGN 2048
break_handler
mfctl %iir,%r1 ; r1 = break instruction
extru %r1,18,13,%r8
ldo -i13BREAK(%r8),%r8 ; if im13 field doesn't match
comb,<>,n %r8,%r0,break_default ; go to default operation
extru %r1,31,5,%r8
ldi 0x9,%r1 ; set exception index
comib,=,n i5BP,%r8,break_breakpoint
comib,=,n i5PSW,%r8,break_psw
comib,=,n i5REG,%r8,break_reg_init
comib,=,n i5INLINE,%r8,break_breakpoint
; fall through to break_default
break_default
; PrintString Str09,0x9
ldi 32,%r26
bl,n putnum,%r2
nop
break_reg_init
bl setup_vectors,%r25
nop
bl save_regs,%r25
nop
; fall through to advance past break instruction
break_psw
b,n recover
break_breakpoint
b,n STUB_RESTORE
;-------------------------------------------------------------------------------
handle_rcc
mfctl %ipsw,%r1
bb,>=,n %r1,10,do_restore ; check nullify bit
dep %r0,10,1,%r1
mtctl %r1,%ipsw ; clear nullify bit
;; was the AdvancePCOQ .macro
mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head
mfctl %pcoq,%r1 ; get tail pointer
mtctl %r1,%pcoq ; insert tail pointer
ldo 4(%r1),%r1 ; advance tail pointer
mtctl %r1,%pcoq ; insert new tail pointer, former tail->head
do_restore
b,n STUB_RESTORE
nop
;-------------------------------------------------------------------------------
print_intr
; %dp may be messed up, so do self-relocating to reach Save_area
blr %r0,%r1
addil L%Str01-pr_intr_0,%r1
pr_intr_0
ldo R%Str01-pr_intr_0(%r1),%r1 ; r1 points to Save_area
b puts ; print string--return through rp
add %r1,%arg0,%arg0
;-------------------------------------------------------------------------------
halt
; %dp may be messed up, so do self-relocating to reach Save_area
blr %r0,%r1
addil L%HaltStr-halt_0,%r1
halt_0
bl puts,%rp ; print halt message
ldo R%HaltStr-halt_0(%r1),%arg0
nop
b,n . ; loop forever
nop
;-------------------------------------------------------------------------------
recover
;; was the AdvancePCOQ .macro
mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head
mfctl %pcoq,%r1 ; get tail pointer
mtctl %r1,%pcoq ; insert tail pointer
ldo 4(%r1),%r1 ; advance tail pointer
mtctl %r1,%pcoq ; insert new tail pointer, former tail->head
rfir
;-------------------------------------------------------------------------------
save_state ; %r25 is return pointer
; %dp may be messed up, so do self-relocating to reach Save_area
blr %r0,%r1
addil L%Save_area-sa_st_0,%r1
sa_st_0
ldo R%Save_area-sa_st_0(%r1),%r1 ; r1 points to Save_area
; save general registers
stw %r0,R_gr0(%r1)
; don't save %r1 until restored
stw %r2,R_gr2(%r1)
stw %r3,R_gr3(%r1)
stw %r4,R_gr4(%r1)
stw %r5,R_gr5(%r1)
stw %r6,R_gr6(%r1)
stw %r7,R_gr7(%r1)
; don't save %r8, %r9 until restored
stw %r10,R_gr10(%r1)
stw %r11,R_gr11(%r1)
stw %r12,R_gr12(%r1)
stw %r13,R_gr13(%r1)
stw %r14,R_gr14(%r1)
stw %r15,R_gr15(%r1)
; don't save %r16, %r17 until restored
stw %r18,R_gr18(%r1)
stw %r19,R_gr19(%r1)
stw %r20,R_gr20(%r1)
stw %r21,R_gr21(%r1)
stw %r22,R_gr22(%r1)
stw %r23,R_gr23(%r1)
; don't save %r24, %r25 until restored
stw %r26,R_gr26(%r1)
stw %r27,R_gr27(%r1)
stw %r28,R_gr28(%r1)
stw %r29,R_gr29(%r1)
copy %r25,%rp ; copy return pointer to %rp
stw %r30,R_gr30(%r1)
copy %r1,%r19 ; save Save_area pointer in %r19
stw %r31,R_gr31(%r1)
shdw_gr ; restore %r1 and %r25 (et al.) from shadow regs
shdw_gr
stw %r1,R_gr1(%r19) ; save %r1
stw %r8,R_gr8(%r19)
stw %r9,R_gr9(%r19)
stw %r16,R_gr16(%r19)
stw %r17,R_gr17(%r19)
stw %r24,R_gr24(%r19)
; save control registers
mfctl %rctr,%r1
stw %r1,R_rctr(%r19)
mfctl %pidr1,%r1
stw %r1,R_pidr1(%r19)
mfctl %pidr2,%r1
stw %r1,R_pidr2(%r19)
mfctl %ccr,%r1
stw %r1,R_ccr(%r19)
mfctl %sar,%r1
stw %r1,R_sar(%r19)
mfctl %pidr3,%r1
stw %r1,R_pidr3(%r19)
mfctl %pidr4,%r1
stw %r1,R_pidr4(%r19)
mfctl %iva,%r1
stw %r1,R_iva(%r19)
mfctl %eiem,%r1
stw %r1,R_eiem(%r19)
mfctl %itmr,%r1
stw %r1,R_itmr(%r19)
mfctl %pcsq,%r1
mtctl %r1,%pcsq
stw %r1,R_pcsqH(%r19)
mfctl %pcsq,%r1
mtctl %r1,%pcsq
stw %r1,R_pcsqT(%r19)
mfctl %pcoq,%r1
mtctl %r1,%pcoq
stw %r1,R_pcoqH(%r19)
mfctl %pcoq,%r1
mtctl %r1,%pcoq
stw %r1,R_pcoqT(%r19)
mfctl %iir,%r1
stw %r1,R_iir(%r19)
mfctl %isr,%r1
stw %r1,R_isr(%r19)
mfctl %ior,%r1
stw %r1,R_ior(%r19)
mfctl %ipsw,%r1
stw %r1,R_ipsw(%r19)
mfctl %eirr,%r1
stw %r1,R_eirr(%r19)
mfctl %tr0,%r1
stw %r1,R_tr0(%r19)
mfctl %tr1,%r1
stw %r1,R_tr1(%r19)
mfctl %tr2,%r1
stw %r1,R_tr2(%r19)
mfctl %tr3,%r1
stw %r1,R_tr3(%r19)
mfctl %tr4,%r1
stw %r1,R_tr4(%r19)
mfctl %tr5,%r1
stw %r1,R_tr5(%r19)
mfctl %tr6,%r1
stw %r1,R_tr6(%r19)
mfctl %tr7,%r1
stw %r1,R_tr7(%r19)
; save diagnose registers
mfcpu_c 0,%r1
mfcpu_c 0,%r1
stw %r1,R_cpu0(%r19)
#ifdef PRINT_SPACE
stw %r25,R_gr25(%r19)
; save space registers
mfsp %sr0,%r1
stw %r1,R_sr0(%r19)
mfsp %sr1,%r1
stw %r1,R_sr1(%r19)
mfsp %sr2,%r1
stw %r1,R_sr2(%r19)
mfsp %sr3,%r1
stw %r1,R_sr3(%r19)
mfsp %sr4,%r1
stw %r1,R_sr4(%r19)
mfsp %sr5,%r1
stw %r1,R_sr5(%r19)
mfsp %sr6,%r1
stw %r1,R_sr6(%r19)
mfsp %sr7,%r1
bv (%rp)
stw %r1,R_sr7(%r19)
#else
bv (%rp)
stw %r25,R_gr25(%r19)
#endif
;-------------------------------------------------------------------------------
restore_to_STUB ; doesn't return--goes to STUB_RESTORE
; Note--STUB_RESTORE executes rfir,
; so we don't need to
copy %r1,%r8 ; save exception index
; %dp may be messed up, so do self-relocating to reach Save_area
bl re_st_0,%r1
addil L%Save_area-re_st_0,%r1
re_st_0
ldo R%Save_area-re_st_0(%r1),%r1 ; r1 points to Save_area
; restore general registers
ldw R_gr2(%r1),%r2
ldw R_gr3(%r1),%r3
ldw R_gr4(%r1),%r4
ldw R_gr5(%r1),%r5
ldw R_gr6(%r1),%r6
ldw R_gr7(%r1),%r7
; ldw R_gr8(%r1),%r8 don't smash the exception index
ldw R_gr9(%r1),%r9
ldw R_gr10(%r1),%r10
ldw R_gr11(%r1),%r11
ldw R_gr12(%r1),%r12
ldw R_gr13(%r1),%r13
ldw R_gr14(%r1),%r14
ldw R_gr15(%r1),%r15
ldw R_gr16(%r1),%r16
ldw R_gr17(%r1),%r17
ldw R_gr18(%r1),%r18
ldw R_gr19(%r1),%r19
ldw R_gr20(%r1),%r20
ldw R_gr21(%r1),%r21
ldw R_gr22(%r1),%r22
ldw R_gr23(%r1),%r23
ldw R_gr24(%r1),%r24
ldw R_gr25(%r1),%r25
ldw R_gr26(%r1),%r26
ldw R_gr27(%r1),%r27
ldw R_gr28(%r1),%r28
ldw R_gr29(%r1),%r29
ldw R_gr30(%r1),%r30
ldw R_gr31(%r1),%r31
ldw R_gr1(%r1),%r1
b STUB_RESTORE
copy %r8,%r1 ; restore the exception index
;-------------------------------------------------------------------------------
#define HoldPtr %r10
#define SavePtr %r11
#define StrPtr %r12
#define Count %r13
#define Hold_Hold 0*4 /* First word of hold area */
#define Hold_Save 1*4 /* Second word of hold area */
#define Hold_Str 2*4 /* Third word of hold area */
#define Hold_Count 3*4 /* Fourth word of hold area */
#define Hold_rp 4*4 /* Fifth word of hold area */
print_state
; %dp may be messed up, so do self-relocating to reach Save_area
blr %r0,%mrp
addil L%Hold_area-pr_st_0,%mrp
pr_st_0
ldo R%Hold_area-pr_st_0(%r1),%r1 ; r1 points to Hold_area
; save working registers
stw HoldPtr,Hold_Hold(%r1)
copy %r1,HoldPtr ; HoldPtr = &Hold_area
stw SavePtr,Hold_Save(HoldPtr)
ldo Save_area-Hold_area(HoldPtr),SavePtr ; SavePtr = &Save_area
stw StrPtr,Hold_Str(HoldPtr)
addil L%PrintLabels-pr_st_0,%mrp
stw Count,Hold_Count(HoldPtr)
ldo R%PrintLabels-pr_st_0(%r1),StrPtr
stw %rp,Hold_rp(HoldPtr)
#ifdef PRINT_SPACE
ldi 68,Count
#else
ldo R_gr0(SavePtr),SavePtr
ldi 60,Count
#endif
; print register values
print_loop
bl puts,%rp ; print label
ldo 1(StrPtr),%arg0 ; advance past length byte
bl putnum,%rp ; print register value
ldwm 4(SavePtr),%arg0
ldbs,ma 1(StrPtr),%r1
addib,> -1,Count,print_loop
add %r1,StrPtr,StrPtr
; skip to next line
bl puts,%rp ; print label
ldo 1(StrPtr),%arg0 ; advance past length byte
; restore working registers
ldw Hold_rp(HoldPtr),%rp
ldw Hold_Count(HoldPtr),Count
ldw Hold_Str(HoldPtr),StrPtr
ldw Hold_Save(HoldPtr),SavePtr
bv (%rp)
ldw Hold_Hold(HoldPtr),HoldPtr
#undef SavePtr
#undef HoldPtr
#undef StrPtr
#undef Count
#undef Hold_Save
#undef Hold_Scr
#undef Hold_Str
#undef Hold_Count
#undef Hold_rp
;-------------------------------------------------------------------------------
.space $PRIVATE$
.subspa $DATA$,align=4,access=0x1f
/* Used to save machine registers before printing */
Save_area
.block R_SIZE ; Used to store registers
/* Used to hold callee-save registers */
Hold_area
.block 8*4 ; 8 words to store temp. registers
HaltStr
.stringz "\r\nHalted\r\n"
RebootStr
.stringz "\r\nRebooting . . .\r\n"
Str01
.stringz "\r\nHPMC\r\n"
Str02
.stringz "\r\nPower Fail\r\n"
Str03
.stringz "\r\nRecovery Counter Trap\r\n"
Str04
.stringz "\r\nExternal Interrupt\r\n"
Str05
.stringz "\r\nLPMC\r\n"
Str06
.stringz "\r\nITLB Miss\r\n"
Str07
.stringz "\r\nInstruction Memory Protection Trap\r\n"
Str08
.stringz "\r\nIllegal Instruction\r\n"
Str09
.stringz "\r\nBreak Trap\r\n"
Str0a
.stringz "\r\nPrivileged Operation\r\n"
Str0b
.stringz "\r\nPrivileged Register\r\n"
Str0c
.stringz "\r\nOverflow Trap\r\n"
Str0d
.stringz "\r\nConditional Trap\r\n"
Str0e
.stringz "\r\nAssist Exception\r\n"
Str0f
.stringz "\r\nData TLB Miss\r\n"
Str10
.stringz "\r\nNon-access ITLB Miss\r\n"
Str11
.stringz "\r\nNon-access DTLB Miss\r\n"
Str12
.stringz "\r\nData Memory Protection Trap\r\n"
Str13
.stringz "\r\nData Memory Break\r\n"
Str14
.stringz "\r\nTLB Dirty Bit Trap\r\n"
Str15
.stringz "\r\nPage Reference Trap\r\n"
Str16
.stringz "\r\nAssist Emulation Trap\r\n"
Str17
.stringz "\r\nHigher-privilege Trap\r\n"
Str18
.stringz "\r\nLower-privilege Trap\r\n"
Str19
.stringz "\r\nTaken Branch Trap\r\n"
Str20
.stringz "\r\nHere I am!\r\n"
PrintLabels
#ifdef PRINT_SPACE
.byte 10
.stringz "sr 0 = 0x"
.byte 13
.stringz "sr 1 = 0x"
.byte 13
.stringz "sr 2 = 0x"
.byte 13
.stringz " sr 3 = 0x"
.byte 12
.stringz "\r\nsr 4 = 0x"
.byte 13
.stringz " sr 5 = 0x"
.byte 13
.stringz " sr 6 = 0x"
.byte 13
.stringz " sr 7 = 0x"
.byte 13
.stringz "\r\n\ngr 0 = 0x"
#else
.byte 10
.stringz "gr 0 = 0x"
#endif
.byte 13
.stringz " gr 1 = 0x"
.byte 13
.stringz " gr 2 = 0x"
.byte 13
.stringz " gr 3 = 0x"
.byte 12
.stringz "\r\ngr 4 = 0x"
.byte 13
.stringz " gr 5 = 0x"
.byte 13
.stringz " gr 6 = 0x"
.byte 13
.stringz " gr 7 = 0x"
.byte 12
.stringz "\r\ngr 8 = 0x"
.byte 13
.stringz " gr 9 = 0x"
.byte 13
.stringz " gr10 = 0x"
.byte 13
.stringz " gr11 = 0x"
.byte 12
.stringz "\r\ngr12 = 0x"
.byte 13
.stringz " gr13 = 0x"
.byte 13
.stringz " gr14 = 0x"
.byte 13
.stringz " gr15 = 0x"
.byte 12
.stringz "\r\ngr16 = 0x"
.byte 13
.stringz " gr17 = 0x"
.byte 13
.stringz " gr18 = 0x"
.byte 13
.stringz " gr19 = 0x"
.byte 12
.stringz "\r\ngr20 = 0x"
.byte 13
.stringz " gr21 = 0x"
.byte 13
.stringz " gr22 = 0x"
.byte 13
.stringz " gr23 = 0x"
.byte 12
.stringz "\r\ngr24 = 0x"
.byte 13
.stringz " gr25 = 0x"
.byte 13
.stringz " gr26 = 0x"
.byte 13
.stringz " gr27 = 0x"
.byte 12
.stringz "\r\ngr28 = 0x"
.byte 13
.stringz " gr29 = 0x"
.byte 13
.stringz " gr30 = 0x"
.byte 13
.stringz " gr31 = 0x"
.byte 13
.stringz "\r\n\nrctr = 0x"
.byte 53
.stringz " cpu0 = 0x"
.byte 12
.stringz "\r\npid1 = 0x"
.byte 13
.stringz " pid2 = 0x"
.byte 13
.stringz " ccr = 0x"
.byte 13
.stringz " sar = 0x"
.byte 12
.stringz "\r\npid3 = 0x"
.byte 13
.stringz " pid4 = 0x"
.byte 13
.stringz " iva = 0x"
.byte 13
.stringz " eiem = 0x"
.byte 12
.stringz "\r\nitmr = 0x"
.byte 13
.stringz " iasq = 0x"
.byte 13
.stringz " iaoq = 0x"
.byte 13
.stringz " iir = 0x"
.byte 32
.stringz "\r\n iasq = 0x"
.byte 13
.stringz " iaoq = 0x"
.byte 12
.stringz "\r\n isr = 0x"
.byte 13
.stringz " ior = 0x"
.byte 13
.stringz " ipsw = 0x"
.byte 13
.stringz " eirr = 0x"
.byte 12
.stringz "\r\ncr24 = 0x"
.byte 13
.stringz " cr25 = 0x"
.byte 13
.stringz " cr26 = 0x"
.byte 13
.stringz " cr27 = 0x"
.byte 12
.stringz "\r\ncr28 = 0x"
.byte 13
.stringz " cr29 = 0x"
.byte 13
.stringz " cr30 = 0x"
.byte 13
.stringz " cr31 = 0x"
.byte 4
.stringz "\r\n\n"
.end
|