allocate memory for display_data

git-svn-id: svn://kolibrios.org@840 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-07-29 15:39:22 +00:00
parent 0490e63747
commit 3a719cd911
10 changed files with 60 additions and 51 deletions

View File

@ -323,17 +323,14 @@ draw_data equ (OS_BASE+0x0338000);
BgrDrawMode equ (OS_BASE+0x033BFF4) BgrDrawMode equ (OS_BASE+0x033BFF4)
BgrDataWidth equ (OS_BASE+0x033BFF8) BgrDataWidth equ (OS_BASE+0x033BFF8)
BgrDataHeight equ (OS_BASE+0x033BFFC) BgrDataHeight equ (OS_BASE+0x033BFFC)
WinMapAddress equ (OS_BASE+0x033C000)
display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000
virtual at (OS_BASE+0x047CF80) ;display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000
virtual at (OS_BASE+0x033CF80)
tss TSS tss TSS
end virtual end virtual
sys_pgmap equ (OS_BASE+0x047F000) sys_pgmap equ (OS_BASE+0x033F000)
new_app_base equ 0;
twdw equ 0x3000 ;(CURRENT_TASK-window_data) twdw equ 0x3000 ;(CURRENT_TASK-window_data)

View File

@ -1040,14 +1040,15 @@ proc load_library stdcall, file_name:dword
@@: @@:
mov edx, [coff] mov edx, [coff]
movzx ebx, [edx+CFH.nSections]
mov edi, new_app_base ; movzx ebx, [edx+CFH.nSections]
lea eax, [edx+20] ; xor edi, edi
@@: ; lea eax, [edx+20]
add [eax+CFS.VirtualAddress], edi ;patch user space offset ;@@:
add eax, COFF_SECTION_SIZE ; add [eax+CFS.VirtualAddress], edi ;patch user space offset
dec ebx ; add eax, COFF_SECTION_SIZE
jnz @B ; dec ebx
; jnz @B
add edx, 20 add edx, 20
stdcall fix_coff_relocs, [coff], edx, [sym] stdcall fix_coff_relocs, [coff], edx, [sym]

View File

@ -333,8 +333,6 @@ proc init_LFB
@@: @@:
call init_mtrr call init_mtrr
xchg bx, bx
mov eax, [LFBAddress] mov eax, [LFBAddress]
or eax, PG_LARGE+PG_UW or eax, PG_LARGE+PG_UW
mov [sys_pgdir+(LFB_BASE shr 20)], eax mov [sys_pgdir+(LFB_BASE shr 20)], eax

View File

@ -998,8 +998,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\
rep movsd rep movsd
shr ebx,3 shr ebx,3
mov eax, new_app_base mov dword [CURRENT_TASK+ebx+0x10], 0
mov dword [CURRENT_TASK+ebx+0x10],eax
.add_command_line: .add_command_line:
mov edx,[params] mov edx,[params]

View File

@ -191,14 +191,14 @@ app_code_l:
dw 0 dw 0
db 0 db 0
db cpl3 db cpl3
dw G32+D32+(new_app_base shr 16)+0xF; dw G32+D32+0xF;
app_data_l: app_data_l:
dw 0xFFFF dw 0xFFFF
dw 0 dw 0
db 0 db 0
db drw3 db drw3
dw G32+D32+(new_app_base shr 16)+0xF; dw G32+D32+0xF;
; ------------- PCI BIOS ------------------ ; ------------- PCI BIOS ------------------
@ -349,6 +349,8 @@ LFBSize rd 1
stall_mcs rd 1 stall_mcs rd 1
current_slot rd 1 current_slot rd 1
_display_data rd 1
; status ; status
hd1_status rd 1 ; 0 - free : other - pid hd1_status rd 1 ; 0 - free : other - pid
application_table_status rd 1 ; 0 - free : other - pid application_table_status rd 1 ; 0 - free : other - pid

View File

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

View File

@ -111,8 +111,8 @@ save_draw_mouse:
mov ecx, [Screen_Max_X] mov ecx, [Screen_Max_X]
inc ecx inc ecx
mul ecx mul ecx
add eax, [_display_data]
movzx edx, byte [display_data+ebx+eax] movzx edx, byte [ebx+eax]
shl edx, 8 shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor] mov esi, [edx+SLOT_BASE+APPDATA.cursor]
@ -292,7 +292,7 @@ __sys_disable_mouse:
inc ecx inc ecx
imul ecx,ebx imul ecx,ebx
add ecx,eax add ecx,eax
add ecx, display_data add ecx, [_display_data]
mov eax, [CURRENT_TASK] mov eax, [CURRENT_TASK]
movzx ebx, byte [ecx] movzx ebx, byte [ecx]
cmp eax,ebx cmp eax,ebx

View File

@ -609,6 +609,10 @@ high_code:
add eax, ebx add eax, ebx
mov [ipc_ptab], eax mov [ipc_ptab], eax
stdcall alloc_pages, (1280*1024)/4096
add eax, OS_BASE
mov [_display_data], eax
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \ stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
(unpack.lc+unpack.lp)))*4 (unpack.lc+unpack.lp)))*4
@ -1315,8 +1319,8 @@ display_number_force:
jne displnl1 jne displnl1
mov ebp,ebx mov ebp,ebx
add ebp,4 add ebp,4
mov ebp,[ebp+std_application_base_address] mov ebp,[ebp]
mov ebx,[ebx+std_application_base_address] mov ebx,[ebx]
displnl1: displnl1:
sub esp,64 sub esp,64
@ -2677,7 +2681,7 @@ sys_cpuusage:
cmp ecx, 1 shl 5 cmp ecx, 1 shl 5
je .os_mem je .os_mem
mov edx, [SLOT_BASE+ecx*8+APPDATA.mem_size] mov edx, [SLOT_BASE+ecx*8+APPDATA.mem_size]
mov eax, std_application_base_address xor eax, eax
.os_mem: .os_mem:
stosd stosd
lea eax, [edx-1] lea eax, [edx-1]
@ -3444,9 +3448,13 @@ checkpixel:
push eax edx push eax edx
mov edx,[Screen_Max_X] ; screen x size mov edx,[Screen_Max_X] ; screen x size
inc edx mov ecx, [_display_data]
inc edx
imul edx, ebx imul edx, ebx
mov dl, [eax+edx+display_data] ; lea eax, [...]
add edx, ecx
mov dl, [eax+edx] ; lea eax, [...]
xor ecx, ecx xor ecx, ecx
mov eax, [CURRENT_TASK] mov eax, [CURRENT_TASK]
@ -3701,7 +3709,7 @@ calculatebackground: ; background
cld cld
rep stosd rep stosd
mov edi,display_data ; set os to use all pixels mov edi, [_display_data] ; set os to use all pixels
mov eax,0x01010101 mov eax,0x01010101
mov ecx,1280*1024 / 4 mov ecx,1280*1024 / 4
rep stosd rep stosd

View File

@ -327,7 +327,9 @@ vesa12_drawbackground:
mov eax,[Screen_Max_X] mov eax,[Screen_Max_X]
add eax,1 add eax,1
mul ebx mul ebx
cmp [eax+esi+WinMapAddress],byte 1 mov ebx, [_display_data]
add ebx, esi
cmp [eax+ebx],byte 1
jnz v12nbgp jnz v12nbgp
mov eax,[BytesPerScanLine] mov eax,[BytesPerScanLine]
mov ebx,edi mov ebx,edi
@ -494,7 +496,7 @@ dbpi24bit12:
sub eax,VGABasePtr sub eax,VGABasePtr
mov ebx,3 mov ebx,3
div ebx div ebx
add eax,WinMapAddress add eax, [_display_data]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
cld cld
@ -585,7 +587,7 @@ dbpi24bit12:
mov eax,edi mov eax,edi
sub eax,VGABasePtr sub eax,VGABasePtr
shr eax,2 shr eax,2
add eax,WinMapAddress add eax, [_display_data]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
cld cld
@ -830,7 +832,7 @@ vesa12_putimage:
sub edx,VGABasePtr sub edx,VGABasePtr
mov ebx,3 mov ebx,3
div ebx div ebx
add edx,WinMapAddress add edx,[_display_data]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3] mov bh,[esp+4*3]
@ -899,7 +901,7 @@ vesa12_putimage:
mov edx,edi mov edx,edi
sub edx,VGABasePtr sub edx,VGABasePtr
shr edx,2 shr edx,2
add edx,WinMapAddress add edx, [_display_data]
mov ebx,[CURRENT_TASK] mov ebx,[CURRENT_TASK]
mov bh,[esp+4*3] mov bh,[esp+4*3]

View File

@ -28,8 +28,6 @@ $Revision$
;BytesPerScanLine equ 0xfe08 ;BytesPerScanLine equ 0xfe08
;LFBAddress equ 0xfe80 ;LFBAddress equ 0xfe80
;ScreenBPP equ 0xfbf1 ;ScreenBPP equ 0xfbf1
;WinMapAddress equ 0x460000
;************************************************* ;*************************************************
@ -200,7 +198,7 @@ vesa20_putimage:
imul eax, [Screen_Max_X] imul eax, [Screen_Max_X]
add eax, [putimg.abs_cy] add eax, [putimg.abs_cy]
add eax, [putimg.abs_cx] add eax, [putimg.abs_cx]
add eax, WinMapAddress add eax, [_display_data]
xchg eax, ebp xchg eax, ebp
; get process number ; get process number
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
@ -629,7 +627,7 @@ vesa20_drawbar:
imul eax, [Screen_Max_X] imul eax, [Screen_Max_X]
add eax, [drbar.abs_cy] add eax, [drbar.abs_cy]
add eax, [drbar.abs_cx] add eax, [drbar.abs_cx]
add eax, WinMapAddress add eax, [_display_data]
xchg eax, ebp xchg eax, ebp
; get process number ; get process number
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
@ -728,7 +726,7 @@ align 4
; mov eax,ebp ; mov eax,ebp
; mov ebx,[Screen_Max_X] ; Screen_X_size ; mov ebx,[Screen_Max_X] ; Screen_X_size
; inc ebx ; +1 ; inc ebx ; +1
; sub eax,WinMapAddress ; -AddrBuffer ; sub eax,display_data ; -AddrBuffer
; div ebx ; ; div ebx ;
; mov ebx,eax ; ebx:=Y ; mov ebx,eax ; ebx:=Y
; mov eax,edx ; eax:=X ; mov eax,edx ; eax:=X
@ -754,7 +752,7 @@ align 4
; xor edx,edx ; xor edx,edx
; mov ebx,[Screen_Max_X] ; mov ebx,[Screen_Max_X]
; inc ebx ; inc ebx
; sub eax,WinMapAddress ; sub eax,display_data
; div ebx ; div ebx
; mov ebx,eax ; mov ebx,eax
; mov eax,edx ; mov eax,edx
@ -778,7 +776,7 @@ vesa20_drawbackground_tiled:
mov ebx, [draw_data+32+RECT.top] ; y start mov ebx, [draw_data+32+RECT.top] ; y start
dp2: dp2:
mov ebp, [draw_data+32+RECT.left] ; x start mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] ; 1) Calculate pointers in display_data (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi] ; and LFB data (output for our function) [edi]
mov eax, [BytesPerScanLine] mov eax, [BytesPerScanLine]
mul ebx mul ebx
@ -794,7 +792,10 @@ dp2:
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi call calculate_edi
xchg edi, ebp xchg edi, ebp
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
add ebp, [_display_data]
; Now eax=x, ebx=y, edi->output, ebp=offset in display_data
; 2) Calculate offset in background memory block ; 2) Calculate offset in background memory block
push eax push eax
xor edx, edx xor edx, edx
@ -820,9 +821,9 @@ dp2:
; ecx = deltax - number of pixels left in current tile block ; ecx = deltax - number of pixels left in current tile block
; edx = 1 ; edx = 1
; esi -> bgr memory, edi -> output ; esi -> bgr memory, edi -> output
; ebp = offset in WinMapAddress ; ebp = offset in display_data
dp3: dp3:
cmp [ebp+WinMapAddress], dl cmp [ebp], dl
jnz nbgp jnz nbgp
movsb movsb
movsb movsb
@ -885,7 +886,7 @@ vesa20_drawbackground_stretch:
; External loop for all y from start to end ; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start mov ebx, [draw_data+32+RECT.top] ; y start
mov ebp, [draw_data+32+RECT.left] ; x start mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] ; 1) Calculate pointers in display_data (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi] ; and LFB data (output for our function) [edi]
mov eax, [BytesPerScanLine] mov eax, [BytesPerScanLine]
mul ebx mul ebx
@ -901,7 +902,7 @@ vesa20_drawbackground_stretch:
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi call calculate_edi
xchg edi, ebp xchg edi, ebp
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress ; Now eax=x, ebx=y, edi->output, ebp=offset in display_data
push ebx push ebx
push eax push eax
; 2) Calculate offset in background memory block ; 2) Calculate offset in background memory block
@ -955,7 +956,7 @@ sdp3:
; 4) Loop through redraw rectangle and copy background data ; 4) Loop through redraw rectangle and copy background data
; Registers meaning: ; Registers meaning:
; esi = offset in current line, edi -> output ; esi = offset in current line, edi -> output
; ebp = offset in WinMapAddress ; ebp = offset in display_data
; dword [esp] = offset in bgr data ; dword [esp] = offset in bgr data
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1) ; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1) ; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
@ -965,7 +966,8 @@ sdp3:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1) ; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1) ; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
sdp3a: sdp3a:
cmp [ebp+WinMapAddress], byte 1 mov eax, [_display_data]
cmp [ebp+eax], byte 1
jnz snbgp jnz snbgp
mov eax, [bgr_cur_line+esi] mov eax, [bgr_cur_line+esi]
test ecx, ecx test ecx, ecx