From 999126566d75127101e692588337e91b505adf95 Mon Sep 17 00:00:00 2001 From: "Artem Jerdev (art_zh)" Date: Thu, 22 Apr 2010 15:33:55 +0000 Subject: [PATCH] 1) back to #1451 to save some phys. memory 2) non-PSE paging restored 3) documentation corrected git-svn-id: svn://kolibrios.org@1455 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/init.inc | 25 +++++++++++++++++++++---- kernel/trunk/memmap.inc | 6 +++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/kernel/trunk/init.inc b/kernel/trunk/init.inc index a2b965bd66..54ba0d6e40 100644 --- a/kernel/trunk/init.inc +++ b/kernel/trunk/init.inc @@ -129,8 +129,8 @@ proc init_mem rep stosd mov edx, (sys_pgdir-OS_BASE)+ 0x800; (OS_BASE shr 20) -; bt [cpu_caps-OS_BASE], CAPS_PSE -; jnc .no_PSE + bt [cpu_caps-OS_BASE], CAPS_PSE + jnc .no_PSE mov ebx, cr4 or ebx, CR4_PSE @@ -142,6 +142,20 @@ proc init_mem add edx, 4 mov edi, [tmp_page_tabs] + jmp .map_kernel_heap ; new kernel fits to the first 4Mb - nothing to do with ".map_low" +.no_PSE: + mov eax, PG_SW + mov ecx, [tmp_page_tabs] + shr ecx, 12 +.map_low: + mov edi, [tmp_page_tabs] +@@: ; + stosd + add eax, 0x1000 + dec ecx + jnz @B + +.map_kernel_heap: mov ecx, [pg_data.kernel_tables-OS_BASE] shl ecx, 10 xor eax, eax @@ -151,7 +165,7 @@ proc init_mem mov eax, [tmp_page_tabs] or eax, PG_SW mov edi, edx - + .map_kernel_tabs: stosd add eax, 0x1000 @@ -227,8 +241,10 @@ proc init_page_map jnz .scanmap ; mark kernel memory as allocated (unavailable) - mov ecx, (UPPER_KERNEL_PAGES-OS_BASE)/4096 + mov ecx, [tmp_page_tabs] mov edx, [pg_data.pages_count-OS_BASE] + shr ecx, 12 + add ecx, [pg_data.kernel_tables-OS_BASE] sub edx, ecx mov [pg_data.pages_free-OS_BASE], edx @@ -416,3 +432,4 @@ proc test_cpu ret endp + diff --git a/kernel/trunk/memmap.inc b/kernel/trunk/memmap.inc index 6a30a647e2..73bb649519 100644 --- a/kernel/trunk/memmap.inc +++ b/kernel/trunk/memmap.inc @@ -242,11 +242,11 @@ ; 0C dword draw limit - y end ; 0x80339000 -> 3BFFF3 free (12k) ; 0x8033BFF4 -> 33BFFF background info -; 0x8033C000 -> 35BFFF page map (128k) +; 0x8033C000 -> 3??FFF page map: 1bit per page; size = mem_size>>15 (max: 128k) +; 0x003??000 -> 3??FFF phys. location of system PTE head (12kb min); ; ===================================== -; 0x8035C000 -> 5FFF7F free (2M7) ; 0x805FFF80 -> 5FFFFF TSS (128) -; 0x80600000 -> 7FFFFF free (2M) +; 0x80600000 -> 7FFFFF extra kernel data structutes(2M max) ; ===================================== ; 0x80800000 -> kernel heap ; 0x80FFFFFF heap min limit