From 763bc3ad705e9fdbd74f8e27ebfbf3dbd9d60bcd Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Thu, 16 Nov 2006 05:47:31 +0000 Subject: [PATCH] 1)fixed bug in kernel_alloc_space 2)support for loading compressed files git-svn-id: svn://kolibrios.org@211 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/dll.inc | 15 +++++++++++++++ kernel/trunk/core/heap.inc | 4 ++-- kernel/trunk/core/memory.inc | 15 ++++++++++----- kernel/trunk/core/taskman.inc | 2 +- kernel/trunk/kernel.asm | 2 +- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/kernel/trunk/core/dll.inc b/kernel/trunk/core/dll.inc index 7a49136b32..52c4e829a6 100644 --- a/kernel/trunk/core/dll.inc +++ b/kernel/trunk/core/dll.inc @@ -516,6 +516,7 @@ proc load_file stdcall, file_name:dword file_size dd ? file dd ? + file2 dd ? endl lea eax, [attr] @@ -531,7 +532,21 @@ proc load_file stdcall, file_name:dword stdcall read_file, [file_name], eax, dword 0, [file_size] cmp ebx, [file_size] jne .cleanup + mov eax, [file] + cmp dword [eax], 0x4B43504B + jne .exit + + stdcall kernel_alloc, [eax+4] + + test eax, eax + jz .cleanup + + mov [file2], eax + stdcall unpack, [file], eax + stdcall kernel_free, [file] + mov eax, [file2] +.exit: ret .cleanup: stdcall kernel_free, [file] diff --git a/kernel/trunk/core/heap.inc b/kernel/trunk/core/heap.inc index f69b6b7716..e27485d819 100644 --- a/kernel/trunk/core/heap.inc +++ b/kernel/trunk/core/heap.inc @@ -319,9 +319,9 @@ proc alloc_kernel_space stdcall, size:dword remove_from_list edi mov ecx, [block_ind] - mov [mem_block_list+ecx*4], ebx + mov [mem_block_list+ecx*4], edx - test ebx, ebx + test edx, edx jnz @f btr [mem_block_mask], ecx @@: diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 4ada923b89..e0f038d25c 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -281,20 +281,19 @@ endp align 4 proc init_LFB - cmp dword [LFBAddress], -1 jne @f - mov [0x2f0000+0x901c],byte 2 stdcall kernel_alloc, 0x280000 mov [LFBAddress], eax - ret @@: test [SCR_MODE],word 0100000000000000b - jz @f - call map_LFB + jnz @f + mov [0x2f0000+0x901c],byte 2 + ret @@: + call map_LFB ret endp @@ -1073,6 +1072,9 @@ proc test_cpu endl mov [cpu_type], 0 + xor eax, eax + mov [cpu_caps], eax + mov [cpu_caps+4], eax pushfd pop eax @@ -1163,6 +1165,9 @@ proc init_mtrr cmp [0x2f0000+0x901c],byte 2 je .exit + bt [cpu_caps], CAPS_MTRR + jnc .exit + mov eax, cr0 or eax, 0x60000000 ;disable caching mov cr0, eax diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index ed197f9203..5bd10138a4 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -605,7 +605,7 @@ proc add_app_parameters stdcall,slot:dword,img_base:dword,\ cmd_line:dword, app_path:dword, flags:dword mov eax,[slot] - bt [cpu_caps], CAPS_SSE + bt [cpu_caps], CAPS_FXSR jnc .no_SSE shl eax, 8 mov ebx, eax diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 2260fe22ee..3f08f0803e 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -1245,7 +1245,7 @@ display_number: ; ecx = x shl 16 + y ; edx = color xor edi, edi -display_number_force: +display_number_force: cmp eax,0xffff ; length > 0 ? jge cont_displ