kms: pre rc8

git-svn-id: svn://kolibrios.org@1300 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2009-12-01 13:32:57 +00:00
parent 18d56a4087
commit 77f37d9ba0
10 changed files with 148 additions and 178 deletions

View File

@ -309,14 +309,12 @@ draw_data equ (OS_BASE+0x0338000);
BgrDrawMode equ (OS_BASE+0x033BFF4)
BgrDataWidth equ (OS_BASE+0x033BFF8)
BgrDataHeight equ (OS_BASE+0x033BFFC)
WinMapAddress equ (OS_BASE+0x033C000)
display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000
virtual at (OS_BASE+0x047CF80)
virtual at (OS_BASE+0x033CF80)
tss TSS
end virtual
sys_pgmap equ (OS_BASE+0x047F000)
sys_pgmap equ (OS_BASE+0x033F000)
HEAP_BASE equ (OS_BASE+0x0800000)
HEAP_MIN_SIZE equ 0x01000000
@ -580,6 +578,7 @@ struc display_t
.show_cursor dd ?
.move_cursor dd ?
.restore_cursor dd ?
.disable_mouse dd ?
}
virtual at 0
@ -677,7 +676,8 @@ struc SRV
.bk dd ? ;+0x1C ;prev SRV descriptor
.base dd ? ;+0x20 ;service base address
.entry dd ? ;+0x24 ;service START function
.srv_proc dd ? ;+0x28 ;main service handler
.srv_proc dd ? ;+0x28 ;user mode service handler
.srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
.sizeof:
}

View File

@ -321,8 +321,17 @@ proc init_LFB
cmp dword [LFBAddress], -1
jne @f
mov [BOOT_VAR+0x901c],byte 2
stdcall kernel_alloc, 0x280000
mov [LFBAddress], eax
stdcall alloc_pages, (0x280000 / 4096)
push eax
call alloc_page
stdcall map_page_table, LFB_BASE, eax
pop eax
or eax, PG_UW
mov ebx, LFB_BASE
mov ecx, 0x280000 / 4096
call commit_pages
mov [LFBAddress], dword LFB_BASE
ret
@@:
test [SCR_MODE],word 0100000000000000b
@ -334,7 +343,7 @@ proc init_LFB
mov edx, LFB_BASE
mov esi, [LFBAddress]
mov edi, 0x00800000
mov edi, 0x00C00000
mov dword [exp_lfb+4], edx
shr edi, 12
@ -558,14 +567,6 @@ proc page_fault_handler
push ebx ;that is locals: .err_addr = cr2
inc [pg_data.pages_faults]
; push eax
; push edx
; mov edx, 0x400 ;bochs
; mov al,0xff ;bochs
; out dx, al ;bochs
; pop edx
; pop eax
mov eax, [pf_err_code]
cmp ebx, OS_BASE ;ebx == .err_addr
@ -592,6 +593,11 @@ end if
pop ebx ;restore exception number (#PF)
ret
; xchg bx, bx
; add esp,12 ;clear in stack: locals(.err_addr) + #PF + ret_to_caller
; restore_ring3_context
; iretd
.user_space:
test eax, PG_MAP
jnz .err_access ;Ñòðàíèöà ïðèñóòñòâóåò

View File

@ -129,32 +129,11 @@ dll_cur_addr dd MIN_DEFAULT_DLL_ADDR
; supported videomodes
;mode_1280_1024_32:
; dw 1280,1024,32,60
;mode_1280_1024_24:
; dw 1280,1024,24,60
;mode_1024_768_32:
; dw 1024,768,32,60
;mode_1024_768_24:
; dw 1024,768,24,60
;mode_800_600_32:
; dw 800,600,32,60
;mode_800_600_24:
; dw 800,600,24,60
;mode_640_480_32:
; dw 640,480,32,60
;mode_640_480_24:
; dw 640,480,24,60
;mode_640_480_16:
; dw 640,480,16,60
;mode_320_240_8:
; dw 320,240,8,60
; mike.dld {
db 0
dd servetable-0x10000
draw_line dd __sys_draw_line
disable_mouse dd __sys_disable_mouse
draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar
@ -337,8 +316,15 @@ os_stack_seg rd 1
srv.fd rd 1
srv.bk rd 1
align 16
_display display_t
_WinMapAddress rd 1
_WinMapSize rd 1
scr_width rd 1
scr_height rd 1

View File

@ -372,7 +372,7 @@ negativebutton:
push edx
push edi
call [disable_mouse]
call [_display.disable_mouse]
bdbnewline:
mov edi,1 ; force
@ -389,7 +389,6 @@ negativebutton:
bneg:
;;;call [disable_mouse]
call [putpixel]
nbneg:

View File

@ -33,7 +33,7 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
.1:
; } \\ Alver \\
pushad
call [disable_mouse]
call [_display.disable_mouse]
movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x

View File

@ -184,7 +184,7 @@ pushad
inc edi
imul edi, ebx
add edi, eax
add edi, WinMapAddress
add edi, [_WinMapAddress]
.new_y:
push ecx ; sx
@ -245,7 +245,7 @@ pushad
inc eax
imul eax, ebx
add eax, [esp]
add eax, WinMapAddress
add eax, [_WinMapAddress]
mov ebp, eax
mov edi, [edi+APPDATA.wnd_shape]

View File

@ -111,17 +111,14 @@ save_draw_mouse:
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
movzx edx, byte [display_data+ebx+eax]
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
cmp esi, [current_cursor]
je .draw
; cmp [esi+CURSOR.magic], 'CURS'
; jne .fail
push esi
call [select_hw_cursor]
mov [current_cursor], esi
@ -292,7 +289,7 @@ __sys_disable_mouse:
inc ecx
imul ecx,ebx
add ecx,eax
add ecx, display_data
add ecx, [_WinMapAddress]
mov eax, [CURRENT_TASK]
movzx ebx, byte [ecx]
cmp eax,ebx

View File

@ -349,14 +349,20 @@ high_code:
; mov [0xF604],byte 1 ;al
mov al, [BOOT_VAR+0x901F] ; DMA access
mov [allow_dma_access], al
mov al,[BOOT_VAR+0x9000] ; bpp
movzx eax, byte [BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al
mov [_display.bpp], eax
mov [_display.vrefresh], 60
mov [_display.disable_mouse], __sys_disable_mouse
movzx eax,word [BOOT_VAR+0x900A] ; X max
mov [_display.width], eax
dec eax
mov [Screen_Max_X],eax
mov [screen_workarea.right],eax
movzx eax,word [BOOT_VAR+0x900C] ; Y max
mov [_display.height], eax
dec eax
mov [Screen_Max_Y],eax
mov [screen_workarea.bottom],eax
@ -369,9 +375,14 @@ high_code:
je @f
cmp [SCR_MODE],word 0x12 ; VGA 640x480
je @f
mov ax,[BOOT_VAR+0x9001] ; for other modes
movzx eax, word[BOOT_VAR+0x9001] ; for other modes
mov [BytesPerScanLine],ax
mov [_display.pitch], eax
@@:
mov eax, [_display.width]
mul [_display.height]
mov [_WinMapSize], eax
mov esi, BOOT_VAR+0x9080
movzx ecx, byte [esi-1]
mov [NumBiosDisks], ecx
@ -541,6 +552,9 @@ high_code:
mov [graph_data_l+4],al
mov [graph_data_l+7],ah
stdcall kernel_alloc, [_WinMapSize]
mov [_WinMapAddress], eax
xor eax,eax
inc eax
mov [CURRENT_TASK],eax ;dword 1
@ -549,8 +563,7 @@ high_code:
mov [current_slot], SLOT_BASE+256
; set background
; xor eax,eax
; inc eax
mov [BgrDrawMode],eax
mov [BgrDataWidth],eax
mov [BgrDataHeight],eax
@ -1805,7 +1818,6 @@ msset:
ret
app_load_cursor:
; add ebx, new_app_base
cmp ecx, OS_BASE
jae msset
stdcall load_cursor, ecx, edx
@ -2894,9 +2906,9 @@ sys_drawwindow:
; cmp eax,0 ; type I - original style
jne nosyswI
inc [mouse_pause]
call [disable_mouse]
call [_display.disable_mouse]
call sys_set_window
call [disable_mouse]
call [_display.disable_mouse]
call drawwindow_I
;dec [mouse_pause]
;call [draw_pointer]
@ -2907,9 +2919,9 @@ sys_drawwindow:
cmp al,1 ; type II - only reserve area, no draw
jne nosyswII
inc [mouse_pause]
call [disable_mouse]
call [_display.disable_mouse]
call sys_set_window
call [disable_mouse]
call [_display.disable_mouse]
call sys_window_mouse
dec [mouse_pause]
call [draw_pointer]
@ -2919,9 +2931,9 @@ sys_drawwindow:
cmp al,2 ; type III - new style
jne nosyswIII
inc [mouse_pause]
call [disable_mouse]
call [_display.disable_mouse]
call sys_set_window
call [disable_mouse]
call [_display.disable_mouse]
call drawwindow_III
;dec [mouse_pause]
;call [draw_pointer]
@ -2936,9 +2948,9 @@ sys_drawwindow:
draw_skin_window:
inc [mouse_pause]
call [disable_mouse]
call [_display.disable_mouse]
call sys_set_window
call [disable_mouse]
call [_display.disable_mouse]
mov eax, [TASK_COUNT]
movzx eax, word [WIN_POS + eax*2]
cmp eax, [CURRENT_TASK]
@ -2957,7 +2969,7 @@ sys_drawwindow:
draw_window_caption:
inc [mouse_pause]
call [disable_mouse]
call [_display.disable_mouse]
xor eax,eax
mov edx,[TASK_COUNT]
@ -3495,7 +3507,8 @@ checkpixel:
mov edx,[Screen_Max_X] ; screen x size
inc edx
imul edx, ebx
mov dl, [eax+edx+display_data] ; lea eax, [...]
add eax, [_WinMapAddress]
mov dl, [eax+edx] ; lea eax, [...]
xor ecx, ecx
mov eax, [CURRENT_TASK]
@ -3584,7 +3597,7 @@ markz:
no_mark_system_shutdown:
call [disable_mouse]
call [_display.disable_mouse]
dec byte [SYS_SHUTDOWN]
je system_shutdown
@ -3742,9 +3755,10 @@ redrawscreen:
calculatebackground: ; background
mov edi,display_data ; set os to use all pixels
mov edi, [_WinMapAddress] ; set os to use all pixels
mov eax,0x01010101
mov ecx,1280*1024 / 4
mov ecx, [_WinMapSize]
shr ecx, 2
rep stosd
mov byte [REDRAW_BACKGROUND], 0 ; do not draw background!
@ -5093,7 +5107,7 @@ syscall_setpixel: ; SetPixel
add ebx, [edi+APPDATA.wnd_clientbox.top]
xor edi, edi ; no force
; mov edi, 1
call [disable_mouse]
call [_display.disable_mouse]
jmp [putpixel]
align 4
@ -5247,7 +5261,7 @@ syscall_getarea:
pushad
inc [mouse_pause]
; Check of use of the hardware cursor.
cmp [disable_mouse],__sys_disable_mouse
cmp [_display.disable_mouse],__sys_disable_mouse
jne @f
; Since the test for the coordinates of the mouse should not be used,
; then use the call [disable_mouse] is not possible!
@ -5311,7 +5325,7 @@ syscall_getarea:
jnz .start_y
dec [mouse_pause]
; Check of use of the hardware cursor.
cmp [disable_mouse],__sys_disable_mouse
cmp [_display.disable_mouse],__sys_disable_mouse
jne @f
call [draw_pointer]
@@:
@ -5433,18 +5447,33 @@ set_screen:
mov [Screen_Max_X], eax
mov [Screen_Max_Y], edx
mov [BytesPerScanLine], ecx
mov [screen_workarea.right],eax
mov [screen_workarea.bottom], edx
inc eax
shl eax, 2 ;32 bpp
mov [BytesPerScanLine], eax
push ebx
push esi
push edi
pushad
stdcall kernel_free, [_WinMapAddress]
mov eax, [_display.width]
mul [_display.height]
mov [_WinMapSize], eax
stdcall kernel_alloc, eax
mov [_WinMapAddress], eax
test eax, eax
jz .epic_fail
popad
call repos_windows
mov eax, 0
mov ebx, 0
xor eax, eax
xor ebx, ebx
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
call calculatescreen
@ -5455,6 +5484,9 @@ set_screen:
popfd
ret
.epic_fail:
hlt ; Houston, we've had a problem
; --------------- APM ---------------------
apm_entry dp 0
apm_vf dd 0

View File

@ -242,7 +242,7 @@ end if
vesa12_drawbackground:
call [disable_mouse]
call [_display.disable_mouse]
push eax
push ebx
@ -327,7 +327,8 @@ vesa12_drawbackground:
mov eax,[Screen_Max_X]
add eax,1
mul ebx
cmp [eax+esi+WinMapAddress],byte 1
add eax, [_WinMapAddress]
cmp [eax+esi],byte 1
jnz v12nbgp
mov eax,[BytesPerScanLine]
mov ebx,edi
@ -386,7 +387,7 @@ vesa12_drawbackground:
vesa12_drawbar:
call [disable_mouse]
call [_display.disable_mouse]
;; mov [novesachecksum],dword 0
sub edx,ebx
@ -494,7 +495,7 @@ dbpi24bit12:
sub eax,VGABasePtr
mov ebx,3
div ebx
add eax,WinMapAddress
add eax, [_WinMapAddress]
mov ebx,[CURRENT_TASK]
cld
@ -585,7 +586,7 @@ dbpi24bit12:
mov eax,edi
sub eax,VGABasePtr
shr eax,2
add eax,WinMapAddress
add eax, [_WinMapAddress]
mov ebx,[CURRENT_TASK]
cld
@ -753,7 +754,7 @@ vesa12_putimage:
; mov ecx,320*65536+240
; mov edx,20*65536+20
call [disable_mouse]
call [_display.disable_mouse]
mov [novesachecksum],dword 0
push esi
@ -830,7 +831,7 @@ vesa12_putimage:
sub edx,VGABasePtr
mov ebx,3
div ebx
add edx,WinMapAddress
add edx, [_WinMapAddress]
mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3]
@ -909,7 +910,7 @@ vesa12_putimage:
mov edx,edi
sub edx,VGABasePtr
shr edx,2
add edx,WinMapAddress
add edx, [_WinMapAddress]
mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3]

View File

@ -28,7 +28,6 @@ $Revision$
;BytesPerScanLine equ 0xfe08
;LFBAddress equ 0xfe80
;ScreenBPP equ 0xfbf1
;WinMapAddress equ 0x460000
@ -54,16 +53,14 @@ Vesa20_getpixel24:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2] ; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier)
add edi, [LFBAddress] ; ebx = where pixel is in memory
mov ecx, [edi]
mov ecx, [LFB_BASE+edi]
and ecx, 0xffffff
ret
Vesa20_getpixel32:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
add edi, [LFBAddress] ; ebx = where pixel is in memory
mov ecx, [edi]
mov ecx, [LFB_BASE+edi]
and ecx, 0xffffff
ret
@ -106,7 +103,7 @@ align 16
vesa20_putimage:
pushad
call [disable_mouse]
call [_display.disable_mouse]
sub esp, putimg.stack_data
; save pointer to image
mov [putimg.pti], ebx
@ -194,13 +191,12 @@ vesa20_putimage:
shr ebx, 3
imul eax, ebx
add edx, eax
add edx, [LFBAddress]
; pointer to pixel map
mov eax, [putimg.abs_cy]
imul eax, [Screen_Max_X]
add eax, [putimg.abs_cy]
add eax, [putimg.abs_cx]
add eax, WinMapAddress
add eax, [_WinMapAddress]
xchg eax, ebp
; get process number
mov ebx, [CURRENT_TASK]
@ -220,9 +216,9 @@ align 4
cmp [ebp], bl
jne .skip
; mov eax, [esi] ; eax = RRBBGGRR
mov [edx], ax
mov [LFB_BASE+edx], ax
shr eax, 16
mov [edx+2], al
mov [LFB_BASE+edx+2], al
.skip:
; add esi, 3 ;[putimg.source_bpp]
add edx, 3
@ -265,7 +261,7 @@ align 4
cmp [ebp], bl
jne .skip
; mov eax, [esi] ; ecx = RRBBGGRR
mov [edx], eax
mov [LFB_BASE+edx], eax
.skip:
; add esi, [putimg.source_bpp]
add edx, 4
@ -308,20 +304,25 @@ __sys_putpixel:
;;; mov [novesachecksum], dword 0
pushad
test edi,1 ; force ?
jnz .forced
; not forced:
push ecx ; save 24th bit in case negative pixel wanted
call checkpixel
test ecx,ecx
pop ecx
jnz .exit
.forced:
cmp [Screen_Max_X], eax
jb .exit
cmp [Screen_Max_Y], ebx
jb .exit
.ok:
test edi,1 ; force ?
jnz .forced
; not forced:
push eax
mov edx,[_display.width] ; screen x size
imul edx, ebx
add eax, [_WinMapAddress]
movzx edx, byte [eax+edx]
cmp edx, [CURRENT_TASK]
pop eax
jne .exit
.forced:
; check if negation
test ecx,0x01000000
jz .noneg
@ -342,11 +343,9 @@ Vesa20_putpixel24:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2] ; edi = x*3
mov eax, [esp+32-8+4]
add edi, [LFBAddress]
add edi, ebx ; ebx = where to put pixel in memory
mov [edi], ax
mov [LFB_BASE+ebx+edi], ax
shr eax, 16
mov [edi+2], al
mov [LFB_BASE+ebx+edi+2], al
ret
@ -357,8 +356,7 @@ Vesa20_putpixel32:
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4] ; eax = color
add edi, [LFBAddress] ; ebx = where to put pixel in memory
mov [edi], eax
mov [LFB_BASE+edi], eax
ret
;*************************************************
@ -378,7 +376,7 @@ calculate_edi:
align 4
__sys_draw_line:
; inc [mouse_pause]
call [disable_mouse]
call [_display.disable_mouse]
; draw a line
; eax = HIWORD = x1
@ -568,7 +566,7 @@ align 4
; edi color
vesa20_drawbar:
pushad
call [disable_mouse]
call [_display.disable_mouse]
sub esp, drbar.stack_data
mov [drbar.color], edi
sub edx, ebx
@ -643,13 +641,12 @@ vesa20_drawbar:
; shr ebx, 3
imul eax, ebx
add edx, eax
add edx, [LFBAddress]
; pointer to pixel map
mov eax, [drbar.abs_cy]
imul eax, [Screen_Max_X]
add eax, [drbar.abs_cy]
add eax, [drbar.abs_cx]
add eax, WinMapAddress
add eax, [_WinMapAddress]
xchg eax, ebp
; get process number
mov ebx, [CURRENT_TASK]
@ -674,8 +671,9 @@ align 4
.new_x:
cmp byte [ebp], bl
jne .skip
mov [edx], bh
mov [edx + 1], ax
mov [LFB_BASE+edx], bh
mov [LFB_BASE+edx + 1], ax
.skip:
; add pixel
add edx, 3
@ -710,7 +708,8 @@ align 4
.new_x:
cmp byte [ebp], bl
jne .skip
mov [edx], eax
mov [LFB_BASE+edx], eax
.skip:
; add pixel
add edx, 4
@ -737,62 +736,9 @@ align 4
mov [EGA_counter],1
ret
;voodoodbcplimit:
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
; pusha
; xor edx,edx
; mov eax,ebp
; mov ebx,[Screen_Max_X] ; Screen_X_size
; inc ebx ; +1
; sub eax,WinMapAddress ; -AddrBuffer
; div ebx ;
; mov ebx,eax ; ebx:=Y
; mov eax,edx ; eax:=X
; call cplimit
; test ecx,ecx
; jne dbcpl12
; popa
; clc
; ret
; dbcpl12:
; popa
; stc
; ret
;dbcplimit:
; pusha
; xor edx,edx
; mov ebx,[Screen_Max_X]
; inc ebx
; sub eax,WinMapAddress
; div ebx
; mov ebx,eax
; mov eax,edx
; call cplimit
; test ecx,ecx
; jne dbcpl1
; popa
; clc
; ret
; dbcpl1:
; popa
; stc
; ret
align 4
vesa20_drawbackground_tiled:
call [disable_mouse]
call [_display.disable_mouse]
pushad
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
@ -810,10 +756,11 @@ dp2:
jz @f
add ebp, eax
@@:
add ebp, [LFBAddress]
add ebp, LFB_BASE
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
xchg edi, ebp
add ebp, [_WinMapAddress]
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
; 2) Calculate offset in background memory block
push eax
@ -842,7 +789,7 @@ dp2:
; esi -> bgr memory, edi -> output
; ebp = offset in WinMapAddress
dp3:
cmp [ebp+WinMapAddress], dl
cmp [ebp], dl
jnz nbgp
movsb
movsb
@ -881,7 +828,7 @@ dp4:
vesa20_drawbackground_stretch:
call [disable_mouse]
call [_display.disable_mouse]
pushad
; Helper variables
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
@ -917,7 +864,6 @@ vesa20_drawbackground_stretch:
jz @f
add ebp, eax
@@:
add ebp, [LFBAddress]
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
xchg edi, ebp
@ -985,7 +931,8 @@ sdp3:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
sdp3a:
cmp [ebp+WinMapAddress], byte 1
mov eax, [_WinMapAddress]
cmp [ebp+eax], byte 1
jnz snbgp
mov eax, [bgr_cur_line+esi]
test ecx, ecx
@ -993,9 +940,11 @@ sdp3a:
mov ebx, [bgr_next_line+esi]
call [overlapping_of_points_ptr]
.novert:
mov [edi], ax
mov [LFB_BASE+edi], ax
shr eax, 16
mov [edi+2], al
mov [LFB_BASE+edi+2], al
snbgp:
cmp [ScreenBPP], byte 25
sbb edi, -4