export "SetMouseData" for pe drivers

git-svn-id: svn://kolibrios.org@924 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-11-17 12:04:16 +00:00
parent 5332de88d9
commit 7ea36b4316
6 changed files with 293 additions and 109 deletions

View File

@ -18,34 +18,34 @@ 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
mov ebx, [irq] ;irq num mov ebx, [irq] ;irq num
test ebx, ebx test ebx, ebx
jz .err jz .err
cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's cmp ebx, 15 ; hidnplayr says: we only have 16 IRQ's
ja .err ja .err
mov eax, [handler] mov eax, [handler]
test eax, eax test eax, eax
jz .err jz .err
cmp [irq_owner + 4 * ebx], 0 cmp [irq_owner + 4 * ebx], 0
je @f je @f
mov ecx, [irq_rights + 4 * ebx] ; Rights : 0 - full access, 1 - read only, 2 - forbidden mov ecx, [irq_rights + 4 * ebx] ; Rights : 0 - full access, 1 - read only, 2 - forbidden
test ecx, ecx test ecx, ecx
jnz .err jnz .err
@@: @@:
mov [irq_tab+ebx*4], eax mov [irq_tab+ebx*4], eax
mov eax, [access_rights] mov eax, [access_rights]
mov [irq_rights + 4 * ebx], eax mov [irq_rights + 4 * ebx], eax
mov [irq_owner + 4 * ebx], PID_KERNEL ; all handlers belong to a kernel mov [irq_owner + 4 * ebx], PID_KERNEL ; all handlers belong to a kernel
stdcall enable_irq, [irq] stdcall enable_irq, [irq]
mov eax, 1 mov eax, 1
ret ret
.err: .err:
xor eax, eax xor eax, eax
ret ret
endp endp
uglobal uglobal
@ -1056,11 +1056,10 @@ proc load_library stdcall, file_name:dword
test eax, eax test eax, eax
jnz @F jnz @F
mov ebx, [coff] mov ebx, [coff]
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],sz_EXPORTS stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],sz_EXPORTS
@@: @@:
mov [exports], eax mov [exports], eax
stdcall kernel_free, [coff] stdcall kernel_free, [coff]
mov eax, [exports] mov eax, [exports]
ret ret

View File

@ -72,7 +72,7 @@ iglobal
szLoadFile db 'LoadFile',0 szLoadFile db 'LoadFile',0
szSendEvent db 'SendEvent',0 szSendEvent db 'SendEvent',0
szSetMouseData db 'SetMouseData',0 szSetMouseData db 'SetMouseData',0
szSleep db 'Sleep',0 szSleep db 'Sleep',0
szGetTimerTicks db 'GetTimerTicks',0 szGetTimerTicks db 'GetTimerTicks',0
szStrncat db 'strncat',0 szStrncat db 'strncat',0
@ -103,27 +103,27 @@ kernel_export:
dd szPciWrite16 , pci_write16 dd szPciWrite16 , pci_write16
dd szPciWrite32 , pci_write32 dd szPciWrite32 , pci_write32
dd szAllocPage , alloc_page ;stdcall dd szAllocPage , alloc_page ;stdcall
dd szAllocPages , alloc_pages ;stdcall dd szAllocPages , alloc_pages ;stdcall
dd szFreePage , free_page dd szFreePage , free_page
dd szMapPage , map_page ;stdcall dd szMapPage , map_page ;stdcall
dd szMapSpace , map_space dd szMapSpace , map_space
dd szMapIoMem , map_io_mem ;stdcall dd szMapIoMem , map_io_mem ;stdcall
dd szGetPgAddr , get_pg_addr dd szGetPgAddr , get_pg_addr
dd szCommitPages , commit_pages ;not implemented dd szCommitPages , commit_pages ;not implemented
dd szReleasePages , release_pages dd szReleasePages , release_pages
dd szAllocKernelSpace, alloc_kernel_space ;stdcall dd szAllocKernelSpace, alloc_kernel_space ;stdcall
dd szFreeKernelSpace , free_kernel_space ;stdcall dd szFreeKernelSpace , free_kernel_space ;stdcall
dd szKernelAlloc , kernel_alloc ;stdcall dd szKernelAlloc , kernel_alloc ;stdcall
dd szKernelFree , kernel_free ;stdcall dd szKernelFree , kernel_free ;stdcall
dd szUserAlloc , user_alloc ;stdcall dd szUserAlloc , user_alloc ;stdcall
dd szUserFree , user_free ;stdcall dd szUserFree , user_free ;stdcall
dd szKmalloc , malloc dd szKmalloc , malloc
dd szKfree , free dd szKfree , free
dd szCreateRingBuffer, create_ring_buffer ;stdcall dd szCreateRingBuffer, create_ring_buffer ;stdcall
dd szGetPid , get_pid dd szGetPid , get_pid
dd szCreateObject , create_kernel_object dd szCreateObject , create_kernel_object
dd szDestroyObject , destroy_kernel_object dd szDestroyObject , destroy_kernel_object
dd szCreateEvent , create_event dd szCreateEvent , create_event
@ -132,17 +132,17 @@ kernel_export:
dd szDestroyEvent , destroy_event dd szDestroyEvent , destroy_event
dd szClearEvent , clear_event dd szClearEvent , clear_event
dd szLoadCursor , load_cursor ;stdcall dd szLoadCursor , load_cursor ;stdcall
dd szSelectHwCursor , select_hw_cursor ;import stdcall dd szSelectHwCursor , select_hw_cursor ;import stdcall
dd szSetHwCursor , set_hw_cursor ;import stdcall dd szSetHwCursor , set_hw_cursor ;import stdcall
dd szHwCursorRestore , hw_restore ;import dd szHwCursorRestore , hw_restore ;import
dd szHwCursorCreate , create_cursor ;import dd szHwCursorCreate , create_cursor ;import
dd szSysMsgBoardStr , sys_msg_board_str dd szSysMsgBoardStr , sys_msg_board_str
dd szSysMsgBoardChar , sys_msg_board dd szSysMsgBoardChar , sys_msg_board
dd szGetCurrentTask , get_curr_task dd szGetCurrentTask , get_curr_task
dd szLoadFile , load_file ;retval eax, ebx dd szLoadFile , load_file ;retval eax, ebx
dd szSendEvent , send_event dd szSendEvent , send_event
dd szSetMouseData , set_mouse_data ;stdcall dd szSetMouseData , set_mouse_data ;stdcall
dd szSleep , delay_ms dd szSleep , delay_ms

View File

@ -241,7 +241,9 @@ release_pages:
@@: @@:
xor eax, eax xor eax, eax
xchg eax, [esi] xchg eax, [esi]
push eax
invlpg [edi] invlpg [edi]
pop eax
test eax, 1 test eax, 1
jz .next jz .next
@ -417,7 +419,9 @@ proc new_mem_resize stdcall, new_size:dword
mov dword [app_page_tabs+edi*4], 2 mov dword [app_page_tabs+edi*4], 2
mov ebx, edi mov ebx, edi
shl ebx, 12 shl ebx, 12
push eax
invlpg [ebx] invlpg [ebx]
pop eax
call free_page call free_page
.next: add edi, 1 .next: add edi, 1
@ -1283,6 +1287,8 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
@@: @@:
mov [page_tabs+edi], eax mov [page_tabs+edi], eax
mov [page_tabs+edi+edx], eax mov [page_tabs+edi+edx], eax
invlpg [ebx]
invlpg [ebx+0x10000]
add eax, 0x1000 add eax, 0x1000
add ebx, 0x1000 add ebx, 0x1000
add edi, 4 add edi, 4
@ -1302,3 +1308,182 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
endp endp
if 0
; under constuction
shmem_list:
.bk dd shmem_list
.fd dd shmem_list
shmem
.bk dd ?
.fd dd ?
.base dd ?
.size dd ?
.access dd ?
.refcount dd ?
.name rb 32
align 4
proc shmem_open stdcall name:dword, size:dword, access:dword
locals
mapped dd ?
shm dd ?
pages dd ?
endl
push esi
push edi
mov [mapped], 0
mov eax, [name]
test eax, eax
jz .exit
pushfd ;mutex required
cli
mov ebx, [shmem_list.fd]
@@:
cmp ebx, shmem_list
je .not_found
lea edx, [edx+24] ; link , base, size
stdcall strncmp, edx, eax, 32
test eax, eax
je .found
mov ebx, [ebx+4]
jmp @B
.found: ;check access rights
mov eax, [access]
test eax, SHM_CREATE
mov ecx, [ebx+8]
jnz .fail_exist
and eax, ACC_MASK
and ecx, ACC_MASK
cmp eax, ecx
jne .fail_acc
stdcall user_alloc, [ebx+12]
test eax, eax
mov [mapped], eax
jz .fail_mem
mov eax, [ebx+4]
mov ecx, [ebx+12]
shr ecx, 12
mov ebx, [mapped]
call commit_pages
.exit:
mov eax, [mapped]
pop edi
pop esi
ret
.not_found:
mov eax, [access]
test eax, SHM_CREATE
mov ebx, E_NOTFOUND
jz .exit
;create shmem
mov ecx, [size]
test ecx, ecx
mov ebx, E_PARAM
jz .exit
add ecx, 4095
and ecx, -4096
mov [size], ecx
stdcall user_alloc, ecx
test eax, eax
mov [mapped], eax
mov ebx, E_NOMEM
jz .exit
mov eax, 24+32
call malloc
test eax, eax
mov [shm], eax
mov ebx, E_NOMEM
jz .exit ;FIXME cleanup
mov [eax+24+28], dword 0
lea edx, [eax+24]
stdcall strncpy, edx, [name], 31
mov eax, [size]
shr eax, 12
mov esi, eax
stdcall alloc_pages, eax
test eax, eax
mov [pages], eax
mov ebx, E_NOMEM
jz .exit ;FIXME cleanup
mov edi, eax
add edi, [size]
and esi, 7
add esi, -8
jz @F
;release unused pages
.release:
mov eax, edi
add edi, 4096
call free_page
dec esi
jnz .release
mov eax, [ebx+4]
mov ecx, [ebx+12]
shr ecx, 12
mov ebx, [mapped]
call commit_pages
mov eax, [access]
and eax, ACC_MASK
or eax, [pages]
mov ebx, [mapped]
mov ecx, [size]
shr ecx, 12
call commit_pages
mov edx, [shm]
mov ecx, [pages]
mov [edx+8], ecx
mov ecx, [size]
mov [edx+12], ecx
; mov [edx], shmem
; mov [edx+4], [shmem.fd]
; mov [shmem.fd.bk], edx
; mov [shmem.fd], edx
xor ebx, ebx
jmp .exit
.fail_exist:
mov ebx, E_EXIST
xor eax, eax
ret
.fail_access:
mov ebx, E_ACCESS
xor eax, eax
ret
.fail_mem:
mov ebx, E_NOMEM
xor eax, eax
ret
endp
end if

View File

@ -310,7 +310,9 @@ __exports:
user_alloc, 'UserAlloc', \ ; stdcall user_alloc, 'UserAlloc', \ ; stdcall
user_free, 'UserFree', \ ; stdcall user_free, 'UserFree', \ ; stdcall
unmap_pages, 'UnmapPages', \ ; eax, ecx unmap_pages, 'UnmapPages', \ ; eax, ecx
sys_msg_board_str, 'SysMsgBoardStr' sys_msg_board_str, 'SysMsgBoardStr', \
delay_hs, 'Delay', \ ; ebx
set_mouse_data, 'SetMouseData'

View File

@ -163,9 +163,9 @@ iglobal
dd sys_pcibios ; 57-PCI BIOS32 dd sys_pcibios ; 57-PCI BIOS32
dd file_system ; 58-Common file system interface dd file_system ; 58-Common file system interface
dd 0 dd 0
dd sys_IPC ; 60-Inter Process Communication dd sys_IPC ; 60-Inter Process Communication
dd sys_gs ; 61-Direct graphics access dd sys_gs ; 61-Direct graphics access
dd sys_pci ; 62-PCI functions dd sys_pci ; 62-PCI functions
dd sys_msg_board ; 63-System message board dd sys_msg_board ; 63-System message board
dd sys_resize_app_memory ; 64-Resize application memory usage dd sys_resize_app_memory ; 64-Resize application memory usage
dd syscall_putimage_palette; 65-PutImagePalette dd syscall_putimage_palette; 65-PutImagePalette
@ -183,79 +183,79 @@ iglobal
align 4 align 4
servetable2: servetable2:
dd sys_drawwindow ; 0-DrawWindow dd sys_drawwindow ; 0-DrawWindow
dd syscall_setpixel ; 1-SetPixel dd syscall_setpixel ; 1-SetPixel
dd sys_getkey ; 2-GetKey dd sys_getkey ; 2-GetKey
dd sys_clock ; 3-GetTime dd sys_clock ; 3-GetTime
dd syscall_writetext ; 4-WriteText dd syscall_writetext ; 4-WriteText
dd delay_hs ; 5-DelayHs dd delay_hs ; 5-DelayHs
dd syscall_openramdiskfile ; 6-OpenRamdiskFile dd syscall_openramdiskfile ; 6-OpenRamdiskFile
dd syscall_putimage ; 7-PutImage dd syscall_putimage ; 7-PutImage
dd sys_button ; 8-DefineButton dd sys_button ; 8-DefineButton
dd sys_cpuusage ; 9-GetProcessInfo dd sys_cpuusage ; 9-GetProcessInfo
dd sys_waitforevent ; 10-WaitForEvent dd sys_waitforevent ; 10-WaitForEvent
dd sys_getevent ; 11-CheckForEvent dd sys_getevent ; 11-CheckForEvent
dd sys_redrawstat ; 12-BeginDraw and EndDraw dd sys_redrawstat ; 12-BeginDraw and EndDraw
dd syscall_drawrect ; 13-DrawRect dd syscall_drawrect ; 13-DrawRect
dd syscall_getscreensize ; 14-GetScreenSize dd syscall_getscreensize ; 14-GetScreenSize
dd sys_background ; 15-bgr dd sys_background ; 15-bgr
dd sys_cachetodiskette ; 16-FlushFloppyCache dd sys_cachetodiskette ; 16-FlushFloppyCache
dd sys_getbutton ; 17-GetButton dd sys_getbutton ; 17-GetButton
dd sys_system ; 18-System Services dd sys_system ; 18-System Services
dd paleholder ; 19-reserved dd paleholder ; 19-reserved
dd cross_order ; 20-ResetMidi and OutputMidi dd cross_order ; 20-ResetMidi and OutputMidi
dd cross_order ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,. dd cross_order ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
dd cross_order ; 22-setting date,time,clock and alarm-clock dd cross_order ; 22-setting date,time,clock and alarm-clock
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd undefined_syscall ; 25-reserved dd undefined_syscall ; 25-reserved
dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,. dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
dd undefined_syscall ; 27-reserved dd undefined_syscall ; 27-reserved
dd undefined_syscall ; 28-reserved dd undefined_syscall ; 28-reserved
dd sys_date ; 29-GetDate dd sys_date ; 29-GetDate
dd cross_order ; 30-Get/SetCurrentDirectory dd cross_order ; 30-Get/SetCurrentDirectory
dd undefined_syscall ; 31-reserved dd undefined_syscall ; 31-reserved
dd undefined_syscall ; 32-reserved dd undefined_syscall ; 32-reserved
dd undefined_syscall ; 33-reserved dd undefined_syscall ; 33-reserved
dd undefined_syscall ; 34-reserved dd undefined_syscall ; 34-reserved
dd syscall_getpixel ; 35-GetPixel dd syscall_getpixel ; 35-GetPixel
dd syscall_getarea ; 36-GetArea dd syscall_getarea ; 36-GetArea
dd cross_order ; 37-GetMousePosition_ScreenRelative,. dd cross_order ; 37-GetMousePosition_ScreenRelative,.
dd syscall_drawline ; 38-DrawLine dd syscall_drawline ; 38-DrawLine
dd cross_order ; 39-GetBackgroundSize,ReadBgrData,. dd cross_order ; 39-GetBackgroundSize,ReadBgrData,.
dd set_app_param ; 40-WantEvents dd set_app_param ; 40-WantEvents
dd syscall_getirqowner ; 41-GetIrqOwner dd syscall_getirqowner ; 41-GetIrqOwner
dd get_irq_data ; 42-ReadIrqData dd get_irq_data ; 42-ReadIrqData
dd cross_order ; 43-SendDeviceData dd cross_order ; 43-SendDeviceData
dd sys_programirq ; 44-ProgramIrqs dd sys_programirq ; 44-ProgramIrqs
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
dd cross_order ; 46-ReservePortArea and FreePortArea dd cross_order ; 46-ReservePortArea and FreePortArea
dd cross_order ; 47-WriteNum dd cross_order ; 47-WriteNum
dd cross_order ; 48-SetRedrawType and SetButtonType dd cross_order ; 48-SetRedrawType and SetButtonType
dd cross_order ; 49-Advanced Power Management (APM) dd cross_order ; 49-Advanced Power Management (APM)
dd cross_order ; 50-Window shape & scale dd cross_order ; 50-Window shape & scale
dd cross_order ; 51-Threads dd cross_order ; 51-Threads
dd cross_order ; 52-Stack driver status dd cross_order ; 52-Stack driver status
dd cross_order ; 53-Socket interface dd cross_order ; 53-Socket interface
dd undefined_syscall ; 54-reserved dd undefined_syscall ; 54-reserved
dd cross_order ; 55-Sound interface dd cross_order ; 55-Sound interface
dd undefined_syscall ; 56-reserved dd undefined_syscall ; 56-reserved
dd cross_order ; 57-PCI BIOS32 dd cross_order ; 57-PCI BIOS32
dd cross_order ; 58-Common file system interface dd cross_order ; 58-Common file system interface
dd undefined_syscall ; 59-reserved dd undefined_syscall ; 59-reserved
dd cross_order ; 60-Inter Process Communication dd cross_order ; 60-Inter Process Communication
dd cross_order ; 61-Direct graphics access dd cross_order ; 61-Direct graphics access
dd cross_order ; 62-PCI functions dd cross_order ; 62-PCI functions
dd cross_order ; 63-System message board dd cross_order ; 63-System message board
dd cross_order ; 64-Resize application memory usage dd cross_order ; 64-Resize application memory usage
dd cross_order ; 65-PutImagePalette dd cross_order ; 65-PutImagePalette
dd cross_order ; 66-Process definitions - keyboard dd cross_order ; 66-Process definitions - keyboard
dd cross_order ; 67-Window move or resize dd cross_order ; 67-Window move or resize
dd cross_order ; 68-Some internal services dd cross_order ; 68-Some internal services
dd cross_order ; 69-Debug dd cross_order ; 69-Debug
dd cross_order ; 70-Common file system interface, version 2 dd cross_order ; 70-Common file system interface, version 2
dd cross_order ; 71-Window settings dd cross_order ; 71-Window settings
dd cross_order ; 72-Send window message dd cross_order ; 72-Send window message
times 255 - ( ($-servetable2) /4 ) dd undefined_syscall times 255 - ( ($-servetable2) /4 ) dd undefined_syscall
dd sys_end ; -1-end application dd sys_end ; -1-end application

View File

@ -890,8 +890,6 @@ end if
setnz [dma_hdd] setnz [dma_hdd]
mov [timer_ticks_enable],1 ; for cd driver mov [timer_ticks_enable],1 ; for cd driver
; stdcall init_uart_service, DRV_ENTRY
sti sti
call change_task call change_task