OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [libgloss/] [hp74x/] [iva_table.s] - Blame information for rev 258

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.