From 3a719cd911c98e3ffd9f14d1d3f2b75d83bd5885 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 29 Jul 2008 15:39:22 +0000 Subject: [PATCH] allocate memory for display_data git-svn-id: svn://kolibrios.org@840 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/kolibri_pe/const.inc | 11 +++----- kernel/branches/kolibri_pe/core/dll.inc | 17 ++++++------ kernel/branches/kolibri_pe/core/memory.inc | 2 -- kernel/branches/kolibri_pe/core/taskman.inc | 3 +-- kernel/branches/kolibri_pe/data32.inc | 6 +++-- kernel/branches/kolibri_pe/gui/window.inc | 4 +-- kernel/branches/kolibri_pe/hid/mousedrv.inc | 6 ++--- kernel/branches/kolibri_pe/kernel.asm | 20 +++++++++----- kernel/branches/kolibri_pe/video/vesa12.inc | 12 +++++---- kernel/branches/kolibri_pe/video/vesa20.inc | 30 +++++++++++---------- 10 files changed, 60 insertions(+), 51 deletions(-) diff --git a/kernel/branches/kolibri_pe/const.inc b/kernel/branches/kolibri_pe/const.inc index ac410fb7d0..fa93060dfe 100644 --- a/kernel/branches/kolibri_pe/const.inc +++ b/kernel/branches/kolibri_pe/const.inc @@ -323,17 +323,14 @@ 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) +;display_data equ (OS_BASE+0x033C000) ;1024*1280=0x140000 + +virtual at (OS_BASE+0x033CF80) tss TSS end virtual -sys_pgmap equ (OS_BASE+0x047F000) - - -new_app_base equ 0; +sys_pgmap equ (OS_BASE+0x033F000) twdw equ 0x3000 ;(CURRENT_TASK-window_data) diff --git a/kernel/branches/kolibri_pe/core/dll.inc b/kernel/branches/kolibri_pe/core/dll.inc index d54157fc61..4eb0d5edd5 100644 --- a/kernel/branches/kolibri_pe/core/dll.inc +++ b/kernel/branches/kolibri_pe/core/dll.inc @@ -1040,14 +1040,15 @@ proc load_library stdcall, file_name:dword @@: mov edx, [coff] - movzx ebx, [edx+CFH.nSections] - mov edi, new_app_base - lea eax, [edx+20] -@@: - add [eax+CFS.VirtualAddress], edi ;patch user space offset - add eax, COFF_SECTION_SIZE - dec ebx - jnz @B + +; movzx ebx, [edx+CFH.nSections] +; xor edi, edi +; lea eax, [edx+20] +;@@: +; add [eax+CFS.VirtualAddress], edi ;patch user space offset +; add eax, COFF_SECTION_SIZE +; dec ebx +; jnz @B add edx, 20 stdcall fix_coff_relocs, [coff], edx, [sym] diff --git a/kernel/branches/kolibri_pe/core/memory.inc b/kernel/branches/kolibri_pe/core/memory.inc index 820b560815..9379577232 100644 --- a/kernel/branches/kolibri_pe/core/memory.inc +++ b/kernel/branches/kolibri_pe/core/memory.inc @@ -333,8 +333,6 @@ proc init_LFB @@: call init_mtrr - xchg bx, bx - mov eax, [LFBAddress] or eax, PG_LARGE+PG_UW mov [sys_pgdir+(LFB_BASE shr 20)], eax diff --git a/kernel/branches/kolibri_pe/core/taskman.inc b/kernel/branches/kolibri_pe/core/taskman.inc index 5db308ae45..57dfa84ed2 100644 --- a/kernel/branches/kolibri_pe/core/taskman.inc +++ b/kernel/branches/kolibri_pe/core/taskman.inc @@ -998,8 +998,7 @@ proc set_app_params stdcall,slot:dword, params:dword,\ rep movsd shr ebx,3 - mov eax, new_app_base - mov dword [CURRENT_TASK+ebx+0x10],eax + mov dword [CURRENT_TASK+ebx+0x10], 0 .add_command_line: mov edx,[params] diff --git a/kernel/branches/kolibri_pe/data32.inc b/kernel/branches/kolibri_pe/data32.inc index 541b19007c..19969b255a 100644 --- a/kernel/branches/kolibri_pe/data32.inc +++ b/kernel/branches/kolibri_pe/data32.inc @@ -191,14 +191,14 @@ app_code_l: dw 0 db 0 db cpl3 - dw G32+D32+(new_app_base shr 16)+0xF; + dw G32+D32+0xF; app_data_l: dw 0xFFFF dw 0 db 0 db drw3 - dw G32+D32+(new_app_base shr 16)+0xF; + dw G32+D32+0xF; ; ------------- PCI BIOS ------------------ @@ -349,6 +349,8 @@ LFBSize rd 1 stall_mcs rd 1 current_slot rd 1 +_display_data rd 1 + ; status hd1_status rd 1 ; 0 - free : other - pid application_table_status rd 1 ; 0 - free : other - pid diff --git a/kernel/branches/kolibri_pe/gui/window.inc b/kernel/branches/kolibri_pe/gui/window.inc index aa970f3ce1..003deb9668 100644 --- a/kernel/branches/kolibri_pe/gui/window.inc +++ b/kernel/branches/kolibri_pe/gui/window.inc @@ -183,7 +183,7 @@ pushad inc edi imul edi, ebx add edi, eax - add edi, WinMapAddress + add edi, [_display_data] .new_y: push ecx ; sx @@ -244,7 +244,7 @@ pushad inc eax imul eax, ebx add eax, [esp] - add eax, WinMapAddress + add eax, [_display_data] mov ebp, eax mov edi, [edi+APPDATA.wnd_shape] diff --git a/kernel/branches/kolibri_pe/hid/mousedrv.inc b/kernel/branches/kolibri_pe/hid/mousedrv.inc index 4682153996..0e795183ee 100644 --- a/kernel/branches/kolibri_pe/hid/mousedrv.inc +++ b/kernel/branches/kolibri_pe/hid/mousedrv.inc @@ -111,8 +111,8 @@ save_draw_mouse: mov ecx, [Screen_Max_X] inc ecx mul ecx - - movzx edx, byte [display_data+ebx+eax] + add eax, [_display_data] + movzx edx, byte [ebx+eax] shl edx, 8 mov esi, [edx+SLOT_BASE+APPDATA.cursor] @@ -292,7 +292,7 @@ __sys_disable_mouse: inc ecx imul ecx,ebx add ecx,eax - add ecx, display_data + add ecx, [_display_data] mov eax, [CURRENT_TASK] movzx ebx, byte [ecx] cmp eax,ebx diff --git a/kernel/branches/kolibri_pe/kernel.asm b/kernel/branches/kolibri_pe/kernel.asm index aa405857ff..b81c35bb82 100644 --- a/kernel/branches/kolibri_pe/kernel.asm +++ b/kernel/branches/kolibri_pe/kernel.asm @@ -609,6 +609,10 @@ high_code: add eax, ebx 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 \ (unpack.lc+unpack.lp)))*4 @@ -1315,8 +1319,8 @@ display_number_force: jne displnl1 mov ebp,ebx add ebp,4 - mov ebp,[ebp+std_application_base_address] - mov ebx,[ebx+std_application_base_address] + mov ebp,[ebp] + mov ebx,[ebx] displnl1: sub esp,64 @@ -2677,7 +2681,7 @@ sys_cpuusage: cmp ecx, 1 shl 5 je .os_mem mov edx, [SLOT_BASE+ecx*8+APPDATA.mem_size] - mov eax, std_application_base_address + xor eax, eax .os_mem: stosd lea eax, [edx-1] @@ -3444,9 +3448,13 @@ checkpixel: push eax edx mov edx,[Screen_Max_X] ; screen x size - inc edx + mov ecx, [_display_data] + + inc edx imul edx, ebx - mov dl, [eax+edx+display_data] ; lea eax, [...] + + add edx, ecx + mov dl, [eax+edx] ; lea eax, [...] xor ecx, ecx mov eax, [CURRENT_TASK] @@ -3701,7 +3709,7 @@ calculatebackground: ; background cld 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 ecx,1280*1024 / 4 rep stosd diff --git a/kernel/branches/kolibri_pe/video/vesa12.inc b/kernel/branches/kolibri_pe/video/vesa12.inc index b44488ebe6..ebe2fe3fba 100644 --- a/kernel/branches/kolibri_pe/video/vesa12.inc +++ b/kernel/branches/kolibri_pe/video/vesa12.inc @@ -327,7 +327,9 @@ vesa12_drawbackground: mov eax,[Screen_Max_X] add eax,1 mul ebx - cmp [eax+esi+WinMapAddress],byte 1 + mov ebx, [_display_data] + add ebx, esi + cmp [eax+ebx],byte 1 jnz v12nbgp mov eax,[BytesPerScanLine] mov ebx,edi @@ -494,7 +496,7 @@ dbpi24bit12: sub eax,VGABasePtr mov ebx,3 div ebx - add eax,WinMapAddress + add eax, [_display_data] mov ebx,[CURRENT_TASK] cld @@ -585,7 +587,7 @@ dbpi24bit12: mov eax,edi sub eax,VGABasePtr shr eax,2 - add eax,WinMapAddress + add eax, [_display_data] mov ebx,[CURRENT_TASK] cld @@ -830,7 +832,7 @@ vesa12_putimage: sub edx,VGABasePtr mov ebx,3 div ebx - add edx,WinMapAddress + add edx,[_display_data] mov ebx,[CURRENT_TASK] mov bh,[esp+4*3] @@ -899,7 +901,7 @@ vesa12_putimage: mov edx,edi sub edx,VGABasePtr shr edx,2 - add edx,WinMapAddress + add edx, [_display_data] mov ebx,[CURRENT_TASK] mov bh,[esp+4*3] diff --git a/kernel/branches/kolibri_pe/video/vesa20.inc b/kernel/branches/kolibri_pe/video/vesa20.inc index 38a94b0c0c..b87d23586b 100644 --- a/kernel/branches/kolibri_pe/video/vesa20.inc +++ b/kernel/branches/kolibri_pe/video/vesa20.inc @@ -28,8 +28,6 @@ $Revision$ ;BytesPerScanLine equ 0xfe08 ;LFBAddress equ 0xfe80 ;ScreenBPP equ 0xfbf1 -;WinMapAddress equ 0x460000 - ;************************************************* @@ -200,7 +198,7 @@ vesa20_putimage: imul eax, [Screen_Max_X] add eax, [putimg.abs_cy] add eax, [putimg.abs_cx] - add eax, WinMapAddress + add eax, [_display_data] xchg eax, ebp ; get process number mov ebx, [CURRENT_TASK] @@ -629,7 +627,7 @@ vesa20_drawbar: imul eax, [Screen_Max_X] add eax, [drbar.abs_cy] add eax, [drbar.abs_cx] - add eax, WinMapAddress + add eax, [_display_data] xchg eax, ebp ; get process number mov ebx, [CURRENT_TASK] @@ -728,7 +726,7 @@ align 4 ; mov eax,ebp ; mov ebx,[Screen_Max_X] ; Screen_X_size ; inc ebx ; +1 -; sub eax,WinMapAddress ; -AddrBuffer +; sub eax,display_data ; -AddrBuffer ; div ebx ; ; mov ebx,eax ; ebx:=Y ; mov eax,edx ; eax:=X @@ -754,7 +752,7 @@ align 4 ; xor edx,edx ; mov ebx,[Screen_Max_X] ; inc ebx -; sub eax,WinMapAddress +; sub eax,display_data ; div ebx ; mov ebx,eax ; mov eax,edx @@ -778,7 +776,7 @@ vesa20_drawbackground_tiled: mov ebx, [draw_data+32+RECT.top] ; y start dp2: 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] mov eax, [BytesPerScanLine] mul ebx @@ -794,7 +792,10 @@ dp2: ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB call calculate_edi 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 push eax xor edx, edx @@ -820,9 +821,9 @@ dp2: ; ecx = deltax - number of pixels left in current tile block ; edx = 1 ; esi -> bgr memory, edi -> output -; ebp = offset in WinMapAddress +; ebp = offset in display_data dp3: - cmp [ebp+WinMapAddress], dl + cmp [ebp], dl jnz nbgp movsb movsb @@ -885,7 +886,7 @@ vesa20_drawbackground_stretch: ; External loop for all y from start to end mov ebx, [draw_data+32+RECT.top] ; y 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] mov eax, [BytesPerScanLine] mul ebx @@ -901,7 +902,7 @@ vesa20_drawbackground_stretch: ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB call calculate_edi 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 eax ; 2) Calculate offset in background memory block @@ -955,7 +956,7 @@ sdp3: ; 4) Loop through redraw rectangle and copy background data ; Registers meaning: ; esi = offset in current line, edi -> output -; ebp = offset in WinMapAddress +; ebp = offset in display_data ; dword [esp] = offset in bgr data ; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-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+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1) sdp3a: - cmp [ebp+WinMapAddress], byte 1 + mov eax, [_display_data] + cmp [ebp+eax], byte 1 jnz snbgp mov eax, [bgr_cur_line+esi] test ecx, ecx