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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems/] [c/] [src/] [exec/] [score/] [cpu/] [a29k/] [sig.S] - Blame information for rev 208

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

Line No. Rev Author Line
1 158 chris
;/*
2 208 chris
; *  $Id: sig.S,v 1.2 2001-09-27 11:59:21 chris Exp $
3 158 chris
; */
4
 
5
;       .include "register.ah"
6
        .include "amd.ah"
7
        .include "pswmacro.ah"
8
        .comm   WindowSize,4
9
        .text
10
        .reg    it0,gr64
11
        .reg    it1,gr65
12
        .reg    it2,gr66
13
        .reg    it3,gr67
14
        .reg    v0,gr96
15
        .reg    v1,gr97
16
        .reg    v2,gr98
17
        .reg    v3,gr99
18
        .reg    trapreg,it0
19
        .reg    FPStat0,gr79
20
        .reg    FPStat1,gr79
21
        .reg    FPStat2,gr79
22
        .reg    FPStat3,gr79
23
 
24
        .global _intr14
25
_intr14:
26
        const   it3,14
27
        sup_sv
28
        jmp     interrupt
29
        nop
30
 
31
        .global _intr18
32
_intr18:
33
        const   it3,18
34
        sup_sv
35
        jmp     interrupt
36
        nop
37
 
38
        .global _intr19
39
_intr19:
40
        const   it3,19
41
        sup_sv
42
        jmp     interrupt
43
        nop
44
 
45
interrupt:
46
        push    msp,it3
47
        push    msp,gr1
48
        push    msp,rab
49
        const   it0,512
50
        sub     rab,rfb,it0     ;set rab = rfb-512
51
        pushsr  msp,it0,pc0
52
        pushsr  msp,it0,pc1
53
        pushsr  msp,it0,pc2
54
        pushsr  msp,it0,cha
55
        pushsr  msp,it0,chd
56
        pushsr  msp,it0,chc
57
        pushsr  msp,it0,alu
58
        pushsr  msp,it0,ops
59
        push    msp,tav
60
;
61
;now come off freeze, and go to user-mode code.
62
;ensure load/store does not restart
63
;
64
        mtsrim  chc,0
65
 
66
        mfsr    it0, cps
67
        const   it1, FZ
68
        consth  it1, FZ
69
        andn    it0, it0, it1
70
        const   it1,(DI|TD)
71
        consth  it1,(DI|TD)
72
        or      it0,it1,it0
73
        mtsr    cps, it0
74
; fall through to _sigcode
75
 
76
        .extern _a29k_ISR_Handler
77
        .global _sigcode
78
_sigcode:
79
 
80
        push    msp, lr1                                ; R stack support
81
        push    msp, rfb                                ; support
82
        push    msp, msp                                ; M stack support
83
 
84
;       push    msp, FPStat0                            ; Floating point 0
85
;       push    msp, FPStat1                            ; Floating point 1
86
;       push    msp, FPStat2                            ; Floating point 2
87
;       push    msp, FPStat3                            ; Floating point 3
88
        sub     msp,msp,4*4
89
 
90
        pushsr  msp, tav, IPA                           ; save user mode special
91
        pushsr  msp, tav, IPB                           ; save user mode special
92
        pushsr  msp, tav, IPC                           ; save user mode special
93
        pushsr  msp, tav, Q                             ; save user mode special
94
 
95
        sub     msp, msp, 29*4                          ; gr96-gr124
96
        mtsrim  cr, 29-1                                ;
97
        storem  0, 0, gr96, msp                         ;
98
 
99
 
100
        const   v0, WindowSize                          ; Window Size value
101
        consth  v0, WindowSize                          ; Window Size value
102
        load    0, 0, v0, v0                            ; load  Window size
103
        add     v2, msp, SIGCTX_RAB                     ; intr RAB value
104
 
105
        load    0, 0, v2, v2                            ; rab value
106
 
107
        sub     v1, rfb, v2                             ;
108
        cpgeu   v1, v1, v0                              ;
109
        jmpt    v1, nfill                               ; jmp if spill
110
        add     v1, gr1, 8                              ;
111
 
112
        cpgtu   v1, v1, rfb                             ; longjump test
113
        jmpt    v1, nfill                               ;
114
        nop                                             ;
115
 
116
ifill:
117
        add     v0, msp, SIGCTX_RAB+4                   ;
118
        push    v0, rab                                 ;
119
        const   v2, fill+4                              ;
120
        consth  v2, fill+4                              ;
121
 
122
        push    v0, v2                                  ; resave PC0
123
        sub     v2, v2, 4                               ;
124
        push    v0, v2                                  ; resave PC1
125
        const   v2, 0                                   ;
126
 
127
        sub     v0, v0, 3*4                             ;
128
        push    v0, v2                                  ;
129
 
130
nfill:
131
        cpgtu   v0, gr1, rfb                            ; if gr1>rfb -> gr1=rfb
132
        jmpt    v0, lower                               ;
133
        cpltu   v0, gr1, rab                            ;
134
        jmpt    v0, raise                               ; gr1
135
        nop                                             ;
136
 
137
sendsig:
138
        sub     gr1, gr1, RALLOC                        ;
139
        asgeu   V_SPILL, gr1, rab                       ;
140
        add     lr1, rfb, 0                             ;
141
        add     v1, msp, SIGCTX_SIG                     ;
142
 
143
cont:
144
        add     lr2,it3,0                               ; signal #
145
        call    lr0, _a29k_ISR_Handler                  ; call the handler
146
        nop
147
 
148
        nop                                             ; WASTE
149
        jmp     _a29k_sigdfl                            ; return code
150
        nop                                             ; WASTE
151
        nop                                             ; ALIGN
152
 
153
lower:
154
        jmp     sendsig                                 ;
155
        add     gr1, rfb, 0                             ;
156
raise:
157
        jmp     sendsig                                 ;
158
        add     gr1, rab, 0                             ;
159
 
160
 
161
        .global _a29k_sigdfl_sup
162
_a29k_sigdfl_sup:
163
        repair_R_stack                                  ;
164
        repair_regs                                     ;
165
        sig_return                                      ; return
166
        halt                                            ; never executes
167
 
168
 
169
        .global _sigret
170
_sigret:
171
;assume msp points to tav
172
        mfsr    it0,cps
173
        const   it1,FZ
174
        or      it1,it0,it1
175
        mtsr    cps,it1
176
        nop
177
        nop
178
_sigret1:
179
        pop     tav,msp
180
        popsr   ops,it0,msp
181
        popsr   alu,it0,msp
182
        popsr   chc,it0,msp
183
        popsr   chd,it0,msp
184
        popsr   cha,it0,msp
185
        popsr   pc2,it0,msp
186
        popsr   pc1,it0,msp
187
        popsr   pc0,it0,msp
188
        pop     rab,msp
189
        pop     it0,msp
190
        add     gr1,it0,0
191
        add     msp,msp,4       ;discount signal
192
        iret
193
 
194
_a29k_sigdfl:
195
        asneq   SIGDFL,gr1,gr1
196
        jmpi    lr0
197
        nop

powered by: WebSVN 2.1.0

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