Subversion Repositories Kolibri OS

Rev

Rev 7733 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7733 Rev 9715
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 7733 $
8
$Revision: 9715 $
Line 9... Line 9...
9
 
9
 
Line 18... Line 18...
18
irqh_tab            rd sizeof.LHEAD * IRQ_RESERVED / 4
18
irqh_tab            rd sizeof.LHEAD * IRQ_RESERVED / 4
Line 19... Line 19...
19
 
19
 
20
irqh_pool           rd sizeof.IRQH * IRQ_POOL_SIZE /4
20
irqh_pool           rd sizeof.IRQH * IRQ_POOL_SIZE /4
Line 21... Line 21...
21
next_irqh           rd 1
21
next_irqh           rd 1
22
 
22
 
Line 23... Line 23...
23
irq_active_set      rd (IRQ_RESERVED+31)/32
23
irq_active_set      rd (IRQ_RESERVED + 31)/32
Line 24... Line 24...
24
irq_failed          rd IRQ_RESERVED
24
irq_failed          rd IRQ_RESERVED
25
 
25
 
26
endg
26
endg
27
 
27
 
28
set_irq_active:
28
set_irq_active:
29
        mov     eax, ebp
29
        mov     eax, ebp
30
        mov     ecx, ebp
30
        mov     ecx, ebp
Line 31... Line 31...
31
        shr     ecx, 5
31
        shr     ecx, 5
32
        and     eax, 31
32
        and     eax, 31
33
        bts     [irq_active_set+ecx*4], eax
33
        bts     [irq_active_set + ecx*4], eax
34
        ret
34
        ret
35
 
35
 
36
reset_irq_active:
36
reset_irq_active:
37
        mov     eax, ebp
37
        mov     eax, ebp
Line 38... Line 38...
38
        mov     ecx, ebp
38
        mov     ecx, ebp
39
        shr     ecx, 5
39
        shr     ecx, 5
Line 51... Line 51...
51
        stosd
51
        stosd
52
        stosd
52
        stosd
53
        loop    @B
53
        loop    @B
Line 54... Line 54...
54
 
54
 
55
        mov     ecx, IRQ_POOL_SIZE-1
55
        mov     ecx, IRQ_POOL_SIZE-1
56
        mov     eax, irqh_pool+sizeof.IRQH
56
        mov     eax, irqh_pool + sizeof.IRQH
57
        mov     [next_irqh], irqh_pool
57
        mov     [next_irqh], irqh_pool
58
@@:
58
@@:
59
        mov     [eax-sizeof.IRQH], eax
59
        mov     [eax - sizeof.IRQH], eax
60
        add     eax, sizeof.IRQH
60
        add     eax, sizeof.IRQH
Line 61... Line 61...
61
        loop    @B
61
        loop    @B
62
 
62
 
Line 63... Line 63...
63
        mov     [eax-sizeof.IRQH], dword 0
63
        mov     [eax - sizeof.IRQH], dword 0
64
        ret
64
        ret
Line 97... Line 97...
97
 
97
 
98
        mov     eax, [ecx]
98
        mov     eax, [ecx]
99
        mov     [next_irqh], eax
99
        mov     [next_irqh], eax
Line 100... Line 100...
100
        mov     [.irqh], ecx
100
        mov     [.irqh], ecx
Line 101... Line 101...
101
 
101
 
102
        mov     [irq_failed+ebx*4], 0;clear counter
102
        mov     [irq_failed + ebx*4], 0;clear counter
103
 
103
 
104
        mov     eax, [user_data]
104
        mov     eax, [user_data]
Line 105... Line 105...
105
        mov     [ecx+IRQH.handler], edx
105
        mov     [ecx + IRQH.handler], edx
106
        mov     [ecx+IRQH.data], eax
106
        mov     [ecx + IRQH.data], eax
107
        and     [ecx+IRQH.num_ints], 0
107
        and     [ecx + IRQH.num_ints], 0
Line 108... Line 108...
108
 
108
 
109
        lea     edx, [irqh_tab+ebx*8]
109
        lea     edx, [irqh_tab + ebx*8]
Line 165... Line 165...
165
        mov     ebp, [esp + 32]
165
        mov     ebp, [esp + 32]
166
        mov     bx, app_data;os_data
166
        mov     bx, app_data;os_data
167
        mov     ds, bx
167
        mov     ds, bx
168
        mov     es, bx
168
        mov     es, bx
Line 169... Line 169...
169
 
169
 
170
        cmp     [v86_irqhooks+ebp*8], 0
170
        cmp     [v86_irqhooks + ebp*8], 0
Line 171... Line 171...
171
        jnz     v86_irq
171
        jnz     v86_irq
Line 172... Line 172...
172
 
172
 
173
        call    set_irq_active
173
        call    set_irq_active
174
 
174
 
175
        lea     esi, [irqh_tab+ebp*8]   ; esi= list head
175
        lea     esi, [irqh_tab + ebp*8]   ; esi= list head
176
        mov     ebx, esi
176
        mov     ebx, esi
177
.next:
177
.next:
Line 178... Line 178...
178
        mov     ebx, [ebx+IRQH.list.next]; ebx= irqh pointer
178
        mov     ebx, [ebx + IRQH.list.next]; ebx= irqh pointer
179
        cmp     ebx, esi
179
        cmp     ebx, esi
180
        je      .done
180
        je      .done
Line 181... Line 181...
181
 
181
 
182
        push    ebx                     ; FIX THIS
182
        push    ebx                     ; FIX THIS
183
        push    edi
183
        push    edi
Line 184... Line 184...
184
        push    esi
184
        push    esi
185
 
185
 
186
        push    [ebx+IRQH.data]
186
        push    [ebx + IRQH.data]
Line 187... Line 187...
187
        call    [ebx+IRQH.handler]
187
        call    [ebx + IRQH.handler]
188
        pop     ecx
188
        pop     ecx
Line 189... Line 189...
189
 
189
 
190
        pop     esi
190
        pop     esi
191
        pop     edi
191
        pop     edi
Line 192... Line 192...
192
        pop     ebx
192
        pop     ebx
193
 
193
 
Line 229... Line 229...
229
        jz      .try_next_irq
229
        jz      .try_next_irq
230
        cmp     ebp, 14
230
        cmp     ebp, 14
231
        jz      .try_next_irq
231
        jz      .try_next_irq
232
        cmp     ebp, 15
232
        cmp     ebp, 15
233
        jz      .try_next_irq
233
        jz      .try_next_irq
234
        lea     esi, [irqh_tab+ebp*8]
234
        lea     esi, [irqh_tab + ebp*8]
235
        mov     ebx, esi
235
        mov     ebx, esi
236
.try_next_handler:
236
.try_next_handler:
237
        mov     ebx, [ebx+IRQH.list.next]
237
        mov     ebx, [ebx + IRQH.list.next]
238
        cmp     ebx, esi
238
        cmp     ebx, esi
239
        je      .try_next_irq
239
        je      .try_next_irq
240
        cmp     [ebx+IRQH.num_ints], 0
240
        cmp     [ebx + IRQH.num_ints], 0
241
        jne     .try_next_handler
241
        jne     .try_next_handler
242
; keyboard handler acknowledges everything
242
; keyboard handler acknowledges everything
243
        push    [ebx+IRQH.data]
243
        push    [ebx + IRQH.data]
244
        call    [ebx+IRQH.handler]
244
        call    [ebx + IRQH.handler]
245
        pop     ecx
245
        pop     ecx
246
        test    eax, eax
246
        test    eax, eax
247
        jz      .try_next_handler
247
        jz      .try_next_handler
Line 248... Line 248...
248
 
248
 
249
.found_in_wrong_list:
249
.found_in_wrong_list:
250
        DEBUGF 1,'K : warning: relinking handler from IRQ%d to IRQ%d\n',\
250
        DEBUGF 1,'K : warning: relinking handler from IRQ%d to IRQ%d\n',\
251
                ebp, [esp]
251
                ebp, [esp]
252
        pop     ebp
252
        pop     ebp
253
        spin_lock_irqsave IrqsList
253
        spin_lock_irqsave IrqsList
254
        list_del ebx
254
        list_del ebx
255
        lea     edx, [irqh_tab+ebp*8]
255
        lea     edx, [irqh_tab + ebp*8]
256
        list_add_tail ebx, edx
256
        list_add_tail ebx, edx
257
        spin_unlock_irqrestore IrqsList
257
        spin_unlock_irqrestore IrqsList
Line 258... Line 258...
258
        jmp     .exit
258
        jmp     .exit
Line 262... Line 262...
262
        cmp     ebp, 16
262
        cmp     ebp, 16
263
        jb      .try_other_irqs
263
        jb      .try_other_irqs
264
        pop     ebp
264
        pop     ebp
Line 265... Line 265...
265
 
265
 
266
.fail:
266
.fail:
267
        inc     [irq_failed+ebp*4]
267
        inc     [irq_failed + ebp*4]
Line 268... Line 268...
268
.exit:
268
.exit:
269
 
269