From 4c1ad6f2c7eb307d24a414a62fa37b70b2373436 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sun, 20 May 2007 10:01:18 +0000 Subject: [PATCH] align heap_base on 4Mb border move sys_pgmap at the top of kernel memory git-svn-id: svn://kolibrios.org@513 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 11 +++++----- kernel/trunk/fs/parse_fn.inc | 2 +- kernel/trunk/init.inc | 42 ++++++++++++++++++------------------ kernel/trunk/kernel.asm | 3 ++- kernel/trunk/memmap.inc | 36 +++++++++++++++---------------- 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 64d2074c9f..8960939241 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -266,6 +266,9 @@ TMP_STACK_TOP equ 0x003EC00 FONT_II equ (OS_BASE+0x003EC00) FONT_I equ (OS_BASE+0x003F600) DRIVE_DATA equ (OS_BASE+0x0040000) + +sys_pgdir equ (OS_BASE+0x0050000) + SLOT_BASE equ (OS_BASE+0x0080000) ;unused @@ -304,9 +307,10 @@ end virtual WinMapAddress equ (OS_BASE+0x043F000) display_data equ (OS_BASE+0x043F000) -tmp_page_tab equ 0x057F000; +sys_pgmap equ (OS_BASE+0x057F000) -HEAP_BASE equ (OS_BASE+tmp_page_tab) + +HEAP_BASE equ (OS_BASE+0x0800000) HEAP_MIN_SIZE equ 0x01000000 page_tabs equ 0xFDC00000 @@ -316,9 +320,6 @@ master_tab equ (page_tabs+ (page_tabs shr 10)) ;0xFDFF70000 LFB_BASE equ 0xFE000000 -sys_pgdir equ (OS_BASE+0x00050000) -sys_pgmap equ (OS_BASE+0x00052000) - new_app_base equ 0; diff --git a/kernel/trunk/fs/parse_fn.inc b/kernel/trunk/fs/parse_fn.inc index ecc80ff000..95c67b1ccb 100644 --- a/kernel/trunk/fs/parse_fn.inc +++ b/kernel/trunk/fs/parse_fn.inc @@ -12,7 +12,7 @@ full_file_name_table dd 0 ; ука ; перебирает по файлу варианты замен proc full_file_name stdcall,sourc,dest locals - tmpsrc rb 60 ; временное хранение преобразования + tmpsrc rb 260 ; временное хранение преобразования endl pushad mov esi,[sourc] diff --git a/kernel/trunk/init.inc b/kernel/trunk/init.inc index eacc1413ff..a91c6681f5 100644 --- a/kernel/trunk/init.inc +++ b/kernel/trunk/init.inc @@ -40,6 +40,10 @@ proc init_mem shr eax, 3 mov [pg_data.pagemap_size-OS_BASE], eax + add eax, (sys_pgmap-OS_BASE)+4095 + and eax, not 4095 + mov [tmp_page_tabs], eax + cmp edx, (OS_BASE/4096) jbe @F mov edx, (OS_BASE/4096) @@ -74,21 +78,23 @@ proc init_mem or ebx, CR4_PGE @@: mov cr4, ebx - sub [pg_data.kernel_tables-OS_BASE], 1 + dec [pg_data.kernel_tables-OS_BASE] mov [edx], eax add eax, 0x00400000 -; mov [edx+4], eax add edx, 4 mov eax, 0x400000+PG_SW - mov ecx, (tmp_page_tab-0x400000)/4096 + mov ecx, [tmp_page_tabs] + sub ecx, 0x400000 + shr ecx, 12 ;ecx/=4096 jmp .map_low .no_PSE: mov eax, PG_SW - mov ecx, tmp_page_tab/4096 + mov ecx, [tmp_page_tabs] + shr ecx, 12 .map_low: - mov edi, tmp_page_tab + mov edi, [tmp_page_tabs] @@: ; stosd add eax, 0x1000 @@ -101,7 +107,8 @@ proc init_mem rep stosd mov ecx, [pg_data.kernel_tables-OS_BASE] - mov eax, tmp_page_tab+PG_SW + mov eax, [tmp_page_tabs] + or eax, PG_SW mov edi, edx .map_kernel_tabs: @@ -131,29 +138,23 @@ align 4 proc init_page_map mov edi, sys_pgmap-OS_BASE - mov ecx, ((HEAP_BASE-OS_BASE)/4096)/32 ;384/4 - mov ebx, ecx - xor eax,eax + mov ecx, [pg_data.pagemap_size-OS_BASE] + shr ecx, 2 + or eax, -1 cld rep stosd - not eax - mov ecx, [pg_data.pagemap_size-OS_BASE] - sub ecx, ebx - shr ecx, 2 - rep stosd - - lea edi, [sys_pgmap-OS_BASE+ebx*4] ;+384 + mov ecx, [tmp_page_tabs] mov edx, [pg_data.pages_count-OS_BASE] - mov ecx, [pg_data.kernel_tables-OS_BASE] - add ecx, ((HEAP_BASE-OS_BASE)/4096) and 31 - sub edx, (HEAP_BASE-OS_BASE)/4096 + shr ecx, 12 + add ecx, [pg_data.kernel_tables-OS_BASE] sub edx, ecx mov [pg_data.pages_free-OS_BASE], edx - xor eax, eax + mov edi, sys_pgmap-OS_BASE mov ebx, ecx shr ecx, 5 + xor eax, eax rep stosd not eax @@ -169,7 +170,6 @@ proc init_page_map mov [page_end-OS_BASE], ebx mov [pg_data.pg_mutex-OS_BASE], 0 - ret endp diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 903f354a5e..77ce857265 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -251,7 +251,8 @@ B32: lgdt [gdts] jmp pword os_code:high_code - +align 4 +tmp_page_tabs dd ? use16 org $-0x10000 include "boot/shutdown.inc" ; shutdown or restart diff --git a/kernel/trunk/memmap.inc b/kernel/trunk/memmap.inc index 5d37af7194..1d86c0c7b5 100644 --- a/kernel/trunk/memmap.inc +++ b/kernel/trunk/memmap.inc @@ -128,9 +128,8 @@ ; 0x80040000 -> 4FFFF data of retrieved disks and partitions (Mario79) ; 0x80050000 -> 50FFF main page directory -; 0x80050200 -> 5FFFF pages bitmap +; 0x80051000 -> 7FFFF free (188 Kb) -; 0x80060000 -> 7FFFF free (128 Kb) ; 0x80080000 -> 8FFFF additional app info, in 256 byte steps - 256 entries ; ; 00 11db name of app running @@ -205,29 +204,28 @@ ; 0x802E0000 -> 2EFFFF irq data area ; 0x802F0000 -> 2FFFFF low memory save ; -; 0x80300000 -> 45FFFF background image, max 1,375 M +; 0x80300000 -> 400000 hd cache + +; 0x80400000 -> 41FFFF tcp memory 128 Kb +; 0x80420000 -> 427FFF tcp memory 32 Kb ; -; 0x80460000 -> 5FFFFF display info -; -; 0x80600000 -> 6FFFFF hd cache -; -; 0x80700000 -> 71ffff tcp memory 128 Kb -; 0x80720000 -> 75ffff free (256 kb) -; -; 0x80760000 -> 76ffff !vrr driver -; 0x80770000 -> 777fff tcp memory 32 Kb -; -; 0x80780000 -> 0x80782FFF draw data - 256 entries +; 0x80428000 -> 42FFFF !vrr driver 32 Kb + +; 0x80430000 -> 477FFF skin data + +; 0x80438000 -> 43AFFF draw data - 256 entries ; 00 dword draw limit - x start ; 04 dword draw limit - y start ; 08 dword draw limit - x end ; 0C dword draw limit - y end + +; 0x8043BF80 -> 43BFFF TSS 128 bytes +; 0x8043C000 -> 43DFFF IO map for (8192*8)=65536 ports + +; 0x8043F000 -> 57EFFF display info +; 0x8057F000 -> 58FFFF page map max 128 Kb ; -; 0x80783F80 -> 0x80783FFF TSS 128 bytes -; -; 0x80784000 -> 0x80785FFF IO map for (8192*8)=65536 ports -; -; 0x80786000 -> kernel heap +; 0x80800000 -> kernel heap ; 0x81FFFFFF heap min limit ; 0xFDBFFFFF heap max limit