diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 731bea00ff..4fda41ed53 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -771,3 +771,27 @@ end virtual virtual at 0 CSYM COFF_SYM end virtual + +struc LHEAD +{ + .next dd ? ;next object in list + .prev dd ? ;prev object in list + .sizeof: +} + +virtual at 0 + LHEAD LHEAD +end virtual + +struc IRQH +{ + .list LHEAD + .handler dd ? ;handler roututine + .data dd ? ;user-specific data + .sizeof: +} + +virtual at 0 + IRQH IRQH +end virtual + diff --git a/kernel/trunk/core/dll.inc b/kernel/trunk/core/dll.inc index 41524809b7..6d65b40d70 100644 --- a/kernel/trunk/core/dll.inc +++ b/kernel/trunk/core/dll.inc @@ -44,12 +44,17 @@ proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword ret endp +align 4 proc get_int_handler stdcall, irq:dword - mov eax, [irq] - - mov eax, [irq_tab + 4 * eax] - ret + mov eax, [irq] + cmp eax, 15 + ja .fail + mov eax, [irq_tab + 4 * eax] + ret +.fail: + xor eax, eax + ret endp align 4 diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 24e562d29d..5f5cc3e176 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -40,11 +40,11 @@ iglobal ;interrupt handlers addresses (for interrupt gate construction) dd irq0, irq_serv.irq_1, irq_serv.irq_2 - if USE_COM_IRQ +; if USE_COM_IRQ dd irq_serv.irq_3, irq_serv.irq_4 - else - dd p_irq3, p_irq4 ;??? нестыковка - end if +; else +; dd p_irq3, p_irq4 ;??? нестыковка +; end if dd irq_serv.irq_5, irq_serv.irq_6, irq_serv.irq_7 dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10 dd irq_serv.irq_11, irq_serv.irq_12, irqD, irq_serv.irq_14, irq_serv.irq_15 @@ -190,6 +190,7 @@ unknown_interrupt: iretd ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +; bl - error vector show_error_parameters: cmp bl, 0x06 jnz .no_ud @@ -236,36 +237,11 @@ show_error_parameters: restore reg_esi restore reg_edi -; irq1 -> hid/keyboard.inc -macro irqh [num] { - p_irq#num : - mov edi, num - jmp irqhandler -} - - - -ready_for_next_irq: - mov eax,5 - mov [check_idle_semaphore],eax -; mov al, 0x20 - add eax,(0x20-0x5) - - out 0x20, al - ret -;destroy eax -ready_for_next_irq_1: - mov eax,5 - mov [check_idle_semaphore],eax -; mov al, 0x20 - add eax,(0x20-0x5) - out 0xa0,al - out 0x20, al - ret +align 4 irqD: push eax - xor eax,eax + xor eax,eax out 0xf0,al mov al,0x20 out 0xa0,al @@ -274,75 +250,7 @@ irqD: iret -irqh 2,3,4,5,6,7,8,9,10,11 - -irqhandler: - - mov esi,edi ; 1 - shl esi,6 ; 1 - add esi,irq00read ; 1 - shl edi,12 ; 1 - add edi,IRQ_SAVE - mov ecx,16 - - irqnewread: - dec ecx - js irqover - - movzx edx, word [esi] ; 2+ - - test edx, edx ; 1 - jz irqover - - - mov ebx, [edi] ; address of begin of buffer in edi ; + 0x0 dword - data size - mov eax, 4000 ; + 0x4 dword - data begin offset - cmp ebx, eax - je irqfull - add ebx, [edi + 0x4] ; add data size to data begin offset - cmp ebx, eax ; if end of buffer, begin cycle again - jb @f - - xor ebx, ebx - - @@: - add ebx, edi - movzx eax, byte[esi + 3] ; get type of data being received 1 - byte, 2 - word - dec eax - jz irqbyte - dec eax - jnz noirqword - - in ax,dx - cmp ebx, 3999 ; check for address odd in the end of buffer - jne .odd - mov [ebx + 0x10], ax - jmp .add_size - .odd: - mov [ebx + 0x10], al ; I could make mistake here :) - mov [edi + 0x10], ah - .add_size: - add dword [edi], 2 - jmp nextport - - - irqbyte: - in al,dx - mov [ebx + 0x10],al - inc dword [edi] - nextport: - add esi,4 - jmp irqnewread - - - noirqword: - irqfull: - irqover: - - ret - - - +align 4 set_application_table_status: push eax @@ -357,7 +265,7 @@ set_application_table_status: ret - +align 4 clear_application_table_status: push eax @@ -383,6 +291,7 @@ clear_application_table_status: ; * eax = 0 - успешно ; * eax = 1 - недостаточно памяти +align 4 sys_resize_app_memory: ; ebx = 1 - resize ; ecx = new amount of memory @@ -404,6 +313,7 @@ endg ; param ; esi= slot +align 4 terminate: ; terminate application .slot equ esp ;locals diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index ffacd2e53b..4b7a56fde9 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -268,24 +268,6 @@ cur_saved_data rb 4096 fpu_data: rb 512 ; on irq read ports - -irq00read rd 16 -irq01read rd 16 -irq02read rd 16 -irq03read rd 16 -irq04read rd 16 -irq05read rd 16 -irq06read rd 16 -irq07read rd 16 -irq08read rd 16 -irq09read rd 16 -irq10read rd 16 -irq11read rd 16 -irq12read rd 16 -irq13read rd 16 -irq14read rd 16 -irq15read rd 16 - irq_tab rd 16 mem_block_map rb 512