kms kernel

git-svn-id: svn://kolibrios.org@1316 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2009-12-13 00:16:34 +00:00
parent 883c3e7155
commit 6b4166f7c3
11 changed files with 244 additions and 3232 deletions

View File

@ -1557,7 +1557,11 @@ stop_all_services:
jz .next jz .next
push edx push edx
stdcall ebx, dword -1 mov ebp, esp
push 0
push -1
call ebx
mov esp, ebp
pop edx pop edx
jmp .next jmp .next
.done: .done:

View File

@ -60,10 +60,6 @@ iglobal
szClearEvent db 'ClearEvent',0 szClearEvent db 'ClearEvent',0
szLoadCursor db 'LoadCursor',0 szLoadCursor db 'LoadCursor',0
szSelectHwCursor db 'SelectHwCursor',0
szSetHwCursor db 'SetHwCursor',0
szHwCursorRestore db 'HwCursorRestore', 0
szHwCursorCreate db 'HwCursorCreate', 0
szSysMsgBoardStr db 'SysMsgBoardStr', 0 szSysMsgBoardStr db 'SysMsgBoardStr', 0
szSysMsgBoardChar db 'SysMsgBoardChar', 0 szSysMsgBoardChar db 'SysMsgBoardChar', 0
@ -134,11 +130,6 @@ kernel_export:
dd szLoadCursor , load_cursor ;stdcall dd szLoadCursor , load_cursor ;stdcall
dd szSelectHwCursor , select_hw_cursor ;import stdcall
dd szSetHwCursor , set_hw_cursor ;import stdcall
dd szHwCursorRestore , hw_restore ;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

View File

@ -1189,14 +1189,19 @@ f68:
cmp ebx, OS_BASE cmp ebx, OS_BASE
jae .fail jae .fail
stdcall load_PE, ebx cmp ecx, OS_BASE
jae .fail
mov edi, ecx
stdcall load_PE, ebx
mov esi, eax
test eax, eax test eax, eax
jz @F jz @F
mov esi, eax push edi
stdcall eax, DRV_ENTRY push DRV_ENTRY
call eax
add esp, 8
test eax, eax test eax, eax
jz @F jz @F

View File

@ -294,11 +294,7 @@ __exports:
map_io_mem, 'MapIoMem', \ ; stdcall map_io_mem, 'MapIoMem', \ ; stdcall
get_pg_addr, 'GetPgAddr', \ ; eax get_pg_addr, 'GetPgAddr', \ ; eax
\ \
select_hw_cursor, 'SelectHwCursor', \ ; stdcall get_display, 'GetDisplay', \
set_hw_cursor, 'SetHwCursor', \ ; stdcall
hw_restore, 'HwCursorRestore', \ ;
create_cursor, 'HwCursorCreate', \ ;
\
set_screen, 'SetScreen', \ set_screen, 'SetScreen', \
pci_api, 'PciApi', \ pci_api, 'PciApi', \
pci_read8, 'PciRead8', \ ; stdcall pci_read8, 'PciRead8', \ ; stdcall

View File

@ -324,23 +324,18 @@ _display display_t
_WinMapAddress rd 1 _WinMapAddress rd 1
_WinMapSize rd 1 _WinMapSize rd 1
scr_width rd 1
scr_height rd 1
create_cursor rd 1
select_hw_cursor rd 1
set_hw_cursor rd 1
hw_restore rd 1
def_cursor rd 1 def_cursor rd 1
current_cursor rd 1 current_cursor rd 1
hw_cursor rd 1 hw_cursor rd 1
cur_def_interl rd 1
cur_saved_base rd 1 cur_saved_base rd 1
cur_saved_interl rd 1
cur_saved_w rd 1 cur.lock rd 1 ;1 - lock update, 2- hide
cur_saved_h rd 1 cur.left rd 1 ;cursor clip box
cur.top rd 1
cur.right rd 1
cur.bottom rd 1
cur.w rd 1
cur.h rd 1
ipc_tmp rd 1 ipc_tmp rd 1
ipc_pdir rd 1 ipc_pdir rd 1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -51,12 +51,13 @@ endg
draw_mouse_under: draw_mouse_under:
; return old picture ; return old picture
cmp [set_hw_cursor], 0 cmp [_display.restore_cursor], 0
jz @F je @F
pushad pushad
movzx eax,word [X_UNDER] movzx eax,word [X_UNDER]
movzx ebx,word [Y_UNDER] movzx ebx,word [Y_UNDER]
stdcall [hw_restore], eax, ebx stdcall [_display.restore_cursor], eax, ebx
popad popad
ret ret
@@: @@:
@ -97,7 +98,7 @@ mres:
save_draw_mouse: save_draw_mouse:
cmp [set_hw_cursor], 0 cmp [_display.move_cursor], 0
je .no_hw_cursor je .no_hw_cursor
pushad pushad
@ -120,16 +121,16 @@ save_draw_mouse:
je .draw je .draw
push esi push esi
call [select_hw_cursor] call [_display.select_cursor]
mov [current_cursor], esi mov [current_cursor], esi
.draw: .draw:
stdcall [set_hw_cursor], esi stdcall [_display.move_cursor], esi
popad popad
ret ret
.fail: .fail:
mov ecx, [def_cursor] mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [set_hw_cursor], ecx ; stdcall: [esp]=ebx,eax stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
popad popad
ret ret

View File

@ -751,8 +751,7 @@ end if
mov byte[TASK_DATA+TASKDATA.wnd_number],al ; on screen number mov byte[TASK_DATA+TASKDATA.wnd_number],al ; on screen number
mov dword [TASK_DATA+TASKDATA.pid], eax ; process id number mov dword [TASK_DATA+TASKDATA.pid], eax ; process id number
call init_display
call init_cursors
mov eax, [def_cursor] mov eax, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor],eax mov [SLOT_BASE+APPDATA.cursor],eax
mov [SLOT_BASE+APPDATA.cursor+256],eax mov [SLOT_BASE+APPDATA.cursor+256],eax

View File

@ -32,7 +32,7 @@ virtual at 0
end virtual end virtual
align 4 align 4
proc vesa_init_cursor stdcall, dst:dword, src:dword proc init_cursor stdcall, dst:dword, src:dword
locals locals
rBase dd ? rBase dd ?
pQuad dd ? pQuad dd ?
@ -290,7 +290,7 @@ endp
; ebx= src ; ebx= src
; ecx= flags ; ecx= flags
vesa_cursor: create_cursor:
.src equ esp .src equ esp
.flags equ esp+4 .flags equ esp+4
.hcursor equ esp+8 .hcursor equ esp+8
@ -330,7 +330,32 @@ vesa_cursor:
mov [edi+CURSOR.hot_x], ecx mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx mov [edi+CURSOR.hot_y], edx
stdcall vesa_init_cursor, eax, esi stdcall init_cursor, eax, esi
mov eax, [.hcursor]
lea eax, [eax+CURSOR.list_next]
lea edx, [_display.cr_list.next]
pushfd
cli
mov ecx, [edx]
mov [eax], ecx
mov [eax+4], edx
mov [ecx+4], eax
mov [edx], eax
popfd
mov eax, [.hcursor]
.check_hw:
cmp [_display.init_cursor], 0
je .fail
push eax
call [_display.init_cursor]
add esp, 4
mov eax, [.hcursor] mov eax, [.hcursor]
.fail: .fail:
add esp, 12 add esp, 12
@ -346,8 +371,7 @@ vesa_cursor:
mov ecx, 1024 mov ecx, 1024
cld cld
rep movsd rep movsd
add esp, 12 jmp .check_hw
ret
align 4 align 4
proc load_cursor stdcall, src:dword, flags:dword proc load_cursor stdcall, src:dword, flags:dword
@ -377,7 +401,7 @@ proc load_cursor stdcall, src:dword, flags:dword
mov eax, [CURRENT_TASK+eax+4] mov eax, [CURRENT_TASK+eax+4]
mov ebx, [src] mov ebx, [src]
mov ecx, [flags] mov ecx, [flags]
call [create_cursor] ;eax, ebx, ecx call create_cursor ;eax, ebx, ecx
mov [handle], eax mov [handle], eax
cmp word [flags], LOAD_FROM_FILE cmp word [flags], LOAD_FROM_FILE
@ -407,8 +431,6 @@ 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
; jne .fail
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
shl ebx, 5 shl ebx, 5
@ -443,127 +465,78 @@ destroy_cursor:
align 4 align 4
select_cursor: select_cursor:
mov eax, [esp+4]
mov [_display.cursor], eax
ret 4 ret 4
align 4
proc init_cursors
cmp [SCR_MODE],word 0x13
jbe .fail
test word [SCR_MODE], 0x4000
jz .fail
movzx eax, byte [ScreenBPP]
mov ebx, [BytesPerScanLine]
cmp eax, 32
jne @F
sub ebx, 128
jmp .init
@@:
cmp eax, 24
jne .fail
sub ebx, 96
.init:
mov [cur_def_interl], ebx
stdcall load_driver, szHwMouse
mov [hw_cursor], eax
test eax, eax
jz .sw_mouse
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
ret
.sw_mouse:
mov [create_cursor], vesa_cursor
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
inc ecx
inc edx
mov [scr_width], ecx
mov [scr_height], edx
movzx ebx, byte [ScreenBPP]
cmp ebx, 32
jne @F
mov dword [select_hw_cursor], select_cursor
mov dword [set_hw_cursor], cursor_32
mov dword [hw_restore], restore_32
ret
@@:
mov dword [select_hw_cursor], select_cursor
mov dword [set_hw_cursor], cursor_24
mov dword [hw_restore], restore_24
ret
.fail:
xor eax, eax
mov dword [select_hw_cursor], eax
mov dword [set_hw_cursor], eax
mov dword [hw_restore], eax
ret
endp
align 4 align 4
proc restore_24 stdcall, x:dword, y:dword proc restore_24 stdcall, x:dword, y:dword
locals
w dd ?
endl
mov edi, [cur_saved_base] push ebx
mov edx, [cur_saved_h]
mov ebx, [cur_saved_interl] mov ebx, [cur_saved_base]
mov edx, [cur.h]
test edx, edx test edx, edx
jz .ret jz .ret
push esi
push edi
mov esi, cur_saved_data mov esi, cur_saved_data
@@: mov ecx, [cur.w]
mov ecx, [cur_saved_w]
lea ecx, [ecx+ecx*2] lea ecx, [ecx+ecx*2]
push ecx
@@:
mov edi, ebx
add ebx, [BytesPerScanLine]
mov ecx, [esp]
rep movsb rep movsb
add edi, ebx
dec edx dec edx
jnz @B jnz @B
pop ecx
pop edi
pop esi
.ret: .ret:
pop ebx
ret ret
endp endp
align 4 align 4
proc restore_32 stdcall, x:dword, y:dword proc restore_32 stdcall, x:dword, y:dword
locals
w dd ?
endl
mov edi, [cur_saved_base] push ebx
mov edx, [cur_saved_h]
mov ebx, [cur_saved_interl] mov ebx, [cur_saved_base]
mov edx, [cur.h]
test edx, edx test edx, edx
jz .ret jz .ret
push esi
push edi
mov esi, cur_saved_data mov esi, cur_saved_data
@@: @@:
mov ecx, [cur_saved_w] mov edi, ebx
add ebx, [BytesPerScanLine]
mov ecx, [cur.w]
rep movsd rep movsd
add edi, ebx
dec edx dec edx
jnz @B jnz @B
pop edi
.ret: .ret:
pop esi
pop ebx
ret ret
endp endp
align 4 align 4
proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
locals locals
w dd ?
h dd ? h dd ?
st dd ?
_dx dd ? _dx dd ?
_dy dd ? _dy dd ?
endl endl
@ -575,87 +548,84 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
xor edx, edx xor edx, edx
sub ecx, [esi+CURSOR.hot_x] sub ecx, [esi+CURSOR.hot_x]
lea ebx, [ecx+32-1]
mov [x], ecx mov [x], ecx
sets dl sets dl
dec edx dec edx
and ecx, edx ;clip x to 0<=x and ecx, edx ;clip x to 0<=x
mov [cur.left], ecx
mov edi, ecx mov edi, ecx
sub edi, [x] sub edi, [x]
mov [_dx], edi mov [_dx], edi
xor edx, edx xor edx, edx
sub eax, [esi+CURSOR.hot_y] sub eax, [esi+CURSOR.hot_y]
lea edi, [eax+32-1]
mov [y], eax mov [y], eax
sets dl sets dl
dec edx dec edx
and eax, edx ;clip y to 0<=y and eax, edx ;clip y to 0<=y
mov edi, eax mov [cur.top], eax
sub edi, [y]
mov [_dy], edi
mul ebx
lea esi, [ecx+ecx*2]
add esi, [LFBAddress]
add esi, eax
mov [cur_saved_base],esi
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
@@:
sub edi, [_dx]
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax mov edx, eax
sub edx, [y]
mov [_dy], edx
mul dword [BytesPerScanLine]
lea edx, [LFB_BASE+ecx*3]
add edx, eax
mov [cur_saved_base],edx
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
@@: @@:
sub edx, [_dy] cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
mov [w], edi sub ebx, [x]
mov [h], edx sub edi, [y]
mov [cur_saved_w], edi inc ebx
mov [cur_saved_h], edx inc edi
sub eax, edi mov [cur.w], ebx
shl eax, 2 ;lea eax, [eax+eax*2] mov [cur.h], edi
lea edi, [edi+edi*2] mov [h], edi
sub ebx, edi
mov [cur_saved_interl], ebx
mov eax, edi
mov edi, cur_saved_data mov edi, cur_saved_data
@@: @@:
mov ecx, [w] mov esi, edx
add edx, [BytesPerScanLine]
mov ecx, [cur.w]
lea ecx, [ecx+ecx*2] lea ecx, [ecx+ecx*2]
rep movsb rep movsb
add esi, ebx dec eax
dec edx
jnz @B jnz @B
;draw cursor ;draw cursor
mov edx, eax mov ebx, [cur_saved_base]
mov edi, [cur_saved_base]
mov eax, [_dy] mov eax, [_dy]
shl eax, 5 shl eax, 5
add eax, [_dx] add eax, [_dx]
shl eax, 2
mov esi, [hcursor] mov esi, [hcursor]
mov esi, [esi+CURSOR.base] mov esi, [esi+CURSOR.base]
add esi, eax lea edx, [esi+eax*4]
.row: .row:
mov ecx, [w] mov ecx, [cur.w]
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
.pix: .pix:
lodsd lodsd
test eax, 0xFF000000 test eax, 0xFF000000
jz @F jz @F
mov [edi], ax
mov word [edi], ax
shr eax, 16 shr eax, 16
mov [edi+2],al mov [edi+2],al
@@: @@:
@ -663,19 +633,16 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword
dec ecx dec ecx
jnz .pix jnz .pix
add esi, edx
add edi, ebx
dec [h] dec [h]
jnz .row jnz .row
ret ret
endp endp
align 4 align 4
proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
locals locals
w dd ?
h dd ? h dd ?
st dd ?
_dx dd ? _dx dd ?
_dy dd ? _dy dd ?
endl endl
@ -683,83 +650,80 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
mov esi, [hcursor] mov esi, [hcursor]
mov ecx, [x] mov ecx, [x]
mov eax, [y] mov eax, [y]
mov ebx, [BytesPerScanLine]
xor edx, edx xor edx, edx
sub ecx, [esi+CURSOR.hot_x] sub ecx, [esi+CURSOR.hot_x]
lea ebx, [ecx+32-1]
mov [x], ecx mov [x], ecx
sets dl sets dl
dec edx dec edx
and ecx, edx ;clip x to 0<=x and ecx, edx ;clip x to 0<=x
mov [cur.left], ecx
mov edi, ecx mov edi, ecx
sub edi, [x] sub edi, [x]
mov [_dx], edi mov [_dx], edi
xor edx, edx xor edx, edx
sub eax, [esi+CURSOR.hot_y] sub eax, [esi+CURSOR.hot_y]
lea edi, [eax+32-1]
mov [y], eax mov [y], eax
sets dl sets dl
dec edx dec edx
and eax, edx ;clip y to 0<=y and eax, edx ;clip y to 0<=y
mov edi, eax mov [cur.top], eax
sub edi, [y]
mov [_dy], edi
mul ebx
lea esi, [eax+ecx*4]
add esi, [LFBAddress]
mov [cur_saved_base],esi
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
@@:
sub edi, [_dx]
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax mov edx, eax
sub edx, [y]
mov [_dy], edx
mul dword [BytesPerScanLine]
lea edx, [LFB_BASE+eax+ecx*4]
mov [cur_saved_base],edx
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
@@: @@:
sub edx, [_dy] cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
mov [w], edi sub ebx, [x]
mov [h], edx sub edi, [y]
mov [cur_saved_w], edi inc ebx
mov [cur_saved_h], edx inc edi
sub eax, edi mov [cur.w], ebx
shl eax, 2 mov [cur.h], edi
shl edi, 2 mov [h], edi
sub ebx, edi
mov [cur_saved_interl], ebx
mov eax, edi
mov edi, cur_saved_data mov edi, cur_saved_data
@@: @@:
mov ecx, [w] mov esi, edx
add edx, [BytesPerScanLine]
mov ecx, [cur.w]
rep movsd rep movsd
add esi, ebx dec eax
dec edx
jnz @B jnz @B
;draw cursor ;draw cursor
mov edx, eax mov ebx, [cur_saved_base]
mov edi, [cur_saved_base]
mov eax, [_dy] mov eax, [_dy]
shl eax, 5 shl eax, 5
add eax, [_dx] add eax, [_dx]
shl eax, 2
mov esi, [hcursor] mov esi, [hcursor]
mov esi, [esi+CURSOR.base] mov esi, [esi+CURSOR.base]
add esi, eax lea edx, [esi+eax*4]
.row: .row:
mov ecx, [w] mov ecx, [cur.w]
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
.pix: .pix:
lodsd lodsd
test eax, 0xFF000000 test eax, 0xFF000000
@ -769,13 +733,73 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword
add edi, 4 add edi, 4
dec ecx dec ecx
jnz .pix jnz .pix
add esi, edx
add edi, ebx
dec [h] dec [h]
jnz .row jnz .row
ret ret
endp endp
align 4
get_display:
mov eax, _display
ret
align 4
init_display:
xor eax, eax
mov edi, _display
mov [edi+display_t.init_cursor], eax
mov [edi+display_t.select_cursor], eax
mov [edi+display_t.show_cursor], eax
mov [edi+display_t.move_cursor], eax
mov [edi+display_t.restore_cursor], eax
lea ecx, [edi+display_t.cr_list.next]
mov [edi+display_t.cr_list.next], ecx
mov [edi+display_t.cr_list.prev], ecx
cmp [SCR_MODE],word 0x13
jbe .fail
test word [SCR_MODE], 0x4000
jz .fail
mov ebx, restore_32
mov ecx, move_cursor_32
movzx eax, byte [ScreenBPP]
cmp eax, 32
je @F
mov ebx, restore_24
mov ecx, move_cursor_24
cmp eax, 24
jne .fail
@@:
mov [_display.select_cursor], select_cursor
mov [_display.move_cursor], ecx
mov [_display.restore_cursor], ebx
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
ret
.fail:
xor eax, eax
mov [_display.select_cursor], eax
mov [_display.move_cursor], eax
ret
align 4 align 4
def_arrow: def_arrow:
file 'arrow.cur' file 'arrow.cur'

View File

@ -80,7 +80,7 @@ void __F_NAME(__NTMain,__wNTMain)( void )
__process_fini = &__FiniRtns; __process_fini = &__FiniRtns;
__InitRtns( 255 ); __InitRtns( 255 );
__CommonInit(); __CommonInit();
__initPOSIXHandles();
__appcwdlen = strrchr(_LpPgmName, '/') - _LpPgmName + 1; __appcwdlen = strrchr(_LpPgmName, '/') - _LpPgmName + 1;
__appcwdlen = __appcwdlen > 512 ? 512 : __appcwdlen; __appcwdlen = __appcwdlen > 512 ? 512 : __appcwdlen;
__appcwd= (char*)malloc(__appcwdlen); __appcwd= (char*)malloc(__appcwdlen);