From 996be4829b9a093aad93358c9413cb29122935ca Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sun, 2 Jun 2013 09:36:14 +0000 Subject: [PATCH] kernel: minor optimizations git-svn-id: svn://kolibrios.org@3588 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/boot/bootvesa.inc | 2 +- kernel/trunk/const.inc | 5 ----- kernel/trunk/data32.inc | 12 +++++++--- kernel/trunk/gui/skincode.inc | 40 +++++++++++++++------------------- kernel/trunk/kernel.asm | 2 +- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/kernel/trunk/boot/bootvesa.inc b/kernel/trunk/boot/bootvesa.inc index b25a080c79..bcca3d071f 100644 --- a/kernel/trunk/boot/bootvesa.inc +++ b/kernel/trunk/boot/bootvesa.inc @@ -217,7 +217,7 @@ calc_vmodes_table: test [es:mi.ModeAttributes], 10000000b ;LFB ? jz @f - cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp + cmp [es:mi.BitsPerPixel], 32 ;It show only videomodes to have support 24 and 32 bpp jb @f ; cmp [es:mi.BitsPerPixel],16 diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 0507f3f4b0..f4b401b8b4 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -279,13 +279,8 @@ d_width_calc_area equ (OS_BASE+0x02CA000) RESERVED_PORTS equ (OS_BASE+0x02D0000) BOOT_VAR equ (OS_BASE+0x02E0000) -skin_data equ (OS_BASE+0x0318000) draw_data equ (OS_BASE+0x0320000) -BgrDrawMode equ (OS_BASE+0x0323FF4) -BgrDataWidth equ (OS_BASE+0x0323FF8) -BgrDataHeight equ (OS_BASE+0x0323FFC) - sys_pgmap equ (OS_BASE+0x0324000) UPPER_KERNEL_PAGES equ (OS_BASE+0x0400000) diff --git a/kernel/trunk/data32.inc b/kernel/trunk/data32.inc index 4795d3e942..c2c46cfae8 100644 --- a/kernel/trunk/data32.inc +++ b/kernel/trunk/data32.inc @@ -434,9 +434,15 @@ mouse_pause rd 1 redrawmouse_unconditional rd 1 -img_background rd 1 -mem_BACKGROUND rd 1 -static_background_data rd 1 +img_background rd 1 +mem_BACKGROUND rd 1 +static_background_data rd 1 + +BgrDrawMode rd 1 +BgrDataWidth rd 1 +BgrDataHeight rd 1 + +skin_data rd 1 cache_ide0: cache_ide0_pointer rd 1 diff --git a/kernel/trunk/gui/skincode.inc b/kernel/trunk/gui/skincode.inc index ed7bfa6c8d..e6fe5d652c 100644 --- a/kernel/trunk/gui/skincode.inc +++ b/kernel/trunk/gui/skincode.inc @@ -17,21 +17,16 @@ read_skin_file: stdcall load_file, ebx test eax, eax jz .notfound + cmp dword [eax], 'SKIN' jnz .noskin - cmp ebx, 32*1024 - jb @f - mov ebx, 32*1024 -;-------------------------------------- -align 4 -@@: - lea ecx, [ebx+3] - shr ecx, 2 - mov esi, eax - mov edi, skin_data - rep movsd - stdcall kernel_free, eax + xchg eax, [skin_data] + test eax, eax + jz @f + + stdcall kernel_free, eax +@@: call parse_skin_data xor eax, eax ret @@ -45,8 +40,7 @@ align 4 align 4 .noskin: stdcall kernel_free, eax - push 2 - pop eax + mov eax, 2 ret ;------------------------------------------------------------------------------ struct SKIN_HEADER @@ -98,7 +92,7 @@ load_default_skin: ;------------------------------------------------------------------------------ align 4 parse_skin_data: - mov ebp, skin_data + mov ebp, [skin_data] cmp [ebp+SKIN_HEADER.ident], 'SKIN' jne .exit @@ -109,7 +103,7 @@ parse_skin_data: rep stosd mov ebx, [ebp+SKIN_HEADER.params] - add ebx, skin_data + add ebx, [skin_data] mov eax, [ebx+SKIN_PARAMS.skin_height] mov [_skinh], eax mov eax, [ebx+SKIN_PARAMS.colors.inner] @@ -135,7 +129,7 @@ parse_skin_data: mov dword[_skinmargins+4], eax mov ebx, [ebp+SKIN_HEADER.bitmaps] - add ebx, skin_data + add ebx, [skin_data] ;-------------------------------------- align 4 .lp1: @@ -160,7 +154,7 @@ align 4 dec eax jnz .not_oper mov esi, [ebx+SKIN_BITMAPS.data] - add esi, skin_data + add esi, [skin_data] mov eax, [esi+0] neg eax mov edx, skin_active.oper.data @@ -195,7 +189,7 @@ align 4 align 4 .next_bitmap: mov ecx, [ebx+SKIN_BITMAPS.data] - add ecx, skin_data + add ecx, [skin_data] mov [edx+4], eax mov eax, [ecx+0] mov [edx+8], eax @@ -207,7 +201,7 @@ align 4 align 4 .end_bitmaps: mov ebx, [ebp+SKIN_HEADER.buttons] - add ebx, skin_data + add ebx, [skin_data] ;-------------------------------------- align 4 .lp2: @@ -396,7 +390,8 @@ _dw3l: ;-------------------------------------- align 4 @@: - cmp dword[skin_data], 'SKIN' + mov eax, [skin_data] + cmp [eax], dword 'SKIN' je @f xor eax, eax xor ebx, ebx @@ -438,7 +433,8 @@ draw_clientbar: ;-------------------------------------- align 4 _noinside2: - cmp dword[skin_data], 'SKIN' + mov eax, [skin_data] + cmp [eax], dword 'SKIN' jne no_skin_add_button ;* close button mov edi, [BTN_ADDR] diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 25e9f67c8e..278e482a63 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -2918,7 +2918,7 @@ sys_getbackground: jnz nogb1 mov eax, [BgrDataWidth] shl eax, 16 - mov ax, [BgrDataHeight] + mov ax, word [BgrDataHeight] mov [esp+32], eax ret ;------------------------------------------------------------------------------