From 0226898ca6c80348f87ef1a6924461fe60547a36 Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Fri, 29 May 2009 19:28:27 +0000 Subject: [PATCH] Work with small amount of physical memory corrected (bug #9, part 1) git-svn-id: svn://kolibrios.org@1090 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/heap.inc | 7 +++++-- kernel/trunk/init.inc | 11 +---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/kernel/trunk/core/heap.inc b/kernel/trunk/core/heap.inc index 3a87383921..8319e1726c 100644 --- a/kernel/trunk/core/heap.inc +++ b/kernel/trunk/core/heap.inc @@ -138,8 +138,11 @@ proc init_kernel_heap mov [ebx+list_bk], eax mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK_SIZE - mov ecx, [MEM_AMOUNT] - sub ecx, (HEAP_BASE - OS_BASE + 4096*MEM_BLOCK_SIZE) + mov ecx, [pg_data.kernel_pages] + shl ecx, 12 + neg ecx + add ecx, [MEM_AMOUNT] + sub ecx, 4096*MEM_BLOCK_SIZE mov [heap_size], ecx mov [heap_free], ecx mov [ebx+block_size], ecx diff --git a/kernel/trunk/init.inc b/kernel/trunk/init.inc index 6bc82e61d6..274dcf7222 100644 --- a/kernel/trunk/init.inc +++ b/kernel/trunk/init.inc @@ -43,7 +43,6 @@ proc init_mem mov [pg_data.mem_amount-OS_BASE], eax shr eax, 12 - mov edx, eax mov [pg_data.pages_count-OS_BASE], eax shr eax, 3 mov [pg_data.pagemap_size-OS_BASE], eax @@ -52,15 +51,7 @@ proc init_mem and eax, not 4095 mov [tmp_page_tabs], eax - cmp edx, (OS_BASE/4096) - jbe @F - mov edx, (OS_BASE/4096) - jmp .set -@@: - cmp edx, (HEAP_MIN_SIZE/4096) - jae .set - mov edx, (HEAP_MIN_SIZE/4096) -.set: + mov edx, (((sys_pgmap-OS_BASE) + 0xFFFFFF) and not 0xFFFFFF) shr 12 mov [pg_data.kernel_pages-OS_BASE], edx shr edx, 10 mov [pg_data.kernel_tables-OS_BASE], edx