initial
[fpgammix.git] / workloads / common / interrupts.S
blobcb3df0d814bdb31be8d550a7f37061eb4ad84c01
1         .text
3 /* Handler for TRIP             #0 */
4         pushj   255,triphandler
5         put     rJ,$255
6         get     $255,rB
7         resume
8 /* Handler for exception D      #10 integer Divide check */
9         pushj   255,excdhandler
10         put     rJ,$255
11         get     $255,rB
12         resume
13 /* Handler for exception V      #20 integer oVerflow */
14         pushj   255,excvhandler
15         put     rJ,$255
16         get     $255,rB
17         resume
18 /* Handler for exception W      #30 float-to-fix overfloW */
19         pushj   255,excwhandler
20         put     rJ,$255
21         get     $255,rB
22         resume
23 /* Handler for exception I      #40 Invalid operation */
24         pushj   255,excihandler
25         put     rJ,$255
26         get     $255,rB
27         resume
28 /* Handler for exception O      #50 floating Overflow */
29         pushj   255,excohandler
30         put     rJ,$255
31         get     $255,rB
32         resume
33 /* Handler for exception U      #60 floating Underflow */
34         pushj   255,excuhandler
35         put     rJ,$255
36         get     $255,rB
37         resume
38 /* Handler for exception Z      #70 floating division by Zero */
39         pushj   255,exczhandler
40         put     rJ,$255
41         get     $255,rB
42         resume
43 /* Handler for exception X      #80 floating ineXact */
44         pushj   255,excxhandler
45         put     rJ,$255
46         get     $255,rB
47         resume
49 /*      LOC     #10000 */
51         .p2align 2
52         .global interruptvector
54 interruptvector:
55         pushj   255,1F/* To allocate some free variables */
56         put     rJ,$255         /* Restore rJ */
57         nxor    $255,$0,$0      /* Set up new interrupt mask (enable all) */
58         resume  1
60 /* Must preserve $255 */
61 1H      get     $0,rQ           /* Get all pending interrupts */
62         subu    $1,$0,1
63         and     $2,$0,$1        /* Clears just the highest priority one */
64         put     rQ,$2
66 /* Calculate the index of the highest priority and pass it to the interrupt handler */
67         sadd    $0,$1,$0
68         jmp     interrupthandler
70 triphandler     get     $250,rA
71                 get     $251,rX
72                 get     $252,rY
73                 get     $253,rZ
74                 addu    $250,$251,$252
75                 pop     0,0
76 excdhandler     get     $250,rA
77                 pop     0,0
78 excvhandler     get     $250,rA
79                 pop     0,0
80 excwhandler     get     $250,rA
81                 pop     0,0
82 excihandler     get     $250,rA
83                 pop     0,0
84 excohandler     get     $250,rA
85                 pop     0,0
86 excuhandler     get     $250,rA
87                 pop     0,0
88 exczhandler     get     $250,rA
89                 pop     0,0
90 excxhandler     get     $250,rA
91                 pop     0,0
93 trapvector      pushj   255,traphandler
94                 put     rJ,$255
95                 get     $255,rBB
96                 resume  1
99 #ifndef USER_TRAPHANDLER
100 traphandler     pop     0,0
101 #endif