From 0e57fd19088ebdb195ad99faf304a5196b09ec5b Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Sat, 11 Mar 2006 18:10:47 +0000 Subject: [PATCH] Fixed bug - COM modem completely does not work. git-svn-id: svn://kolibrios.org@58 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sys32.inc | 28 ++++++++++++++----- kernel/trunk/detect/commouse.inc | 28 +++++++++++++++++++ kernel/trunk/hid/m_com1.inc | 4 +-- kernel/trunk/hid/m_com2.inc | 4 +-- kernel/trunk/kernel.asm | 48 ++++++++++++++++---------------- 5 files changed, 77 insertions(+), 35 deletions(-) diff --git a/kernel/trunk/core/sys32.inc b/kernel/trunk/core/sys32.inc index 9622a82746..44244c6877 100644 --- a/kernel/trunk/core/sys32.inc +++ b/kernel/trunk/core/sys32.inc @@ -166,13 +166,13 @@ endg macro save_ring3_context { - push ds es - pushad + push ds es + pushad } macro restore_ring3_context { - popad - pop es ds + popad + pop es ds } ; simply return control to interrupted process @@ -231,16 +231,16 @@ exc_c: movzx ecx, bl push ecx mov ecx, [0x3010] - push dword [ecx+4] ; PID of current process + push dword [ecx+4] ; PID of current process push 12 pop ecx - push 1 ; 1=exception + push 1 ; 1=exception call debugger_notify pop ecx pop ecx pop ecx mov edx, [0x3010] - mov byte [edx+0xA], 1 ; suspended + mov byte [edx+0xA], 1 ; suspended call change_task restore_ring3_context iretd @@ -386,7 +386,14 @@ p_irq3: mov ax, os_data mov ds, ax mov es, ax + cmp [com2_mouse_detected],0 + je old_irq3_handler call check_mouse_data_com2 + jmp p_irq3_1 + old_irq3_handler: + mov edi,3 + call irqhandler + p_irq3_1: restore_ring3_context iret @@ -395,7 +402,14 @@ p_irq4: mov ax, os_data mov ds, ax mov es, ax + cmp [com1_mouse_detected],0 + je old_irq4_handler call check_mouse_data_com1 + jmp p_irq4_1 + old_irq4_handler: + mov edi,4 + call irqhandler + p_irq4_1: restore_ring3_context iret diff --git a/kernel/trunk/detect/commouse.inc b/kernel/trunk/detect/commouse.inc index 1275d4e453..77967e06cf 100644 --- a/kernel/trunk/detect/commouse.inc +++ b/kernel/trunk/detect/commouse.inc @@ -13,6 +13,20 @@ Detect_COM_Mouse: cmp AL,'M' jne @f mov [com1_mouse_detected],1 + pusha + + mov eax,4 + shl eax,2 + mov [irq_owner+eax],byte 1 + + inc dword [0x2d0000] + mov edi,[0x2d0000] + shl edi,4 + mov [0x2d0000+edi+0],dword 1 + mov [0x2d0000+edi+4],dword 0x3f0 + mov [0x2d0000+edi+8],dword 0x3ff + + popa mov esi,boot_setmouse_type+22 call boot_log @@: @@ -21,6 +35,20 @@ Detect_COM_Mouse: cmp AL,'M' jne @f mov [com2_mouse_detected],1 + pusha + + mov eax,3 + shl eax,2 + mov [irq_owner+eax],byte 1 + + inc dword [0x2d0000] + mov edi,[0x2d0000] + shl edi,4 + mov [0x2d0000+edi+0],dword 1 + mov [0x2d0000+edi+4],dword 0x2f0 + mov [0x2d0000+edi+8],dword 0x2ff + + popa mov esi,boot_setmouse_type+44 call boot_log @@: diff --git a/kernel/trunk/hid/m_com1.inc b/kernel/trunk/hid/m_com1.inc index 9978b73cb0..7763f169a4 100644 --- a/kernel/trunk/hid/m_com1.inc +++ b/kernel/trunk/hid/m_com1.inc @@ -9,8 +9,8 @@ ThirdByte DB 0 ;* ÍÎÂÛÉ ÎÁÐÀÁÎÒ×ÈÊ ÏÐÅÐÛÂÀÍÈß ÎÒ ÌÛØÈ * ;*************************************** check_mouse_data_com1: - cmp [com1_mouse_detected],0 - je @@EndMouseInterrupt +; cmp [com1_mouse_detected],0 +; je @@EndMouseInterrupt ; Ïðîâåðèòü íàëè÷èå äàííûõ mov DX,3F8h ;[COMPortBaseAddr] add DX,5 ;xFDh diff --git a/kernel/trunk/hid/m_com2.inc b/kernel/trunk/hid/m_com2.inc index ddb327807a..8b067bc075 100644 --- a/kernel/trunk/hid/m_com2.inc +++ b/kernel/trunk/hid/m_com2.inc @@ -9,8 +9,8 @@ ThirdByte_1 DB 0 ;* ÍÎÂÛÉ ÎÁÐÀÁÎÒ×ÈÊ ÏÐÅÐÛÂÀÍÈß ÎÒ ÌÛØÈ * ;*************************************** check_mouse_data_com2: - cmp [com2_mouse_detected],0 - je @@EndMouseInterrupt_1 +; cmp [com2_mouse_detected],0 +; je @@EndMouseInterrupt_1 ; Ïðîâåðèòü íàëè÷èå äàííûõ mov DX,2F8h ;[COMPortBaseAddr] add DX,5 ;xFDh diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index e11937dc21..b1162eaf3f 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -969,12 +969,12 @@ reserve_irqs_ports: mov [irq_owner+4*13],byte 1 ; math co-pros mov [irq_owner+4*14],byte 1 ; ide I mov [irq_owner+4*15],byte 1 ; ide II - movzx eax,byte [0xf604] ; mouse irq - dec eax - add eax,mouseirqtable - movzx eax,byte [eax] - shl eax,2 - mov [irq_owner+eax],byte 1 +; movzx eax,byte [0xf604] ; mouse irq +; dec eax +; add eax,mouseirqtable +; movzx eax,byte [eax] +; shl eax,2 +; mov [irq_owner+eax],byte 1 ; RESERVE PORTS @@ -984,24 +984,24 @@ reserve_irqs_ports: mov [0x2d0000+edi+0],dword 1 mov [0x2d0000+edi+4],dword 0x0 mov [0x2d0000+edi+8],dword 0xff - cmp [0xf604],byte 2 ; com1 mouse -> 0x3f0-0x3ff - jne ripl1 - inc dword [0x2d0000] - mov edi,[0x2d0000] - shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0x3f0 - mov [0x2d0000+edi+8],dword 0x3ff - ripl1: - cmp [0xf604],byte 3 ; com2 mouse -> 0x2f0-0x2ff - jne ripl2 - inc dword [0x2d0000] - mov edi,[0x2d0000] - shl edi,4 - mov [0x2d0000+edi+0],dword 1 - mov [0x2d0000+edi+4],dword 0x2f0 - mov [0x2d0000+edi+8],dword 0x2ff - ripl2: +; cmp [0xf604],byte 2 ; com1 mouse -> 0x3f0-0x3ff +; jne ripl1 +; inc dword [0x2d0000] +; mov edi,[0x2d0000] +; shl edi,4 +; mov [0x2d0000+edi+0],dword 1 +; mov [0x2d0000+edi+4],dword 0x3f0 +; mov [0x2d0000+edi+8],dword 0x3ff +; ripl1: +; cmp [0xf604],byte 3 ; com2 mouse -> 0x2f0-0x2ff +; jne ripl2 +; inc dword [0x2d0000] +; mov edi,[0x2d0000] +; shl edi,4 +; mov [0x2d0000+edi+0],dword 1 +; mov [0x2d0000+edi+4],dword 0x2f0 +; mov [0x2d0000+edi+8],dword 0x2ff +; ripl2: popad ret