forked from KolibriOS/kolibrios
Reorganization interrupts handlers part 2.
(I hope, I didn't something stupid.) Fixed bug in get_pid function. Added copyright in com mouse driver. Fixed incorrect comment inscription in boot\ru.inc . git-svn-id: svn://kolibrios.org@774 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -14,7 +14,7 @@ DRV_CURRENT equ 5 ;current drivers model version
|
||||
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
|
||||
|
||||
align 4
|
||||
proc attach_int_handler stdcall, irq:dword, handler:dword
|
||||
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
|
||||
|
||||
mov ebx, [irq] ;irq num
|
||||
test ebx, ebx
|
||||
@@ -25,13 +25,23 @@ proc attach_int_handler stdcall, irq:dword, handler:dword
|
||||
test eax, eax
|
||||
jz .err
|
||||
cmp [irq_owner + 4 * ebx], 0
|
||||
jne .err
|
||||
je @f
|
||||
|
||||
mov ecx, [irq_rights + 4 * ebx] ; Rights : 0 - full access, 1 - read only, 2 - forbidden
|
||||
test ecx, ecx
|
||||
jnz .err
|
||||
|
||||
@@:
|
||||
mov [irq_tab+ebx*4], eax
|
||||
|
||||
mov eax, [access_rights]
|
||||
mov [irq_rights + 4 * ebx], eax
|
||||
;push eax
|
||||
;mov eax, [TASK_BASE]
|
||||
;mov eax, [eax + TASKDATA.pid]
|
||||
mov [irq_owner + 4 * ebx], 1
|
||||
;mov eax, [eax + TASKDATA.pid] ; faster or smaller? :)
|
||||
call get_pid
|
||||
|
||||
mov [irq_owner + 4 * ebx], eax
|
||||
;pop eax
|
||||
|
||||
stdcall enable_irq, [irq]
|
||||
@@ -41,6 +51,28 @@ proc attach_int_handler stdcall, irq:dword, handler:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
uglobal
|
||||
|
||||
irq_rights rd 16
|
||||
|
||||
endg
|
||||
|
||||
proc get_int_handler stdcall, irq:dword
|
||||
|
||||
mov eax, [irq]
|
||||
|
||||
cmp [irq_rights + 4 * eax], dword 1
|
||||
ja .err
|
||||
|
||||
mov eax, [irq_tab + 4 * eax]
|
||||
ret
|
||||
|
||||
.err:
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc detach_int_handler
|
||||
|
||||
|
@@ -16,6 +16,7 @@ iglobal
|
||||
szGetService db 'GetService',0
|
||||
szServiceHandler db 'ServiceHandler',0
|
||||
szAttachIntHandler db 'AttachIntHandler',0
|
||||
szGetIntHandler db 'GetIntHandler', 0
|
||||
szFpuSave db 'FpuSave',0
|
||||
szFpuRestore db 'FpuRestore',0
|
||||
szReservePortArea db 'ReservePortArea',0
|
||||
@@ -88,6 +89,7 @@ kernel_export:
|
||||
dd szGetService , get_service
|
||||
dd szServiceHandler , srv_handler
|
||||
dd szAttachIntHandler, attach_int_handler
|
||||
dd szGetIntHandler , get_int_handler
|
||||
dd szFpuSave , fpu_save
|
||||
dd szFpuRestore , fpu_restore
|
||||
dd szReservePortArea , r_f_port_area
|
||||
|
@@ -668,13 +668,18 @@ term9:
|
||||
shl eax, 5
|
||||
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
|
||||
mov edi,irq_owner
|
||||
mov ecx,16
|
||||
xor ebx, ebx
|
||||
xor edx, edx
|
||||
newirqfree:
|
||||
scasd
|
||||
cmp [edi + 4 * ebx], eax
|
||||
jne nofreeirq
|
||||
mov [edi-4],dword 0
|
||||
mov [edi + 4 * ebx], edx ; remove irq reservation
|
||||
mov [irq_tab + 4 * ebx], edx ; remove irq handler
|
||||
mov [irq_rights + 4 * ebx], edx ; set access rights to full access
|
||||
nofreeirq:
|
||||
loop newirqfree
|
||||
inc ebx
|
||||
cmp ebx, 16
|
||||
jb newirqfree
|
||||
popa
|
||||
|
||||
pusha ; remove all port reservations
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user