Subversion Repositories Kolibri OS

Rev

Rev 2106 | Rev 2138 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2106 Rev 2130
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2011. 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 -... Line 7...
-
 
7
 
-
 
8
 
-
 
9
IRQ_POOL_SIZE  equ 48
-
 
10
 
7
 
11
 
8
macro __list_add new, prev, next
12
macro __list_add new, prev, next
9
{
13
{
10
    mov [next+LHEAD.prev], new
14
    mov [next+LHEAD.prev], new
11
    mov [new+LHEAD.next], next
15
    mov [new+LHEAD.next], next
Line 26... Line 30...
26
}
30
}
Line 27... Line 31...
27
 
31
 
Line 28... Line 32...
28
uglobal
32
uglobal
29
 
33
 
Line 30... Line 34...
30
align 16
34
align 16
31
irqh_tab            rd LHEAD.sizeof * IRQ_RESERVE / 4
35
irqh_tab            rd LHEAD.sizeof * IRQ_RESERVED / 4
Line 32... Line 36...
32
 
36
 
33
irqh_pool           rd IRQH.sizeof *48 /4
37
irqh_pool           rd IRQH.sizeof * IRQ_POOL_SIZE /4
Line 34... Line 38...
34
next_irqh           rd 1
38
next_irqh           rd 1
Line 35... Line 39...
35
 
39
 
36
irq_active_set      rd 1
40
irq_active_set      rd 1
37
irq_failed          rd IRQ_RESERVE
41
irq_failed          rd IRQ_RESERVED
38
 
42
 
39
endg
43
endg
Line 40... Line -...
40
 
-
 
41
align 4
-
 
42
proc attach_int_handler stdcall, irq:dword, handler:dword, user_data:dword
44
 
Line 43... Line 45...
43
         locals
45
align 4
Line 44... Line 46...
44
           .irqh dd ?
46
proc attach_int_handler stdcall, irq:dword, handler:dword, user_data:dword
45
         endl
47
         locals
46
 
48
           .irqh dd ?
Line 47... Line 49...
47
         xchg bx, bx
49
         endl
48
 
50
 
Line 49... Line 51...
49
         and [.irqh], 0
51
         and [.irqh], 0
50
 
52
 
51
         push ebx
53
         push ebx
Line 70... Line 72...
70
         test ecx, ecx
72
         test ecx, ecx
71
         jz .fail
73
         jz .fail
Line 72... Line 74...
72
 
74
 
73
         mov eax, [ecx]
75
         mov eax, [ecx]
74
         mov [next_irqh], eax
-
 
75
 
76
         mov [next_irqh], eax
Line -... Line 77...
-
 
77
         mov [.irqh], ecx
-
 
78
 
76
         mov [.irqh], ecx
79
         mov [irq_failed+ebx*4], 0  ;clear counter
77
 
80
 
78
         mov eax, [user_data]
81
         mov eax, [user_data]
Line 79... Line 82...
79
         mov [ecx+IRQH.handler], edx
82
         mov [ecx+IRQH.handler], edx
80
         mov [ecx+IRQH.data],    eax
83
         mov [ecx+IRQH.data],    eax
81
 
-
 
82
         lea edx, [irqh_tab+ebx*8]
84
 
Line 83... Line 85...
83
         list_add_tail ecx, edx     ;clobber eax
85
         lea edx, [irqh_tab+ebx*8]
84
 
86
         list_add_tail ecx, edx     ;clobber eax
85
         stdcall enable_irq, [irq]
87
         stdcall enable_irq, ebx
86
 
88
 
Line 114... Line 116...
114
 
116
 
115
       ret
117
       ret
Line 116... Line -...
116
endp
-
 
117
 
118
endp
118
 
119
 
119
 
120
 
120
macro irq_serv_h [num] {
121
macro irq_serv_h [num] {
121
    forward
122
    forward
Line 140... Line 141...
140
 
141
 
141
align 16
142
align 16
142
.main:
143
.main:
Line 143... Line -...
143
       save_ring3_context
-
 
144
 
-
 
145
       xchg bx, bx
144
       save_ring3_context
146
 
145
 
147
       mov   ebp, [esp + 32]
146
       mov   ebp, [esp + 32]
148
       mov   bx, app_data  ;os_data
147
       mov   bx, app_data  ;os_data
Line 210... Line 209...
210
       call    IRQ_EOI
209
       call    IRQ_EOI
211
       restore_ring3_context
210
       restore_ring3_context
212
       add   esp, 4
211
       add   esp, 4
213
       iret
212
       iret
Line -... Line 213...
-
 
213
 
-
 
214
align 4
-
 
215
irqD:
-
 
216
        push  eax
-
 
217
        push  ecx
-
 
218
        xor   eax,eax
-
 
219
        out   0xf0,al
-
 
220
        mov   eax, 13
-
 
221
        call  IRQ_EOI
-
 
222
        pop   ecx
-
 
223
        pop   eax