imports header

kernel objects
segmented sound buffers

git-svn-id: svn://kolibrios.org@281 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-01-19 03:58:46 +00:00
parent c6080c59e9
commit 15170454cc
17 changed files with 939 additions and 870 deletions

View File

@ -312,19 +312,39 @@ struc SYS_VARS
dd ? dd ?
} }
struc APPOBJ ;common object header
{
.magic dd ? ;
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
};
virtual at 0
APPOBJ APPOBJ
end virtual
APP_OBJ_OFFSET equ 48
struc CURSOR struc CURSOR
{ .magic dd ? {;common object header
.size dd ? .magic dd ? ;'CURS'
.pid dd ? .destroy dd ? ;internal destructor
.base dd ? .fd dd ? ;next object in list
.hot_x dd ? .bk dd ? ;prev object in list
.pid dd ? ;owner id
;cursor data
.base dd ? ;allocated memory
.hot_x dd ? ;hotspot coords
.hot_y dd ? .hot_y dd ?
} }
virtual at 0 virtual at 0
CURSOR CURSOR CURSOR CURSOR
end virtual end virtual
CURSOR_SIZE equ 24 CURSOR_SIZE equ 32
struc BOOT_DATA struc BOOT_DATA
{ .bpp dd ? { .bpp dd ?

View File

@ -1,8 +1,8 @@
DRV_ENTRY equ 1 DRV_ENTRY equ 1
DRV_EXIT equ -1 DRV_EXIT equ -1
DRV_COMPAT equ 1 ;minimal required drivers version DRV_COMPAT equ 2 ;minimal required drivers version
DRV_CURRENT equ 1 ;current drivers model version DRV_CURRENT equ 2 ;current drivers model version
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
@ -371,10 +371,10 @@ reg_service:
mov ecx, [.handler] mov ecx, [.handler]
mov [eax+SRV.srv_proc], ecx mov [eax+SRV.srv_proc], ecx
ret ret 8
.fail: .fail:
xor eax, eax xor eax, eax
ret ret 8
align 4 align 4
proc get_proc stdcall, exp:dword, sz_name:dword proc get_proc stdcall, exp:dword, sz_name:dword
@ -965,7 +965,6 @@ proc load_library stdcall, file_name:dword
ret ret
endp endp
align 4 align 4
proc stop_all_services proc stop_all_services
@ -987,6 +986,54 @@ proc stop_all_services
ret ret
endp endp
; param
; eax= pid
; ebx= size
align 4
create_kernel_object:
push ebx
call malloc
pop ebx
test eax, eax
jz .fail
mov ecx,[CURRENT_TASK]
shl ecx,8
add ecx, PROC_BASE+APP_OBJ_OFFSET
mov edx, [ecx+APPOBJ.fd]
mov [eax+APPOBJ.fd], edx
mov [eax+APPOBJ.bk], ecx
mov [eax+APPOBJ.pid], ebx
mov [ecx+APPOBJ.fd], eax
mov [edx+APPOBJ.bk], eax
.fail:
ret
; param
; eax= object
align 4
destroy_kernel_object:
mov ebx, [eax+APPOBJ.fd]
mov ecx, [eax+APPOBJ.bk]
mov [ebx+APPOBJ.bk], ecx
mov [ecx+APPOBJ.fd], ebx
xor edx, edx ;clear common header
mov [eax], edx
mov [eax+4], edx
mov [eax+8], edx
mov [eax+12], edx
mov [eax+16], edx
call free ;release object memory
ret
drv_sound db '/rd/1/drivers/unisound.obj', 0 drv_sound db '/rd/1/drivers/unisound.obj', 0
drv_infinity db '/rd/1/drivers/infinity.obj', 0 drv_infinity db '/rd/1/drivers/infinity.obj', 0

View File

@ -2,54 +2,94 @@
iglobal iglobal
szKernel db 'KERNEL', 0 szKernel db 'KERNEL', 0
szVersion db 'version',0 szVersion db 'version',0
szRegService db 'RegService',0
szGetService db 'GetService',0
szServiceHandler db 'ServiceHandler',0
szAttachIntHandler db 'AttachIntHandler',0 szAttachIntHandler db 'AttachIntHandler',0
szSysMsgBoardStr db 'SysMsgBoardStr', 0 szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0
szPciApi db 'PciApi', 0 szPciApi db 'PciApi', 0
szPciRead32 db 'PciRead32', 0 szPciRead32 db 'PciRead32', 0
szPciRead8 db 'PciRead8', 0 szPciRead8 db 'PciRead8', 0
szPciWrite8 db 'PciWrite8',0 szPciWrite8 db 'PciWrite8',0
szAllocKernelSpace db 'AllocKernelSpace',0
szAllocPage db 'AllocPage',0
szAllocPages db 'AllocPages',0
szFreePage db 'FreePage',0
szGetPgAddr db 'GetPgAddr',0
szMapPage db 'MapPage',0 szMapPage db 'MapPage',0
szRegService db 'RegService',0 szMapSpace db 'MapSpace',0
szCommitPages db 'CommitPages',0
szReleasePages db 'ReleasePages',0
szAllocKernelSpace db 'AllocKernelSpace',0
szFreeKernelSpace db 'FreeKernelSpace',0
szKernelAlloc db 'KernelAlloc',0 szKernelAlloc db 'KernelAlloc',0
szKernelFree db 'KernelFree',0 szKernelFree db 'KernelFree',0
szGetPgAddr db 'GetPgAddr',0 szUserAlloc db 'UserAlloc',0
szGetCurrentTask db 'GetCurrentTask',0 szUserFree db 'UserFree',0
szGetService db 'GetService',0 szKmalloc db 'Kmalloc',0
szServiceHandler db 'ServiceHandler',0 szKfree db 'Kfree',0
szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0 szCreateObject db 'CreateObject',0
szDestroyObject db 'DestroyObject',0
szLoadCursor db 'LoadCursor',0 szLoadCursor db 'LoadCursor',0
szSetHwCursor db 'SetHwCursor',0 szSetHwCursor db 'SetHwCursor',0
szHwCursorRestore db 'HwCursorRestore', 0 szHwCursorRestore db 'HwCursorRestore', 0
szHwCursorCreate db 'HwCursorCreate', 0 szHwCursorCreate db 'HwCursorCreate', 0
szSysMsgBoardStr db 'SysMsgBoardStr', 0
szGetCurrentTask db 'GetCurrentTask',0
szLFBAddress db 'LFBAddress',0 szLFBAddress db 'LFBAddress',0
szLoadFile db 'LoadFile',0 szLoadFile db 'LoadFile',0
szSendEvent db 'SendEvent',0 szSendEvent db 'SendEvent',0
align 16 align 16
kernel_export: kernel_export:
dd szRegService , reg_service
dd szGetService , get_service
dd szServiceHandler , srv_handler
dd szAttachIntHandler, attach_int_handler dd szAttachIntHandler, attach_int_handler
dd szSysMsgBoardStr , sys_msg_board_str dd szFpuSave , fpu_save
dd szFpuRestore , fpu_restore
dd szPciApi , pci_api dd szPciApi , pci_api
dd szPciRead32 , pci_read32 dd szPciRead32 , pci_read32
dd szPciRead8 , pci_read8 dd szPciRead8 , pci_read8
dd szPciWrite8 , pci_write8 dd szPciWrite8 , pci_write8
dd szAllocKernelSpace, alloc_kernel_space
dd szAllocPage , alloc_page
dd szAllocPages , alloc_pages
dd szFreePage , free_page
dd szMapPage , map_page dd szMapPage , map_page
dd szRegService , reg_service dd szMapSpace , map_space
dd szGetPgAddr , get_pg_addr
dd szCommitPages , commit_pages ;not implemented
dd szReleasePages , release_pages
dd szAllocKernelSpace, alloc_kernel_space
dd szFreeKernelSpace , free_kernel_space
dd szKernelAlloc , kernel_alloc dd szKernelAlloc , kernel_alloc
dd szKernelFree , kernel_free dd szKernelFree , kernel_free
dd szGetPgAddr , get_pg_addr dd szUserAlloc , user_alloc
dd szGetCurrentTask , get_curr_task dd szUserFree , user_free
dd szGetService , get_service dd szKmalloc , malloc
dd szServiceHandler , srv_handler dd szKfree , free
dd szFpuSave , fpu_save
dd szFpuRestore , fpu_restore dd szCreateObject , create_kernel_object
dd szDestroyObject , destroy_kernel_object
dd szLoadCursor , load_cursor dd szLoadCursor , load_cursor
dd szSetHwCursor , set_hw_cursor dd szSetHwCursor , set_hw_cursor
dd szHwCursorRestore , hw_restore dd szHwCursorRestore , hw_restore
dd szHwCursorCreate , create_cursor dd szHwCursorCreate , create_cursor
dd szSysMsgBoardStr , sys_msg_board_str
dd szGetCurrentTask , get_curr_task
dd szLoadFile , load_file dd szLoadFile , load_file
dd szSendEvent , send_event dd szSendEvent , send_event
exp_lfb: exp_lfb:

View File

@ -578,7 +578,7 @@ proc kernel_free stdcall, base:dword
and [heap_mutex], 0 and [heap_mutex], 0
mov ecx, [esi+block_size]; mov ecx, [esi+block_size];
shr ecx, 12
call release_pages ;eax, ecx call release_pages ;eax, ecx
stdcall free_kernel_space, [base] stdcall free_kernel_space, [base]
ret ret
@ -643,7 +643,6 @@ proc user_alloc stdcall, alloc_size:dword
mov edi, dword [ebx+PROC_BASE+APPDATA.heap_top]; heap_top mov edi, dword [ebx+PROC_BASE+APPDATA.heap_top]; heap_top
add esi, new_app_base add esi, new_app_base
add edi, new_app_base add edi, new_app_base
l_0: l_0:
cmp esi, edi cmp esi, edi
jae m_exit jae m_exit

View File

@ -242,6 +242,13 @@ proc map_page stdcall,lin_addr:dword,phis_addr:dword,flags:dword
ret ret
endp endp
align 4
map_space: ;not implemented
ret
align 4 align 4
proc free_page proc free_page
;arg: eax page address ;arg: eax page address
@ -265,8 +272,19 @@ proc free_page
endp endp
; param ; param
; ecx= size ; eax= page base
; ebx= liear address
; ecx= count
align 4
commit_pages: ;not implemented
ret
; param
; eax= base ; eax= base
; ecx= count
align 4 align 4
release_pages: release_pages:
@ -274,7 +292,6 @@ release_pages:
mov ebx, pg_data.pg_mutex mov ebx, pg_data.pg_mutex
call wait_mutex ;ebx call wait_mutex ;ebx
shr ecx, 12
mov esi, eax mov esi, eax
mov edi, eax mov edi, eax

View File

@ -1002,6 +1002,10 @@ proc set_app_params stdcall,slot:dword, params:dword,\
inc dword [TASK_COUNT] ;update number of processes inc dword [TASK_COUNT] ;update number of processes
.noinc: .noinc:
shl ebx,8 shl ebx,8
lea edx, [ebx+PROC_BASE+APP_OBJ_OFFSET]
mov [PROC_BASE+APPDATA.fd_obj+ebx],edx
mov [PROC_BASE+APPDATA.bk_obj+ebx],edx
mov ecx, [def_cursor] mov ecx, [def_cursor]
mov [PROC_BASE+APPDATA.cursor+ebx],ecx mov [PROC_BASE+APPDATA.cursor+ebx],ecx
@ -1014,11 +1018,14 @@ proc set_app_params stdcall,slot:dword, params:dword,\
mov edx,[edx] ;app_cmdline mov edx,[edx] ;app_cmdline
test edx,edx test edx,edx
jz @F ;application don't need parameters jz @F ;application don't need parameters
mov eax, edx mov eax, edx
add eax, 256 add eax, 256
jc @f jc @f
cmp eax, [PROC_BASE+APPDATA.mem_size+ebx*8] cmp eax, [PROC_BASE+APPDATA.mem_size+ebx*8]
ja @f ja @f
add edx, new_app_base add edx, new_app_base
stdcall k_strncpy, edx, [cmd_line], 256 stdcall k_strncpy, edx, [cmd_line], 256
@@: @@:

View File

@ -2,6 +2,7 @@
format MS COFF format MS COFF
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc'
DEBUG equ 1 DEBUG equ 1
@ -33,18 +34,23 @@ virtual at 0
end virtual end virtual
struc CURSOR struc CURSOR
{ .magic dd ? {;common object header
.size dd ? .magic dd ? ;'CURS'
.pid dd ? .destroy dd ? ;internal destructor
.base dd ? .fd dd ? ;next object in list
.hot_x dd ? .bk dd ? ;prev object in list
.pid dd ? ;owner id
;cursor data
.base dd ? ;allocated memory
.hot_x dd ? ;hotspot coords
.hot_y dd ? .hot_y dd ?
} }
virtual at 0 virtual at 0
CURSOR CURSOR CURSOR CURSOR
end virtual end virtual
CURSOR_SIZE equ 24 CURSOR_SIZE equ 32
R8500 equ 0x514C ;R200 R8500 equ 0x514C ;R200
R9000 equ 0x4966 ;RV250 R9000 equ 0x4966 ;RV250
@ -155,18 +161,6 @@ public START
public service_proc public service_proc
public version public version
extrn SysMsgBoardStr
extrn PciApi
extrn PciRead32
extrn AllocKernelSpace
extrn MapPage
extrn RegService
extrn SetHwCursor
extrn HwCursorRestore
extrn HwCursorCreate
extrn LFBAddress
extrn LoadFile
CURSOR_IMAGE_OFFSET equ 0x00500000 CURSOR_IMAGE_OFFSET equ 0x00500000
DRV_ENTRY equ 1 DRV_ENTRY equ 1
@ -192,18 +186,12 @@ proc START stdcall, state:dword
test eax, eax test eax, eax
jz .fail jz .fail
xor eax, eax or eax, -1
mov edi, cursors
mov ecx, CURSOR_SIZE*16
cld
rep stosd
not eax
mov [cursor_map], eax mov [cursor_map], eax
mov [cursor_map+4], eax mov [cursor_map+4], eax
mov edx, cursor_map mov edx, cursor_map
mov [cursor_start], edx mov [cursor_start], edx
add edx, 4 add edx, 8
mov [cursor_end], edx mov [cursor_end], edx
stdcall RegService, sz_ati_srv, service_proc stdcall RegService, sz_ati_srv, service_proc
@ -457,16 +445,41 @@ video_free:
popfd popfd
ret ret
; param
; eax= pid
; ebx= src
; ecx= flags
align 4 align 4
proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword ati_cursor:
.src equ esp
.flags equ esp+4
.hcursor equ esp+8
stdcall video_alloc sub esp, 4 ;space for .hcursor
push ecx
push ebx
mov edi, [hcursor] mov ebx, eax
mov eax, CURSOR_SIZE
call CreateObject
test eax, eax
jz .fail
mov [.hcursor],eax
xor ebx, ebx
mov [eax+CURSOR.magic], 'CURS'
mov [eax+CURSOR.destroy], destroy_cursor
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx
call video_alloc
mov edi, [.hcursor]
mov [edi+CURSOR.base], eax mov [edi+CURSOR.base], eax
mov esi, [src] mov esi, [.src]
mov ebx, [flags] mov ebx, [.flags]
cmp bx, LOAD_INDIRECT cmp bx, LOAD_INDIRECT
je .indirect je .indirect
@ -476,8 +489,9 @@ proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword
mov [edi+CURSOR.hot_y], edx mov [edi+CURSOR.hot_y], edx
stdcall ati_init_cursor, eax, esi stdcall ati_init_cursor, eax, esi
mov eax, [hcursor] mov eax, [.hcursor]
.fail: .fail:
add esp, 12
ret ret
.indirect: .indirect:
shr ebx, 16 shr ebx, 16
@ -486,14 +500,15 @@ proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword
mov [edi+CURSOR.hot_x], ecx mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx mov [edi+CURSOR.hot_y], edx
xchg edi, eax mov edi, eax
push edi mov ebx, eax
mov ecx, 64*64 mov ecx, 64*64
xor eax,eax xor eax,eax
cld
rep stosd rep stosd
mov edi, ebx
mov esi, [src] mov esi, [.src]
pop edi
mov ebx, 32 mov ebx, 32
cld cld
@@: @@:
@ -502,9 +517,20 @@ proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword
add edi, 128 add edi, 128
dec ebx dec ebx
jnz @B jnz @B
mov eax, [hcursor] mov eax, [.hcursor]
add esp, 12
ret
align 4
destroy_cursor:
push eax
mov eax, [eax+CURSOR.base]
call video_free
pop eax
call DestroyObject
ret ret
endp
align 4 align 4
proc ati_init_cursor stdcall, dst:dword, src:dword proc ati_init_cursor stdcall, dst:dword, src:dword
@ -955,7 +981,7 @@ devices dd (R8500 shl 16)+VID_ATI
dd (R9800XT shl 16)+VID_ATI dd (R9800XT shl 16)+VID_ATI
dd 0 ;terminator dd 0 ;terminator
version dd 0x00010001 version dd 0x00020002
sz_ati_srv db 'HWCURSOR',0 sz_ati_srv db 'HWCURSOR',0
@ -970,7 +996,6 @@ section '.data' data readable writable align 16
pCursor db 4096 dup(?) pCursor db 4096 dup(?)
cursors rb CURSOR_SIZE*64
cursor_map rd 2 cursor_map rd 2
cursor_start rd 1 cursor_start rd 1
cursor_end rd 1 cursor_end rd 1

View File

@ -17,6 +17,7 @@ format MS COFF
include 'proc32.inc' include 'proc32.inc'
include 'main.inc' include 'main.inc'
include 'imports.inc'
DEBUG equ 1 DEBUG equ 1
@ -30,25 +31,6 @@ public START
public service_proc public service_proc
public version public version
extrn AttachIntHandler
extrn SysMsgBoardStr
extrn PciApi
extrn PciRead32
extrn PciRead8
extrn PciWrite8
extrn AllocKernelSpace
extrn MapPage
extrn RegService
extrn KernelAlloc
extrn KernelFree
extrn GetPgAddr
extrn GetCurrentTask
extrn GetService
extrn ServiceHandler
extrn FpuSave
extrn FpuRestore
extrn SendEvent
SND_CREATE_BUFF equ 2 SND_CREATE_BUFF equ 2
SND_PLAY equ 3 SND_PLAY equ 3
SND_STOP equ 4 SND_STOP equ 4
@ -212,13 +194,17 @@ proc CreateBuffer stdcall, format:dword
mov edi, [str] mov edi, [str]
mov [edi+STREAM.base], eax mov [edi+STREAM.base], eax
mov [edi+STREAM.seg_0], eax
mov [edi+STREAM.curr_seg], eax mov [edi+STREAM.curr_seg], eax
mov [edi+STREAM.notify_off1], eax mov [edi+STREAM.notify_off1], eax
add eax, 0x8000 add eax, 0x7FFF
mov [edi+STREAM.lim_0], eax
inc eax
mov [edi+STREAM.seg_1], eax
mov [edi+STREAM.notify_off2], eax mov [edi+STREAM.notify_off2], eax
add eax, 0x7FFF add eax, 0x7FFF
mov [edi+STREAM.limit], eax mov [edi+STREAM.limit], eax
mov [edi+STREAM.lim_1], eax
inc eax inc eax
mov [edi+STREAM.work_buff], eax mov [edi+STREAM.work_buff], eax
@ -266,7 +252,6 @@ proc CreateBuffer stdcall, format:dword
mov eax, [str] mov eax, [str]
ret ret
.fail: .fail:
xor eax, eax xor eax, eax
ret ret
@ -367,7 +352,7 @@ proc play_buffer stdcall, str:dword
mov [ebx+STREAM.work_write], eax mov [ebx+STREAM.work_write], eax
mov [ebx+STREAM.work_count], 0 mov [ebx+STREAM.work_count], 0
mov eax, [ebx+STREAM.base] mov eax, [ebx+STREAM.seg_0]
mov [ebx+STREAM.curr_seg], eax mov [ebx+STREAM.curr_seg], eax
mov esi, [ebx+STREAM.curr_seg] mov esi, [ebx+STREAM.curr_seg]
@ -520,6 +505,7 @@ proc free_stream
ret ret
endp endp
if 0
align 4 align 4
proc check_stream proc check_stream
@ -529,18 +515,22 @@ proc check_stream
mov esi, [play_list+edx] mov esi, [play_list+edx]
mov eax, [esi+STR.curr_seg] mov eax, [esi+STR.curr_seg]
cmp eax, [esi+STR.limit] cmp eax, [esi+STR.lim_0]
jb .next jb .next
.m1: mov eax, [esi+STREAM.seg_0]
mov eax,[esi+STR.base] mov ecx, [esi+STREAM.lim_0]
xchg eax, [ebx+STREAM.seg_1]
xchg ecx, [ebx+STREAM.lim_1]
mov [esi+STREAM.seg_0], eax
mov [esi+STREAM.lim_0], ecx
mov [esi+STR.curr_seg], eax mov [esi+STR.curr_seg], eax
.next: .next:
add edx, 4 add edx, 4
loop .l1 loop .l1
ret ret
endp endp
end if
align 4 align 4
proc prepare_playlist proc prepare_playlist
@ -733,7 +723,7 @@ mm80 dq 0x8080808080808080
mm_mask dq 0xFF00FF00FF00FF00 mm_mask dq 0xFF00FF00FF00FF00
stream_map dd 0xFFFF ; 16 stream_map dd 0xFFFF ; 16
version dd 0x00010001 version dd 0x00020002
szInfinity db 'INFINITY',0 szInfinity db 'INFINITY',0
szSound db 'SOUND',0 szSound db 'SOUND',0

View File

@ -98,8 +98,13 @@ struc STREAM
.r_silence dd 0 .r_silence dd 0
.base dd 0 .base dd 0
.curr_seg dd 0
.limit dd 0 .limit dd 0
.seg_0 dd 0
.lim_0 dd 0
.seg_1 dd 0
.lim_1 dd 0
.curr_seg dd 0
.buff_size dd 0 .buff_size dd 0
.notify_off1 dd 0 .notify_off1 dd 0
.notify_off2 dd 0 .notify_off2 dd 0
@ -107,7 +112,7 @@ struc STREAM
.resample dd 0 .resample dd 0
} }
STREAM_SIZE equ 23*4 STREAM_SIZE equ 27*4
virtual at 0 virtual at 0
STREAM STREAM STREAM STREAM

View File

@ -106,7 +106,6 @@ proc new_mix stdcall, output:dword
ret ret
endp endp
align 4 align 4
proc update_stream proc update_stream
locals locals
@ -141,7 +140,6 @@ proc update_stream
inc [stream_index] inc [stream_index]
dec [play_count] dec [play_count]
jnz .l1 jnz .l1
ret ret
.copy: .copy:
mov ebx, esi mov ebx, esi
@ -158,10 +156,15 @@ proc update_stream
mov [ebx+STREAM.work_write], edi mov [ebx+STREAM.work_write], edi
cmp esi, [ebx+STREAM.limit] cmp esi, [ebx+STREAM.lim_0]
jb @f jb @f
mov esi, [ebx+STREAM.base] mov esi, [ebx+STREAM.seg_0]
mov eax, [ebx+STREAM.lim_0]
xchg esi, [ebx+STREAM.seg_1]
xchg eax, [ebx+STREAM.lim_1]
mov [ebx+STREAM.seg_0], esi
mov [ebx+STREAM.lim_0], eax
@@: @@:
mov [ebx+STREAM.curr_seg], esi mov [ebx+STREAM.curr_seg], esi
@ -176,7 +179,6 @@ proc update_stream
inc [stream_index] inc [stream_index]
dec [play_count] dec [play_count]
jnz .l1 jnz .l1
ret ret
@@: @@:
mov [ev_code], 0xFF000001 mov [ev_code], 0xFF000001
@ -233,9 +235,15 @@ proc refill stdcall, str:dword
mov eax, [ebx+STREAM.curr_seg] mov eax, [ebx+STREAM.curr_seg]
add eax, [ebx+STREAM.r_size] add eax, [ebx+STREAM.r_size]
cmp eax, [ebx+STREAM.limit] cmp eax, [ebx+STREAM.lim_0]
jb @f jb @f
mov eax, [ebx+STREAM.base]
mov eax, [ebx+STREAM.seg_0]
mov ecx, [ebx+STREAM.lim_0]
xchg eax, [ebx+STREAM.seg_1]
xchg ecx, [ebx+STREAM.lim_1]
mov [ebx+STREAM.seg_0], eax
mov [ebx+STREAM.lim_0], ecx
@@: @@:
mov [ebx+STREAM.curr_seg], eax mov [ebx+STREAM.curr_seg], eax
@ -246,7 +254,6 @@ proc refill stdcall, str:dword
mov ecx,0x8000 mov ecx,0x8000
cmp eax, [ebx+STREAM.notify_off1] cmp eax, [ebx+STREAM.notify_off1]
je @f je @f
ret ret
@@: @@:
mov [ev_code], 0xFF000001 mov [ev_code], 0xFF000001
@ -603,7 +610,6 @@ align 4
proc s8_stereo stdcall, dest:dword,src:dword,r_buff:dword,\ proc s8_stereo stdcall, dest:dword,src:dword,r_buff:dword,\
r_dt:dword, r_size:dword,r_end:dword r_dt:dword, r_size:dword,r_end:dword
mov esi, [src] mov esi, [src]
mov edi, [dest] mov edi, [dest]
mov ecx, [r_size] mov ecx, [r_size]
@ -1016,31 +1022,26 @@ proc mix_2_1_mmx stdcall, output:dword, str0:dword, str1:dword
movq mm3, [eax+88] movq mm3, [eax+88]
paddsw mm3, [ecx+88] paddsw mm3, [ecx+88]
; psraw mm3, 1 ; psraw mm3, 1
movq [edx+88], mm3 movq [edx+88], mm3
movq mm0, [eax+96] movq mm0, [eax+96]
paddsw mm0, [ecx+96] paddsw mm0, [ecx+96]
; psraw mm0, 1 ; psraw mm0, 1
movq [edx+96], mm0 movq [edx+96], mm0
movq mm1, [eax+104] movq mm1, [eax+104]
paddsw mm1, [ecx+104] paddsw mm1, [ecx+104]
; psraw mm1, 1 ; psraw mm1, 1
movq [edx+104], mm1 movq [edx+104], mm1
movq mm2, [eax+112] movq mm2, [eax+112]
paddsw mm2, [ecx+112] paddsw mm2, [ecx+112]
; psraw mm2, 1 ; psraw mm2, 1
movq [edx+112], mm2 movq [edx+112], mm2
movq mm3, [eax+120] movq mm3, [eax+120]
paddsw mm3, [ecx+120] paddsw mm3, [ecx+120]
; psraw mm3, 1 ; psraw mm3, 1
movq [edx+120], mm3 movq [edx+120], mm3
ret ret

View File

@ -4,7 +4,7 @@
format MS COFF format MS COFF
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc'
OS_BASE equ 0; OS_BASE equ 0;
new_app_base equ 0x60400000 new_app_base equ 0x60400000
@ -27,24 +27,6 @@ public START
public service_proc public service_proc
public version public version
extrn AttachIntHandler
extrn SysMsgBoardStr
extrn PciApi
extrn PciRead32
extrn PciRead8
extrn PciWrite8
extrn AllocKernelSpace
extrn KernelAlloc
extrn MapPage
extrn GetPgAddr
extrn RegService
extrn ServiceHandler
extrn SetHwCursor
extrn LFBAddress
extrn LoadFile
extrn FpuSave
extrn FpuRestore
DEBUG equ 1 DEBUG equ 1
DRV_ENTRY equ 1 DRV_ENTRY equ 1
@ -161,7 +143,7 @@ align 4
devices dd (DEVICE_ID shl 16)+VENDOR_ID devices dd (DEVICE_ID shl 16)+VENDOR_ID
dd 0 ;terminator dd 0 ;terminator
version dd 0x00010001 version dd 0x00020002
my_service db 'MY_SERVICE',0 ;max 16 chars include zero my_service db 'MY_SERVICE',0 ;max 16 chars include zero

View File

@ -1,8 +1,8 @@
format MS COFF format MS COFF
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc'
DEBUG equ 1 DEBUG equ 1
@ -251,19 +251,6 @@ public START
public service_proc public service_proc
public version public version
extrn AttachIntHandler
extrn SysMsgBoardStr
extrn PciApi
extrn PciRead32
extrn PciRead8
extrn PciWrite8
extrn AllocKernelSpace
extrn MapPage
extrn RegService
extrn KernelAlloc
extrn GetPgAddr
extrn GetCurrentTask
section '.flat' code readable align 16 section '.flat' code readable align 16
proc START stdcall, state:dword proc START stdcall, state:dword
@ -1143,7 +1130,7 @@ align 4
devices dd (CTRL_SIS shl 16)+VID_SIS,msg_AC, set_SIS devices dd (CTRL_SIS shl 16)+VID_SIS,msg_AC, set_SIS
dd 0 dd 0
version dd 0x00010001 version dd 0x00020002
msg_AC db '7012 AC97 controller',13,10, 0 msg_AC db '7012 AC97 controller',13,10, 0
msg_SIS db 'Silicon Integrated Systems',13,10, 0 msg_SIS db 'Silicon Integrated Systems',13,10, 0

View File

@ -3,6 +3,7 @@ format MS COFF
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc'
DEBUG equ 1 DEBUG equ 1
@ -277,19 +278,6 @@ public START
public service_proc public service_proc
public version public version
extrn AttachIntHandler
extrn SysMsgBoardStr
extrn PciApi
extrn PciRead32
extrn PciRead8
extrn PciWrite8
extrn AllocKernelSpace
extrn MapPage
extrn RegService
extrn KernelAlloc
extrn GetPgAddr
extrn GetCurrentTask
section '.flat' code readable align 16 section '.flat' code readable align 16
proc START stdcall, state:dword proc START stdcall, state:dword
@ -1363,7 +1351,7 @@ devices dd (CTRL_ICH shl 16)+VID_INTEL,msg_ICH, set_ICH
dd 0 ;terminator dd 0 ;terminator
version dd 0x00010001 version dd 0x00020002
msg_ICH db 'Intel ICH', 13,10, 0 msg_ICH db 'Intel ICH', 13,10, 0
msg_ICH0 db 'Intel ICH0', 13,10, 0 msg_ICH0 db 'Intel ICH0', 13,10, 0

View File

@ -106,8 +106,8 @@ save_draw_mouse:
cmp [ecx+CURSOR.magic], 'CURS' cmp [ecx+CURSOR.magic], 'CURS'
jne .fail jne .fail
cmp [ecx+CURSOR.size], CURSOR_SIZE ; cmp [ecx+CURSOR.size], CURSOR_SIZE
jne .fail ; jne .fail
push ecx push ecx
call [set_hw_cursor] call [set_hw_cursor]
popad popad

View File

@ -438,15 +438,6 @@ B32:
call init_events call init_events
; mov [dll_map], 0xFFFFFFFF
; mov [srv_map], 0xFFFFFFFF
; call alloc_dll
; mov edi, eax
; mov esi, szKernel
; mov ecx, 16
; rep movsb
mov eax, srv.fd-SRV_FD_OFFSET mov eax, srv.fd-SRV_FD_OFFSET
mov [srv.fd], eax mov [srv.fd], eax
mov [srv.bk], eax mov [srv.bk], eax
@ -557,7 +548,6 @@ include 'vmodeld.inc'
call setmouse call setmouse
mov [pci_access_enabled],1 mov [pci_access_enabled],1
call init_cursors
; SET PRELIMINARY WINDOW STACK AND POSITIONS ; SET PRELIMINARY WINDOW STACK AND POSITIONS
@ -594,14 +584,19 @@ include 'vmodeld.inc'
mov dword [0x80000+APPDATA.sse_handler], 0 mov dword [0x80000+APPDATA.sse_handler], 0
; name for OS/IDLE process ; name for OS/IDLE process
mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I' mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I'
mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE ' mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
mov ebx, [def_cursor] mov ebx, [def_cursor]
mov dword [0x80000+256+APPDATA.cursor], ebx mov dword [0x80000+256+APPDATA.cursor], ebx
mov dword [0x80000+256+APPDATA.fpu_handler], 0 mov dword [0x80000+256+APPDATA.fpu_handler], 0
mov dword [0x80000+256+APPDATA.sse_handler], 0 mov dword [0x80000+256+APPDATA.sse_handler], 0
mov ebx, PROC_BASE+256+APP_OBJ_OFFSET
mov dword [0x80000+256+APPDATA.fd_obj], ebx
mov dword [0x80000+256+APPDATA.bk_obj], ebx
;set fpu save area ;set fpu save area
mov esi, eax mov esi, eax
bt [cpu_caps], CAPS_SSE bt [cpu_caps], CAPS_SSE
@ -646,6 +641,9 @@ include 'vmodeld.inc'
mov ax,tss0 mov ax,tss0
ltr ax ltr ax
call init_cursors
; READ TSC / SECOND ; READ TSC / SECOND
mov esi,boot_tsc mov esi,boot_tsc

View File

@ -182,8 +182,10 @@ struc APPDATA
.cursor dd ? ;+44 .cursor dd ? ;+44
.ev_first dd ? ;+48 .ev_first dd ? ;+48
.ev_last dd ? ;+52 .ev_last dd ? ;+52
.fd_obj dd ? ;+56
.bk_obj dd ? ;+60
db 72 dup(?) ;+56 db 64 dup(?) ;+64
.wnd_shape dd ? ;+128 .wnd_shape dd ? ;+128
.wnd_shape_scale dd ? ;+132 .wnd_shape_scale dd ? ;+132

View File

@ -270,87 +270,20 @@ alloc_cursor:
xor ebx, ebx xor ebx, ebx
mov [eax+CURSOR.magic], 'CURS' mov [eax+CURSOR.magic], 'CURS'
mov [eax+CURSOR.size], CURSOR_SIZE ; mov [eax+CURSOR.destructor], CURSOR_SIZE
mov [eax+CURSOR.pid], ebx mov [eax+CURSOR.pid], ebx
mov [eax+CURSOR.hot_x], ebx mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx mov [eax+CURSOR.hot_y], ebx
.fail: .fail:
ret ret
if 0
align 4
proc alloc_cursor
pushfd
cli
mov ebx, [cursor_start]
mov ecx, [cursor_end]
.l1:
bsf eax,[ebx];
jnz .found
add ebx,4
cmp ebx, ecx
jb .l1
popfd
xor eax,eax
ret
.found:
btr [ebx], eax
popfd
mov [cursor_start],ebx
sub ebx, cursor_map
lea eax,[eax+ebx*8]
shl eax,3
lea eax,[cursors+eax+eax*2]
xor ebx, ebx
mov [eax+CURSOR.magic], 'CURS'
mov [eax+CURSOR.size], CURSOR_SIZE
mov [eax+CURSOR.pid], ebx
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx
ret
endp
align 4
proc free_cursor
pushfd
cli
xor edx, edx
mov ecx, CURSOR_SIZE
sub eax, cursors
div ecx
test edx, edx
jnz .exit
mov ebx, cursor_map
bts [ebx], eax
shr eax, 3
and eax, not 3
add eax, ebx
cmp [cursor_start], eax
ja @f
.exit:
popfd
ret
@@:
mov [cursor_start], eax
popfd
ret
endp
end if
align 4 align 4
proc set_cursor stdcall, hcursor:dword proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor] mov eax, [hcursor]
cmp [eax+CURSOR.magic], 'CURS' cmp [eax+CURSOR.magic], 'CURS'
jne .fail jne .fail
cmp [eax+CURSOR.size], CURSOR_SIZE ; cmp [eax+CURSOR.size], CURSOR_SIZE
jne .fail ; jne .fail
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
shl ebx, 8 shl ebx, 8
xchg eax, [ebx+PROC_BASE+APPDATA.cursor] xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
@ -363,17 +296,43 @@ proc set_cursor stdcall, hcursor:dword
ret ret
endp endp
proc vesa_cursor stdcall, hcursor:dword, src:dword, flags:dword ; param
; eax= pid
; ebx= src
; ecx= flags
vesa_cursor:
.src equ esp
.flags equ esp+4
.hcursor equ esp+8
sub esp, 4 ;space for .hcursor
push ecx
push ebx
mov ebx, eax
mov eax, CURSOR_SIZE
call create_kernel_object
test eax, eax
jz .fail
mov [.hcursor],eax
xor ebx, ebx
mov [eax+CURSOR.magic], 'CURS'
mov [eax+CURSOR.destroy], destroy_cursor
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx
stdcall kernel_alloc, 0x1000 stdcall kernel_alloc, 0x1000
test eax, eax test eax, eax
jz .fail jz .fail
mov edi, [hcursor] mov edi, [.hcursor]
mov [edi+CURSOR.base], eax mov [edi+CURSOR.base], eax
mov esi, [src] mov esi, [.src]
mov ebx, [flags] mov ebx, [.flags]
cmp bx, LOAD_INDIRECT cmp bx, LOAD_INDIRECT
je .indirect je .indirect
@ -383,8 +342,9 @@ proc vesa_cursor stdcall, hcursor:dword, src:dword, flags:dword
mov [edi+CURSOR.hot_y], edx mov [edi+CURSOR.hot_y], edx
stdcall vesa_init_cursor, eax, esi stdcall vesa_init_cursor, eax, esi
mov eax, [hcursor] mov eax, [.hcursor]
.fail: .fail:
add esp, 12
ret ret
.indirect: .indirect:
shr ebx, 16 shr ebx, 16
@ -397,8 +357,8 @@ proc vesa_cursor stdcall, hcursor:dword, src:dword, flags:dword
mov ecx, 1024 mov ecx, 1024
cld cld
rep movsd rep movsd
add esp, 12
ret ret
endp
align 4 align 4
proc load_cursor stdcall, src:dword, flags:dword proc load_cursor stdcall, src:dword, flags:dword
@ -416,16 +376,12 @@ proc load_cursor stdcall, src:dword, flags:dword
jz .exit jz .exit
mov [src], eax mov [src], eax
@@: @@:
call alloc_cursor mov eax, [CURRENT_TASK]
test eax, eax shl eax, 5
jz .fail mov eax, [0x3000+eax+4]
mov ebx, [src]
mov ebx, [CURRENT_TASK] mov ecx, [flags]
shl ebx, 5 call [create_cursor] ;eax, ebx, ecx
mov ebx, [0x3000+ebx+4]
mov [eax+CURSOR.pid], ebx
stdcall [create_cursor], eax, [src], [flags]
mov [handle], eax mov [handle], eax
.fail: .fail:
cmp word [flags], LOAD_FROM_FILE cmp word [flags], LOAD_FROM_FILE
@ -450,8 +406,8 @@ proc delete_cursor stdcall, hcursor:dword
mov esi, [hcursor] mov esi, [hcursor]
cmp [esi+CURSOR.magic], 'CURS' cmp [esi+CURSOR.magic], 'CURS'
jne .fail jne .fail
cmp [esi+CURSOR.size], CURSOR_SIZE ; cmp [esi+CURSOR.size], CURSOR_SIZE
jne .fail ; jne .fail
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
shl ebx, 5 shl ebx, 5
@ -466,31 +422,51 @@ proc delete_cursor stdcall, hcursor:dword
mov eax, [def_cursor] mov eax, [def_cursor]
mov [ebx+PROC_BASE+APPDATA.cursor], eax mov [ebx+PROC_BASE+APPDATA.cursor], eax
@@: @@:
mov eax, [hw_cursor]
test eax, eax
jz @F
xor ebx, ebx
mov ecx, [esi+CURSOR.base]
mov [hsrv], eax
mov [io_code], VIDEO_FREE
mov [input], ecx
mov [inp_size], 4
mov [output], ebx
mov [out_size], ebx
lea eax, [hsrv]
stdcall srv_handler, eax
jmp .exit
@@:
stdcall kernel_free, [esi+CURSOR.base]
.exit:
mov eax, [hcursor] mov eax, [hcursor]
call free call [eax+APPOBJ.destroy]
.fail: .fail:
ret ret
;@@:
; mov eax, [hw_cursor]
; test eax, eax
; jz @F
; xor ebx, ebx
; mov ecx, [esi+CURSOR.base]
; mov [hsrv], eax
; mov [io_code], VIDEO_FREE
; mov [input], ecx
; mov [inp_size], 4
; mov [output], ebx
; mov [out_size], ebx
; lea eax, [hsrv]
; stdcall srv_handler, eax
; jmp .exit
;@@:
; stdcall kernel_free, [esi+CURSOR.base]
;.exit:
; mov eax, [hcursor]
; call destroy_kernel_object
;.fail:
; ret
endp endp
; param
; eax= cursor
align 4
destroy_cursor:
push eax
stdcall kernel_free, [eax+CURSOR.base]
pop eax
call destroy_kernel_object
ret
align 4 align 4
proc init_cursors proc init_cursors
cmp [0xfe0c],word 0x13 cmp [0xfe0c],word 0x13
@ -509,21 +485,6 @@ proc init_cursors
.init: .init:
mov [cur_def_interl], ebx mov [cur_def_interl], ebx
if 0
xor eax, eax
mov edi, cursors
mov ecx, CURSOR_SIZE*16
cld
rep stosd
not eax
mov [cursor_map], eax
mov [cursor_map+4], eax
mov edx, cursor_map
mov [cursor_start], edx
add edx, 8
mov [cursor_end], edx
end if
stdcall load_driver, drv_hw_mouse stdcall load_driver, drv_hw_mouse
mov [hw_cursor], eax mov [hw_cursor], eax
test eax, eax test eax, eax