From a37530d3dc684fd0da0b6c2ae29a7ddc40728c56 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Fri, 25 Jul 2008 09:09:18 +0000 Subject: [PATCH] fix memory allocation git-svn-id: svn://kolibrios.org@835 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/fasm/trunk/system.inc | 34 ++++++++++++-------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/programs/develop/fasm/trunk/system.inc b/programs/develop/fasm/trunk/system.inc index fb610f453e..26c1c0af08 100644 --- a/programs/develop/fasm/trunk/system.inc +++ b/programs/develop/fasm/trunk/system.inc @@ -54,28 +54,24 @@ file_info_debug: _ramdisk db '/RD/1/' filepos dd 0x0 -; info by Privalov: starting from FASM 1.51 -; ~3/8 - additional memory -; ~5/8 - main memory + init_memory: - mcall 18, 16 - cmp ecx, 0x38000000 shr 9 - jbe @f - mov ecx, 0x38000000 shr 9 -@@: - shl ecx, 9 + + mov ecx, 16*1024*1024 + + allocate_memory: + mov [memory_setting],ecx mcall 68, 12 - mov [memory_start], eax - mov [memblock], eax - push eax - add eax, ecx - mov [additional_memory_end], eax - pop eax - shr ecx, 3 - add eax, ecx - lea eax, [ecx*4+eax] - mov [memory_end],eax + or eax,eax + jz out_of_memory mov [additional_memory],eax + add eax,[memory_setting] + mov [memory_end],eax + mov eax,[memory_setting] + shr eax,2 + add eax,[additional_memory] + mov [additional_memory_end],eax + mov [memory_start],eax ret exit_program: