Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 280 → Rev 281

/kernel/trunk/const.inc
312,12 → 312,32
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
{ .magic dd ?
.size dd ?
.pid dd ?
.base dd ?
.hot_x dd ?
{;common object header
.magic dd ? ;'CURS'
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
 
;cursor data
.base dd ? ;allocated memory
.hot_x dd ? ;hotspot coords
.hot_y dd ?
}
virtual at 0
324,7 → 344,7
CURSOR CURSOR
end virtual
 
CURSOR_SIZE equ 24
CURSOR_SIZE equ 32
 
struc BOOT_DATA
{ .bpp dd ?
/kernel/trunk/core/dll.inc
1,8 → 1,8
 
DRV_ENTRY equ 1
DRV_EXIT equ -1
DRV_COMPAT equ 1 ;minimal required drivers version
DRV_CURRENT equ 1 ;current drivers model version
DRV_COMPAT equ 2 ;minimal required drivers version
DRV_CURRENT equ 2 ;current drivers model version
 
DRV_VERSION equ (DRV_COMPAT shl 16) or DRV_CURRENT
 
371,10 → 371,10
 
mov ecx, [.handler]
mov [eax+SRV.srv_proc], ecx
ret
ret 8
.fail:
xor eax, eax
ret
ret 8
 
align 4
proc get_proc stdcall, exp:dword, sz_name:dword
965,7 → 965,6
ret
endp
 
 
align 4
proc stop_all_services
 
987,7 → 986,55
ret
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_infinity db '/rd/1/drivers/infinity.obj', 0
drv_hw_mouse db '/rd/1/drivers/ati2d.obj',0
/kernel/trunk/core/exports.inc
2,54 → 2,94
iglobal
szKernel db 'KERNEL', 0
szVersion db 'version',0
 
szRegService db 'RegService',0
szGetService db 'GetService',0
szServiceHandler db 'ServiceHandler',0
szAttachIntHandler db 'AttachIntHandler',0
szSysMsgBoardStr db 'SysMsgBoardStr', 0
szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0
 
szPciApi db 'PciApi', 0
szPciRead32 db 'PciRead32', 0
szPciRead8 db 'PciRead8', 0
szPciWrite8 db 'PciWrite8',0
 
szAllocPage db 'AllocPage',0
szAllocPages db 'AllocPages',0
szFreePage db 'FreePage',0
szGetPgAddr db 'GetPgAddr',0
szMapPage db 'MapPage',0
szMapSpace db 'MapSpace',0
szCommitPages db 'CommitPages',0
szReleasePages db 'ReleasePages',0
 
szAllocKernelSpace db 'AllocKernelSpace',0
szMapPage db 'MapPage',0
szRegService db 'RegService',0
szFreeKernelSpace db 'FreeKernelSpace',0
szKernelAlloc db 'KernelAlloc',0
szKernelFree db 'KernelFree',0
szGetPgAddr db 'GetPgAddr',0
szGetCurrentTask db 'GetCurrentTask',0
szGetService db 'GetService',0
szServiceHandler db 'ServiceHandler',0
szFpuSave db 'FpuSave',0
szFpuRestore db 'FpuRestore',0
szUserAlloc db 'UserAlloc',0
szUserFree db 'UserFree',0
szKmalloc db 'Kmalloc',0
szKfree db 'Kfree',0
 
szCreateObject db 'CreateObject',0
szDestroyObject db 'DestroyObject',0
 
szLoadCursor db 'LoadCursor',0
szSetHwCursor db 'SetHwCursor',0
szHwCursorRestore db 'HwCursorRestore', 0
szHwCursorCreate db 'HwCursorCreate', 0
 
szSysMsgBoardStr db 'SysMsgBoardStr', 0
szGetCurrentTask db 'GetCurrentTask',0
szLFBAddress db 'LFBAddress',0
szLoadFile db 'LoadFile',0
szSendEvent db 'SendEvent',0
 
 
align 16
kernel_export:
dd szRegService , reg_service
dd szGetService , get_service
dd szServiceHandler , srv_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 szPciRead32 , pci_read32
dd szPciRead8 , pci_read8
dd szPciWrite8 , pci_write8
 
dd szAllocPage , alloc_page
dd szAllocPages , alloc_pages
dd szFreePage , free_page
dd szMapPage , map_page
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 szMapPage , map_page
dd szRegService , reg_service
dd szFreeKernelSpace , free_kernel_space
dd szKernelAlloc , kernel_alloc
dd szKernelFree , kernel_free
dd szGetPgAddr , get_pg_addr
dd szGetCurrentTask , get_curr_task
dd szGetService , get_service
dd szServiceHandler , srv_handler
dd szFpuSave , fpu_save
dd szFpuRestore , fpu_restore
dd szUserAlloc , user_alloc
dd szUserFree , user_free
dd szKmalloc , malloc
dd szKfree , free
 
dd szCreateObject , create_kernel_object
dd szDestroyObject , destroy_kernel_object
 
dd szLoadCursor , load_cursor
dd szSetHwCursor , set_hw_cursor
dd szHwCursorRestore , hw_restore
dd szHwCursorCreate , create_cursor
 
dd szSysMsgBoardStr , sys_msg_board_str
dd szGetCurrentTask , get_curr_task
dd szLoadFile , load_file
dd szSendEvent , send_event
exp_lfb:
/kernel/trunk/core/heap.inc
578,7 → 578,7
and [heap_mutex], 0
 
mov ecx, [esi+block_size];
 
shr ecx, 12
call release_pages ;eax, ecx
stdcall free_kernel_space, [base]
ret
643,7 → 643,6
mov edi, dword [ebx+PROC_BASE+APPDATA.heap_top]; heap_top
add esi, new_app_base
add edi, new_app_base
 
l_0:
cmp esi, edi
jae m_exit
/kernel/trunk/core/memory.inc
243,6 → 243,13
endp
 
align 4
map_space: ;not implemented
 
 
ret
 
 
align 4
proc free_page
;arg: eax page address
pushfd
265,8 → 272,19
endp
 
; param
; ecx= size
; eax= page base
; ebx= liear address
; ecx= count
 
align 4
commit_pages: ;not implemented
 
 
ret
 
; param
; eax= base
; ecx= count
 
align 4
release_pages:
274,7 → 292,6
mov ebx, pg_data.pg_mutex
call wait_mutex ;ebx
 
shr ecx, 12
mov esi, eax
mov edi, eax
 
/kernel/trunk/core/taskman.inc
1002,6 → 1002,10
inc dword [TASK_COUNT] ;update number of processes
.noinc:
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 [PROC_BASE+APPDATA.cursor+ebx],ecx
 
1014,11 → 1018,14
mov edx,[edx] ;app_cmdline
test edx,edx
jz @F ;application don't need parameters
 
mov eax, edx
add eax, 256
jc @f
 
cmp eax, [PROC_BASE+APPDATA.mem_size+ebx*8]
ja @f
 
add edx, new_app_base
stdcall k_strncpy, edx, [cmd_line], 256
@@:
/kernel/trunk/drivers/ati2d.asm
2,6 → 2,7
format MS COFF
 
include 'proc32.inc'
include 'imports.inc'
 
DEBUG equ 1
 
33,11 → 34,16
end virtual
 
struc CURSOR
{ .magic dd ?
.size dd ?
.pid dd ?
.base dd ?
.hot_x dd ?
{;common object header
.magic dd ? ;'CURS'
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
 
;cursor data
.base dd ? ;allocated memory
.hot_x dd ? ;hotspot coords
.hot_y dd ?
}
virtual at 0
44,7 → 50,7
CURSOR CURSOR
end virtual
 
CURSOR_SIZE equ 24
CURSOR_SIZE equ 32
 
R8500 equ 0x514C ;R200
R9000 equ 0x4966 ;RV250
155,18 → 161,6
public service_proc
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
 
DRV_ENTRY equ 1
192,18 → 186,12
test eax, eax
jz .fail
 
xor eax, eax
mov edi, cursors
mov ecx, CURSOR_SIZE*16
cld
rep stosd
 
not eax
or eax, -1
mov [cursor_map], eax
mov [cursor_map+4], eax
mov edx, cursor_map
mov [cursor_start], edx
add edx, 4
add edx, 8
mov [cursor_end], edx
 
stdcall RegService, sz_ati_srv, service_proc
457,16 → 445,41
popfd
ret
 
; param
; eax= pid
; ebx= src
; ecx= flags
 
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 esi, [src]
mov ebx, [flags]
mov esi, [.src]
mov ebx, [.flags]
cmp bx, LOAD_INDIRECT
je .indirect
 
476,8 → 489,9
mov [edi+CURSOR.hot_y], edx
 
stdcall ati_init_cursor, eax, esi
mov eax, [hcursor]
mov eax, [.hcursor]
.fail:
add esp, 12
ret
.indirect:
shr ebx, 16
486,14 → 500,15
mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx
 
xchg edi, eax
push edi
mov edi, eax
mov ebx, eax
mov ecx, 64*64
xor eax,eax
cld
rep stosd
mov edi, ebx
 
mov esi, [src]
pop edi
mov esi, [.src]
mov ebx, 32
cld
@@:
502,11 → 517,22
add edi, 128
dec ebx
jnz @B
mov eax, [hcursor]
mov eax, [.hcursor]
add esp, 12
ret
endp
 
align 4
destroy_cursor:
 
push eax
mov eax, [eax+CURSOR.base]
call video_free
pop eax
 
call DestroyObject
ret
 
align 4
proc ati_init_cursor stdcall, dst:dword, src:dword
locals
rBase dd ?
955,7 → 981,7
dd (R9800XT shl 16)+VID_ATI
dd 0 ;terminator
 
version dd 0x00010001
version dd 0x00020002
 
sz_ati_srv db 'HWCURSOR',0
 
970,7 → 996,6
 
pCursor db 4096 dup(?)
 
cursors rb CURSOR_SIZE*64
cursor_map rd 2
cursor_start rd 1
cursor_end rd 1
/kernel/trunk/drivers/infinity.asm
17,6 → 17,7
 
include 'proc32.inc'
include 'main.inc'
include 'imports.inc'
 
DEBUG equ 1
 
30,25 → 31,6
public service_proc
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_PLAY equ 3
SND_STOP equ 4
212,13 → 194,17
 
mov edi, [str]
mov [edi+STREAM.base], eax
mov [edi+STREAM.seg_0], eax
mov [edi+STREAM.curr_seg], 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
add eax, 0x7FFF
mov [edi+STREAM.limit], eax
 
mov [edi+STREAM.lim_1], eax
inc eax
 
mov [edi+STREAM.work_buff], eax
266,7 → 252,6
 
mov eax, [str]
ret
 
.fail:
xor eax, eax
ret
367,7 → 352,7
mov [ebx+STREAM.work_write], eax
mov [ebx+STREAM.work_count], 0
 
mov eax, [ebx+STREAM.base]
mov eax, [ebx+STREAM.seg_0]
mov [ebx+STREAM.curr_seg], eax
 
mov esi, [ebx+STREAM.curr_seg]
520,6 → 505,7
ret
endp
 
if 0
align 4
proc check_stream
 
529,11 → 515,15
mov esi, [play_list+edx]
 
mov eax, [esi+STR.curr_seg]
cmp eax, [esi+STR.limit]
cmp eax, [esi+STR.lim_0]
jb .next
 
.m1:
mov eax,[esi+STR.base]
mov eax, [esi+STREAM.seg_0]
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
.next:
add edx, 4
540,8 → 530,8
loop .l1
ret
endp
end if
 
 
align 4
proc prepare_playlist
 
733,7 → 723,7
mm_mask dq 0xFF00FF00FF00FF00
 
stream_map dd 0xFFFF ; 16
version dd 0x00010001
version dd 0x00020002
 
szInfinity db 'INFINITY',0
szSound db 'SOUND',0
/kernel/trunk/drivers/main.inc
98,8 → 98,13
.r_silence dd 0
 
.base 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
.limit dd 0
 
.buff_size dd 0
.notify_off1 dd 0
.notify_off2 dd 0
107,7 → 112,7
.resample dd 0
}
 
STREAM_SIZE equ 23*4
STREAM_SIZE equ 27*4
 
virtual at 0
STREAM STREAM
/kernel/trunk/drivers/mixer.asm
106,7 → 106,6
ret
endp
 
 
align 4
proc update_stream
locals
141,7 → 140,6
inc [stream_index]
dec [play_count]
jnz .l1
 
ret
.copy:
mov ebx, esi
158,10 → 156,15
 
mov [ebx+STREAM.work_write], edi
 
cmp esi, [ebx+STREAM.limit]
cmp esi, [ebx+STREAM.lim_0]
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
 
176,7 → 179,6
inc [stream_index]
dec [play_count]
jnz .l1
 
ret
@@:
mov [ev_code], 0xFF000001
233,9 → 235,15
 
mov eax, [ebx+STREAM.curr_seg]
add eax, [ebx+STREAM.r_size]
cmp eax, [ebx+STREAM.limit]
cmp eax, [ebx+STREAM.lim_0]
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
 
246,7 → 254,6
mov ecx,0x8000
cmp eax, [ebx+STREAM.notify_off1]
je @f
 
ret
@@:
mov [ev_code], 0xFF000001
603,7 → 610,6
proc s8_stereo stdcall, dest:dword,src:dword,r_buff:dword,\
r_dt:dword, r_size:dword,r_end:dword
 
 
mov esi, [src]
mov edi, [dest]
mov ecx, [r_size]
1016,31 → 1022,26
movq mm3, [eax+88]
paddsw mm3, [ecx+88]
; psraw mm3, 1
 
movq [edx+88], mm3
 
movq mm0, [eax+96]
paddsw mm0, [ecx+96]
; psraw mm0, 1
 
movq [edx+96], mm0
 
movq mm1, [eax+104]
paddsw mm1, [ecx+104]
; psraw mm1, 1
 
movq [edx+104], mm1
 
movq mm2, [eax+112]
paddsw mm2, [ecx+112]
; psraw mm2, 1
 
movq [edx+112], mm2
 
movq mm3, [eax+120]
paddsw mm3, [ecx+120]
; psraw mm3, 1
 
movq [edx+120], mm3
 
ret
/kernel/trunk/drivers/sceletone.asm
4,8 → 4,8
format MS COFF
 
include 'proc32.inc'
include 'imports.inc'
 
 
OS_BASE equ 0;
new_app_base equ 0x60400000
PROC_BASE equ OS_BASE+0x0080000
27,24 → 27,6
public service_proc
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
 
DRV_ENTRY equ 1
161,7 → 143,7
devices dd (DEVICE_ID shl 16)+VENDOR_ID
dd 0 ;terminator
 
version dd 0x00010001
version dd 0x00020002
 
my_service db 'MY_SERVICE',0 ;max 16 chars include zero
 
/kernel/trunk/drivers/sis.asm
1,8 → 1,8
 
format MS COFF
 
 
include 'proc32.inc'
include 'imports.inc'
 
DEBUG equ 1
 
251,19 → 251,6
public service_proc
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
 
proc START stdcall, state:dword
1143,7 → 1130,7
devices dd (CTRL_SIS shl 16)+VID_SIS,msg_AC, set_SIS
dd 0
 
version dd 0x00010001
version dd 0x00020002
 
msg_AC db '7012 AC97 controller',13,10, 0
msg_SIS db 'Silicon Integrated Systems',13,10, 0
/kernel/trunk/drivers/unisound.asm
3,6 → 3,7
 
 
include 'proc32.inc'
include 'imports.inc'
 
DEBUG equ 1
 
277,19 → 278,6
public service_proc
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
 
proc START stdcall, state:dword
1363,7 → 1351,7
 
dd 0 ;terminator
 
version dd 0x00010001
version dd 0x00020002
 
msg_ICH db 'Intel ICH', 13,10, 0
msg_ICH0 db 'Intel ICH0', 13,10, 0
/kernel/trunk/hid/mousedrv.inc
106,8 → 106,8
 
cmp [ecx+CURSOR.magic], 'CURS'
jne .fail
cmp [ecx+CURSOR.size], CURSOR_SIZE
jne .fail
; cmp [ecx+CURSOR.size], CURSOR_SIZE
; jne .fail
push ecx
call [set_hw_cursor]
popad
/kernel/trunk/kernel.asm
438,15 → 438,6
 
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 [srv.fd], eax
mov [srv.bk], eax
557,7 → 548,6
call setmouse
 
mov [pci_access_enabled],1
call init_cursors
 
; SET PRELIMINARY WINDOW STACK AND POSITIONS
 
594,14 → 584,19
mov dword [0x80000+APPDATA.sse_handler], 0
 
; name for OS/IDLE process
 
mov dword [0x80000+256+APPDATA.app_name], dword 'OS/I'
mov dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
mov ebx, [def_cursor]
mov dword [0x80000+256+APPDATA.cursor], ebx
 
mov dword [0x80000+256+APPDATA.fpu_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
mov esi, eax
bt [cpu_caps], CAPS_SSE
646,6 → 641,9
mov ax,tss0
ltr ax
 
call init_cursors
 
 
; READ TSC / SECOND
 
mov esi,boot_tsc
/kernel/trunk/kernel32.inc
182,8 → 182,10
.cursor dd ? ;+44
.ev_first dd ? ;+48
.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_scale dd ? ;+132
/kernel/trunk/video/cursors.inc
270,7 → 270,7
 
xor ebx, ebx
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.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx
277,80 → 277,13
.fail:
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
proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor]
cmp [eax+CURSOR.magic], 'CURS'
jne .fail
cmp [eax+CURSOR.size], CURSOR_SIZE
jne .fail
; cmp [eax+CURSOR.size], CURSOR_SIZE
; jne .fail
mov ebx, [CURRENT_TASK]
shl ebx, 8
xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
363,17 → 296,43
ret
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
test eax, eax
jz .fail
 
mov edi, [hcursor]
mov edi, [.hcursor]
mov [edi+CURSOR.base], eax
 
mov esi, [src]
mov ebx, [flags]
mov esi, [.src]
mov ebx, [.flags]
cmp bx, LOAD_INDIRECT
je .indirect
 
383,8 → 342,9
mov [edi+CURSOR.hot_y], edx
 
stdcall vesa_init_cursor, eax, esi
mov eax, [hcursor]
mov eax, [.hcursor]
.fail:
add esp, 12
ret
.indirect:
shr ebx, 16
397,8 → 357,8
mov ecx, 1024
cld
rep movsd
add esp, 12
ret
endp
 
align 4
proc load_cursor stdcall, src:dword, flags:dword
416,16 → 376,12
jz .exit
mov [src], eax
@@:
call alloc_cursor
test eax, eax
jz .fail
 
mov ebx, [CURRENT_TASK]
shl ebx, 5
mov ebx, [0x3000+ebx+4]
mov [eax+CURSOR.pid], ebx
 
stdcall [create_cursor], eax, [src], [flags]
mov eax, [CURRENT_TASK]
shl eax, 5
mov eax, [0x3000+eax+4]
mov ebx, [src]
mov ecx, [flags]
call [create_cursor] ;eax, ebx, ecx
mov [handle], eax
.fail:
cmp word [flags], LOAD_FROM_FILE
450,8 → 406,8
mov esi, [hcursor]
cmp [esi+CURSOR.magic], 'CURS'
jne .fail
cmp [esi+CURSOR.size], CURSOR_SIZE
jne .fail
; cmp [esi+CURSOR.size], CURSOR_SIZE
; jne .fail
 
mov ebx, [CURRENT_TASK]
shl ebx, 5
466,32 → 422,52
mov eax, [def_cursor]
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]
call free
call [eax+APPOBJ.destroy]
.fail:
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
 
; param
; eax= cursor
 
align 4
destroy_cursor:
 
push eax
stdcall kernel_free, [eax+CURSOR.base]
pop eax
 
 
call destroy_kernel_object
ret
 
align 4
proc init_cursors
cmp [0xfe0c],word 0x13
jbe .fail
509,21 → 485,6
.init:
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
mov [hw_cursor], eax
test eax, eax