move PIC functions into separate file

git-svn-id: svn://kolibrios.org@2118 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2011-08-25 09:32:01 +00:00
parent ff11e6b374
commit 0c8c27e46c
10 changed files with 116 additions and 103 deletions

View File

@ -0,0 +1,90 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 4
pic_delay:
jmp pdl1
pdl1: ret
align 4
rerouteirqs:
cli
mov al,0x11 ; icw4, edge triggered
out 0x20,al
call pic_delay
out 0xA0,al
call pic_delay
mov al,0x20 ; generate 0x20 +
out 0x21,al
call pic_delay
mov al,0x28 ; generate 0x28 +
out 0xA1,al
call pic_delay
mov al,0x04 ; slave at irq2
out 0x21,al
call pic_delay
mov al,0x02 ; at irq9
out 0xA1,al
call pic_delay
mov al,0x01 ; 8086 mode
out 0x21,al
call pic_delay
out 0xA1,al
call pic_delay
mov al,255 ; mask all irq's
out 0xA1,al
call pic_delay
out 0x21,al
call pic_delay
mov ecx,0x1000
cld
picl1: call pic_delay
loop picl1
mov al,255 ; mask all irq's
out 0xA1,al
call pic_delay
out 0x21,al
call pic_delay
ret
align 4
;proc enable_irq stdcall, irq_line:dword
enable_irq: ; FIXME make fastcall
mov ebx, [esp+4] ;irq_line
mov edx, 0x21
cmp ebx, 8
jb @F
mov edx, 0xA1
sub ebx,8
@@:
in al,dx
btr eax, ebx
out dx, al
ret 4
align 4
;proc irq_eoi fastcall, irq_line:dword
irq_eoi:
cmp cl, 8
mov al, 0x20
jb @f
out 0xa0, al
@@:
out 0x20, al
ret

View File

@ -143,21 +143,6 @@ proc detach_int_handler
ret
endp
align 4
proc enable_irq stdcall, irq_line:dword
mov ebx, [irq_line]
mov edx, 0x21
cmp ebx, 8
jb @F
mov edx, 0xA1
sub ebx,8
@@:
in al,dx
btr eax, ebx
out dx, al
ret
endp
macro irq_serv_h [num] {
forward
@ -246,15 +231,22 @@ align 16
.exit:
mov [check_idle_semaphore],5
cmp bp, 8
mov al, 0x20
jb @f
out 0xa0, al
@@:
out 0x20, al
mov ecx, ebp
call irq_eoi
restore_ring3_context
add esp, 4
iret
align 4
irqD:
push eax
push ecx
xor eax,eax
out 0xf0,al
mov cl, 13
call irq_eoi
pop ecx
pop eax
iret

View File

@ -27,8 +27,8 @@ irq0:
add [next_usage_update],100
call updatecputimes
.nocounter:
mov al,0x20 ; send End Of Interrupt signal
out 0x20,al
xor ecx, ecx
call irq_eoi
btr dword[DONT_SWITCH], 0
jc .return
call find_next_task

View File

@ -120,7 +120,7 @@ exc_c: ;
reg_esi equ esp+0x04
reg_edi equ esp+0x00
Mov ds,ax,app_data ; çàãðóçèì ïðàâèëüíûå çíà÷åíèÿ
Mov ds,ax,app_data ; загрузим правильные значени
mov es,ax ; â ñåãìåíòíûå ðåãèñòðû
cld ; è ïðèâîäèì DF ê ñòàíäàðòó
movzx ebx,bl
@ -237,18 +237,6 @@ show_error_parameters:
restore reg_edi
align 4
irqD:
push eax
xor eax,eax
out 0xf0,al
mov al,0x20
out 0xa0,al
out 0x20,al
pop eax
iret
align 4
set_application_table_status:
push eax

View File

@ -839,6 +839,7 @@ end if
; mov byte [BOOT_VAR + 48Eh], 0FFh
; ret
align 4
v86_irq:
; push irq/pushad/jmp v86_irq
; eax = irq
@ -898,12 +899,8 @@ v86_irq2:
pop ecx
.cont:
loop .scan
mov al, 20h
out 20h, al
cmp edi, 8
jb @f
out 0A0h, al
@@:
mov ecx, edi
call irq_eoi
popad
iretd
.found:

View File

@ -332,7 +332,7 @@ irq_handler:
mov [esi+COM_MOUSE_DATA.MouseByteNumber],0
.EndMouseInterrupt:
mov al, 1
ret
;all initialized data place here

View File

@ -239,7 +239,8 @@ else if sb_buffer_size eq full_buffer
stdcall [callback],SB16Buffer0 ;for 64k buffer
stdcall [callback],SB16Buffer1 ;for 64k buffer
end if
xor eax,eax
xor eax, eax
not eax
ret
.fill_second_half:
@ -249,7 +250,8 @@ else if sb_buffer_size eq full_buffer
stdcall [callback],SB16Buffer2 ;for 64k buffer
stdcall [callback],SB16Buffer3 ;for 64k buffer
end if
xor eax,eax
xor eax, eax
not eax
ret
endp
;-------------------------------------------------------------------------------

View File

@ -4119,62 +4119,6 @@ _rdtsc:
ret
end if
rerouteirqs:
cli
mov al,0x11 ; icw4, edge triggered
out 0x20,al
call pic_delay
out 0xA0,al
call pic_delay
mov al,0x20 ; generate 0x20 +
out 0x21,al
call pic_delay
mov al,0x28 ; generate 0x28 +
out 0xA1,al
call pic_delay
mov al,0x04 ; slave at irq2
out 0x21,al
call pic_delay
mov al,0x02 ; at irq9
out 0xA1,al
call pic_delay
mov al,0x01 ; 8086 mode
out 0x21,al
call pic_delay
out 0xA1,al
call pic_delay
mov al,255 ; mask all irq's
out 0xA1,al
call pic_delay
out 0x21,al
call pic_delay
mov ecx,0x1000
cld
picl1: call pic_delay
loop picl1
mov al,255 ; mask all irq's
out 0xA1,al
call pic_delay
out 0x21,al
call pic_delay
cli
ret
pic_delay:
jmp pdl1
pdl1: ret
sys_msg_board_str:

View File

@ -221,7 +221,7 @@ include "core/peload.inc" ;
include "core/exports.inc"
include "core/string.inc"
include "core/v86.inc" ; virtual-8086 manager
;include "core/apic.inc" ; Interrupt Controller functions
include "core/apic.inc" ; Interrupt Controller functions
include "core/irq.inc" ; irq handling functions
; GUI stuff