remove fn 41,42,44,45

git-svn-id: svn://kolibrios.org@2089 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2011-08-21 12:26:22 +00:00
parent f0bb935cd0
commit b3a861cedd
9 changed files with 85 additions and 323 deletions

View File

@ -9,7 +9,7 @@ $Revision$
DRV_COMPAT equ 5 ;minimal required drivers version DRV_COMPAT equ 5 ;minimal required drivers version
DRV_CURRENT equ 5 ;current drivers model version DRV_CURRENT equ 6 ;current drivers model version
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
PID_KERNEL equ 1 ;os_idle thread PID_KERNEL equ 1 ;os_idle thread
@ -17,6 +17,9 @@ PID_KERNEL equ 1 ;os_idle thread
align 4 align 4
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
pushfd
cli
push ebx push ebx
mov ebx, [irq] ;irq num mov ebx, [irq] ;irq num
@ -27,51 +30,26 @@ proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
mov eax, [handler] mov eax, [handler]
test eax, eax test eax, eax
jz .err jz .err
cmp [irq_owner + 4 * ebx], 0
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 [irq_tab+ebx*4], eax
mov eax, [access_rights]
mov [irq_rights + 4 * ebx], eax
mov [irq_owner + 4 * ebx], PID_KERNEL ; all handlers belong to a kernel
stdcall enable_irq, [irq] stdcall enable_irq, [irq]
pop ebx pop ebx
mov eax, 1 mov eax, 1
popfd
ret ret
.err: .err:
pop ebx pop ebx
xor eax, eax xor eax, eax
popfd
ret ret
endp endp
uglobal
irq_rights rd 16
endg
proc get_int_handler stdcall, irq:dword proc get_int_handler stdcall, irq:dword
mov eax, [irq] mov eax, [irq]
cmp [irq_rights + 4 * eax], dword 1
ja .err
mov eax, [irq_tab + 4 * eax] mov eax, [irq_tab + 4 * eax]
ret ret
.err:
xor eax, eax
ret
endp endp
align 4 align 4
@ -200,10 +178,10 @@ align 16
.exit: .exit:
cmp dword [esp + 32], 8 cmp dword [esp + 32], 8
mov al, 0x20 mov al, 0x20
jb @f jb @f
out 0xa0, al out 0xa0, al
@@: @@:
out 0x20, al out 0x20, al

View File

@ -675,25 +675,6 @@ term9:
and [bgrlock], 0 and [bgrlock], 0
@@: @@:
pusha ; remove all irq reservations
mov eax,esi
shl eax, 5
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
mov edi,irq_owner
xor ebx, ebx
xor edx, edx
newirqfree:
cmp [edi + 4 * ebx], eax
jne nofreeirq
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:
inc ebx
cmp ebx, 16
jb newirqfree
popa
pusha ; remove all port reservations pusha ; remove all port reservations
mov edx,esi mov edx,esi
shl edx, 5 shl edx, 5

View File

@ -161,11 +161,11 @@ iglobal
dd syscall_drawline ; 38-DrawLine dd syscall_drawline ; 38-DrawLine
dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,. dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,.
dd set_app_param ; 40-WantEvents dd set_app_param ; 40-WantEvents
dd syscall_getirqowner ; 41-GetIrqOwner dd undefined_syscall ; 41- deprecated GetIrqOwner
dd get_irq_data ; 42-ReadIrqData dd undefined_syscall ; 42- deprecated ReadIrqData
dd sys_outport ; 43-SendDeviceData dd sys_outport ; 43-SendDeviceData
dd sys_programirq ; 44-ProgramIrqs dd undefined_syscall ; 44- deprecated ProgramIrqs
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq dd undefined_syscall ; 45- deprecated ReserveIrq and FreeIrq
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
dd display_number ; 47-WriteNum dd display_number ; 47-WriteNum
dd syscall_display_settings ; 48-SetRedrawType and SetButtonType dd syscall_display_settings ; 48-SetRedrawType and SetButtonType

View File

@ -267,9 +267,6 @@ align 16
cur_saved_data rb 4096 cur_saved_data rb 4096
fpu_data: rb 512 fpu_data: rb 512
; device irq owners
irq_owner rd 16 ; process id
; on irq read ports ; on irq read ports
irq00read rd 16 irq00read rd 16

View File

@ -363,16 +363,7 @@ proc START stdcall, state:dword
call SysMsgBoardStr call SysMsgBoardStr
end if end if
mov eax, VALID_IRQ
mov ebx, [ctrl.int_line] mov ebx, [ctrl.int_line]
mov esi, msgInvIRQ
bt eax, ebx
jnc .fail_msg
mov eax, ATTCH_IRQ
mov esi, msgAttchIRQ
bt eax, ebx
jnc .fail_msg
stdcall AttachIntHandler, ebx, ac97_irq, dword 0 stdcall AttachIntHandler, ebx, ac97_irq, dword 0
.reg: .reg:
stdcall RegService, sz_sound_srv, service_proc stdcall RegService, sz_sound_srv, service_proc
@ -496,6 +487,27 @@ proc ac97_irq
call SysMsgBoardStr call SysMsgBoardStr
end if end if
mov edx, CTRL_STAT
call [ctrl.ctrl_read32]
cmp eax, 0xffffffff
je .exit
test eax, 0x40
jnz .do_intr
test eax, eax
jz .exit
mov edx, CTRL_STAT
call [ctrl.ctrl_write32]
.exit:
xor eax, eax
ret
.do_intr:
push eax
mov edx, PCM_OUT_CR_REG mov edx, PCM_OUT_CR_REG
mov al, 0x10; 0x10 mov al, 0x10; 0x10
call [ctrl.ctrl_write8] call [ctrl.ctrl_write8]
@ -528,18 +540,22 @@ proc ac97_irq
and eax, 31 and eax, 31
mov ebx, dword [buff_list+eax*4] mov ebx, dword [buff_list+eax*4]
cmp [ctrl.user_callback], 0 cmp [ctrl.user_callback], 0
je @f je .done
stdcall [ctrl.user_callback], ebx
@@:
ret
stdcall [ctrl.user_callback], ebx
.done:
pop eax
and eax, 0x40
mov edx, CTRL_STAT
call [ctrl.ctrl_write32]
or eax, 1
ret
.skip: .skip:
mov edx, PCM_OUT_CR_REG mov edx, PCM_OUT_CR_REG
mov ax, 0x11 ;0x1D mov ax, 0x11 ;0x1D
call [ctrl.ctrl_write8] call [ctrl.ctrl_write8]
ret jmp .done
endp endp
align 4 align 4
@ -792,6 +808,8 @@ end if
and eax, 0xFF and eax, 0xFF
mov [ctrl.cfg_reg], eax mov [ctrl.cfg_reg], eax
mov [ctrl.user_callback], 0
call [ctrl.ctrl_setup] call [ctrl.ctrl_setup]
xor eax, eax xor eax, eax
inc eax inc eax

View File

@ -69,9 +69,11 @@ free_cd_channel:
jne .IDE_Channel_2 jne .IDE_Channel_2
.IDE_Channel_1: .IDE_Channel_1:
mov [IDE_Channel_1],0 mov [IDE_Channel_1],0
sti
ret ret
.IDE_Channel_2: .IDE_Channel_2:
mov [IDE_Channel_2],0 mov [IDE_Channel_2],0
sti
ret ret
uglobal uglobal

View File

@ -435,10 +435,8 @@ get_event_for_app: ;; used from f10,f11,f23
jz .no_events ; èñ÷åðïàëè âñå áèòû ìàñêè, íî íè÷åãî íå íàøëè ??? jz .no_events ; èñ÷åðïàëè âñå áèòû ìàñêè, íî íè÷åãî íå íàøëè ???
btr ecx,eax ; ñáðàñûâàåì ïðîâåðÿåìûé áèò ìàñêè btr ecx,eax ; ñáðàñûâàåì ïðîâåðÿåìûé áèò ìàñêè
; ïåðåõîäèì íà îáðàáîò÷èê ýòîãî (eax) áèòà ; ïåðåõîäèì íà îáðàáîò÷èê ýòîãî (eax) áèòà
cmp eax,16
jae .IRQ ; eax=[16..31]=retvals, events irq0..irq15
cmp eax,9 cmp eax,9
jae .loop ; eax=[9..15], ignored jae .loop ; eax=[9..31], ignored
cmp eax,3 cmp eax,3
je .loop ; eax=3, ignored je .loop ; eax=3, ignored
ja .FlagAutoReset ; eax=[4..8], retvals=eax+1 ja .FlagAutoReset ; eax=[4..8], retvals=eax+1
@ -451,16 +449,7 @@ get_event_for_app: ;; used from f10,f11,f23
.no_events: .no_events:
xor eax,eax xor eax,eax
ret ret
.IRQ:
;TODO: ñäåëàòü òàê æå, êàê è äëÿ FlagAutoReset (BgrRedraw,Mouse,IPC,Stack,Debug)
mov edx,[irq_owner+eax*4-64] ; eax==16+irq
cmp edx,[edi+TASKDATA.pid]
jne .loop
mov edx,eax
shl edx,12
cmp dword[IRQ_SAVE+edx-0x10000],0 ; edx==(16+irq)*0x1000
je .loop ; empty ???
ret ; retval = eax
.FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9 .FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9
cmp eax,5 ; Mouse 5+1=6 cmp eax,5 ; Mouse 5+1=6
jne @f jne @f

View File

@ -1021,7 +1021,6 @@ end if
jmp osloop jmp osloop
; jmp $ ; wait here for timer to take control
; Fly :) ; Fly :)
@ -1056,8 +1055,8 @@ boot_log:
align 32 align 32
osloop: osloop:
call [draw_pointer] call [draw_pointer]
call window_check_events call window_check_events
call mouse_check_events call mouse_check_events
call checkmisc call checkmisc
call checkVga_N13 call checkVga_N13
call stack_handler call stack_handler
@ -1121,58 +1120,31 @@ include "kernel32.inc"
reserve_irqs_ports: reserve_irqs_ports:
push eax
xor eax,eax
inc eax
mov byte [irq_owner+4*0],al ;1 ; timer
;mov [irq_owner+4*1], 1 ; keyboard
mov byte [irq_owner+4*6],al ;1 ; floppy diskette
mov byte [irq_owner+4*13],al ;1 ; math co-pros
mov byte [irq_owner+4*14],al ;1 ; ide I
mov byte [irq_owner+4*15],al ;1 ; ide II
pop eax
; RESERVE PORTS ; RESERVE PORTS
push 4 mov eax, RESERVED_PORTS
pop dword [RESERVED_PORTS] ;,edi mov ecx, 1
push 1 mov [eax], dword 4
pop dword [RESERVED_PORTS+16+0] ;,dword 1
and dword [RESERVED_PORTS+16+4],0 ;,dword 0x0
mov dword [RESERVED_PORTS+16+8],0x2d ;,dword 0x2d
push 1 mov [eax+16], ecx
pop dword [RESERVED_PORTS+32+0] ;,dword 1 mov [eax+16+4], dword 0
push 0x30 mov [eax+16+4], dword 0x2D
pop dword [RESERVED_PORTS+32+4] ;,dword 0x30
push 0x4d
pop dword [RESERVED_PORTS+32+8] ;,dword 0x4d
push 1 mov [eax+32], ecx
pop dword [RESERVED_PORTS+48+0] ;,dword 1 mov [eax+32+4], dword 0x30
push 0x50 mov [eax+32+8], dword 0x4D
pop dword [RESERVED_PORTS+48+4] ;,dword 0x50
mov dword [RESERVED_PORTS+48+8],0xdf ;,dword 0xdf
push 1 mov [eax+48], ecx
pop dword [RESERVED_PORTS+64+0] ;,dword 1 mov [eax+48+4], dword 0x50
mov [eax+28+8], dword 0xDF
mov dword [RESERVED_PORTS+64+4],0xe5 ;,dword 0xe5 mov [eax+64], ecx
mov dword [RESERVED_PORTS+64+8],0xff ;,dword 0xff mov [eax+64+4], dword 0xE5
mov [eax+64+8], dword 0xFF
ret ret
setirqreadports:
mov [irq12read+0],dword 0x60 + 0x01000000 ; read port 0x60 , byte
and dword [irq12read+4],0 ; end of port list
; mov [irq12read+4],dword 0 ; end of port list
;mov [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
;mov [irq04read+4],dword 0 ; end of port list
;mov [irq03read+0],dword 0x2f8 + 0x01000000 ; read port 0x2f8 , byte
;mov [irq03read+4],dword 0 ; end of port list
ret
iglobal iglobal
process_number dd 0x1 process_number dd 0x1
@ -1254,7 +1226,7 @@ sys_outport:
mov [esp+32],eax mov [esp+32],eax
ret ret
.sopl4: .sopl4:
mov dx,cx ; read mov dx,cx ; read
@ -1563,13 +1535,13 @@ cd_base db 0
endg endg
nsyse4: nsyse4:
sub ebx,2 ; SYSTEM LANGUAGE sub ebx,2 ; SYSTEM LANGUAGE
jnz nsyse5 jnz nsyse5
mov [syslang],ecx mov [syslang],ecx
ret ret
nsyse5: nsyse5:
sub ebx,2 ; HD BASE sub ebx,2 ; HD BASE
jnz nsyse7 jnz nsyse7
@ -1776,7 +1748,7 @@ ngsyse12:
mov [esp+32],dword 1 mov [esp+32],dword 1
ret ret
get_timer_ticks: get_timer_ticks:
mov eax,[timer_ticks] mov eax,[timer_ticks]
ret ret
@ -2950,7 +2922,7 @@ sheduler:
dd sys_sheduler.03 dd sys_sheduler.03
dd sys_sheduler.04 dd sys_sheduler.04
endg endg
sys_sheduler: sys_sheduler:
;rewritten by <Lrz> 29.12.2009 ;rewritten by <Lrz> 29.12.2009
jmp dword [sheduler+ebx*4] jmp dword [sheduler+ebx*4]
;.shed_counter: ;.shed_counter:
@ -2963,7 +2935,7 @@ sys_sheduler:
;.perf_control: ;.perf_control:
inc ebx ;before ebx=2, ebx=3 inc ebx ;before ebx=2, ebx=3
cmp ebx,ecx ;if ecx=3, ebx=3 cmp ebx,ecx ;if ecx=3, ebx=3
jz cache_disable jz cache_disable
dec ebx ;ebx=2 dec ebx ;ebx=2
cmp ebx,ecx ; cmp ebx,ecx ;
@ -2979,7 +2951,7 @@ sys_sheduler:
ret ret
.03: .03:
;.rdmsr_instr: ;.rdmsr_instr:
;now counter in ecx ;now counter in ecx
;(edx:eax) esi:edi => edx:esi ;(edx:eax) esi:edi => edx:esi
@ -3480,103 +3452,6 @@ memmove: ; memory move in bytes
align 4 align 4
sys_programirq:
mov eax, [TASK_BASE]
add ebx, [eax + TASKDATA.mem_start]
cmp ecx, 16
jae .not_owner
mov edi, [eax + TASKDATA.pid]
cmp edi, [irq_owner + 4 * ecx]
je .spril1
.not_owner:
xor ecx, ecx
inc ecx
jmp .end
.spril1:
shl ecx, 6
mov esi, ebx
lea edi, [irq00read + ecx]
push 16
pop ecx
cld
rep movsd
.end:
mov [esp+32], ecx
ret
align 4
get_irq_data:
movzx esi, bh ; save number of subfunction, if bh = 1, return data size, otherwise, read data
xor bh, bh
cmp ebx, 16
jae .not_owner
mov edx, [4 * ebx + irq_owner] ; check for irq owner
mov eax,[TASK_BASE]
cmp edx,[eax+TASKDATA.pid]
je gidril1
.not_owner:
xor edx, edx
dec edx
jmp gid1
gidril1:
shl ebx, 12
lea eax, [ebx + IRQ_SAVE] ; calculate address of the beginning of buffer + 0x0 - data size
mov edx, [eax] ; + 0x4 - data offset
dec esi
jz gid1
test edx, edx ; check if buffer is empty
jz gid1
mov ebx, [eax + 0x4]
mov edi, ecx
mov ecx, 4000 ; buffer size, used frequently
cmp ebx, ecx ; check for the end of buffer, if end of buffer, begin cycle again
jb @f
xor ebx, ebx
@@:
lea esi, [ebx + edx] ; calculate data size and offset
cld
cmp esi, ecx ; if greater than the buffer size, begin cycle again
jbe @f
sub ecx, ebx
sub edx, ecx
lea esi, [eax + ebx + 0x10]
rep movsb
xor ebx, ebx
@@:
lea esi, [eax + ebx + 0x10]
mov ecx, edx
add ebx, edx
rep movsb
mov edx, [eax]
mov [eax], ecx ; set data size to zero
mov [eax + 0x4], ebx ; set data offset
gid1:
mov [esp+32], edx ; eax
ret
set_io_access_rights: set_io_access_rights:
push edi eax push edi eax
mov edi, tss._io_map_0 mov edi, tss._io_map_0
@ -3588,13 +3463,13 @@ set_io_access_rights:
; shl ebx,cl ; shl ebx,cl
test ebp,ebp test ebp,ebp
; cmp ebp,0 ; enable access - ebp = 0 ; cmp ebp,0 ; enable access - ebp = 0
jnz siar1 jnz .siar1
; not ebx ; not ebx
; and [edi],byte bl ; and [edi],byte bl
btr [edi], eax btr [edi], eax
pop eax edi pop eax edi
ret ret
siar1: .siar1:
bts [edi], eax bts [edi], eax
; or [edi],byte bl ; disable access - ebp = 1 ; or [edi],byte bl ; disable access - ebp = 1
pop eax edi pop eax edi
@ -3605,7 +3480,7 @@ siar1:
; * ecx = number start arrea of ports ; * ecx = number start arrea of ports
; * edx = number end arrea of ports (include last number of port) ; * edx = number end arrea of ports (include last number of port)
;Return value: ;Return value:
; * eax = 0 - succesful ; * eax = 0 - succesful
; * eax = 1 - error ; * eax = 1 - error
; * The system has reserve this ports: ; * The system has reserve this ports:
; 0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (include last number of port). ; 0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (include last number of port).
@ -3749,66 +3624,7 @@ no_mask_io:
ret ret
reserve_free_irq: align 4
xor esi, esi
inc esi
cmp ecx, 16
jae ril1
push ecx
lea ecx, [irq_owner + 4 * ecx]
mov edx, [ecx]
mov eax, [TASK_BASE]
mov edi, [eax + TASKDATA.pid]
pop eax
dec ebx
jnz reserve_irq
cmp edx, edi
jne ril1
dec esi
mov [ecx], esi
jmp ril1
reserve_irq:
cmp dword [ecx], 0
jne ril1
mov ebx, [f_irqs + 4 * eax]
stdcall attach_int_handler, eax, ebx, dword 0
mov [ecx], edi
dec esi
ril1:
mov [esp+32], esi ; return in eax
ret
iglobal
f_irqs:
dd 0x0
dd 0x0
dd p_irq2
dd p_irq3
dd p_irq4
dd p_irq5
dd p_irq6
dd p_irq7
dd p_irq8
dd p_irq9
dd p_irq10
dd p_irq11
dd 0x0
dd 0x0
dd 0x0
dd 0x0
endg
drawbackground: drawbackground:
inc [mouse_pause] inc [mouse_pause]
cmp [SCR_MODE],word 0x12 cmp [SCR_MODE],word 0x12
@ -4820,27 +4636,27 @@ syscall_getarea:
dec ebx dec ebx
; eax - x, ebx - y ; eax - x, ebx - y
mov edx,ecx mov edx,ecx
shr ecx,16 shr ecx,16
and edx,0xffff and edx,0xffff
mov esi,ecx mov esi,ecx
; ecx - size x, edx - size y ; ecx - size x, edx - size y
mov ebp,edx mov ebp,edx
dec ebp dec ebp
lea ebp,[ebp*3] lea ebp,[ebp*3]
imul ebp,esi imul ebp,esi
mov esi,ecx mov esi,ecx
dec esi dec esi
lea esi,[esi*3] lea esi,[esi*3]
add ebp,esi add ebp,esi
add ebp,edi add ebp,edi
add ebx,edx add ebx,edx
.start_y: .start_y:
push ecx edx push ecx edx
.start_x: .start_x:
@ -4848,7 +4664,7 @@ syscall_getarea:
add eax,ecx add eax,ecx
call dword [GETPIXEL] ; eax - x, ebx - y call dword [GETPIXEL] ; eax - x, ebx - y
mov [ebp],cx mov [ebp],cx
shr ecx,16 shr ecx,16
mov [ebp+2],cl mov [ebp+2],cl
@ -4894,26 +4710,9 @@ syscall_drawline: ; DrawLine
mov ecx, edx mov ecx, edx
jmp [draw_line] jmp [draw_line]
align 4
syscall_getirqowner: ; GetIrqOwner
cmp ebx,16
jae .err
cmp [irq_rights + 4 * ebx], dword 2
je .err
mov eax,[4 * ebx + irq_owner]
mov [esp+32],eax
ret
.err:
or dword [esp+32], -1
ret
align 4 align 4
syscall_reserveportarea: ; ReservePortArea and FreePortArea syscall_reserveportarea: ; ReservePortArea and FreePortArea
call r_f_port_area call r_f_port_area
@ -4921,7 +4720,6 @@ syscall_reserveportarea: ; ReservePortArea and FreePortArea
ret ret
align 4 align 4
syscall_threads: ; CreateThreads syscall_threads: ; CreateThreads
; eax=1 create thread ; eax=1 create thread
; ;

View File

@ -70,7 +70,6 @@ block_clip:
mov ebp, ecx mov ebp, ecx
mov ecx, [ecx] mov ecx, [ecx]
mov edx, [edx] mov edx, [edx]
mov eax, ebx
call __L1OutCode call __L1OutCode
mov esi, eax mov esi, eax