fix memory allocation

git-svn-id: svn://kolibrios.org@835 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-07-25 09:09:18 +00:00
parent 93caed27c6
commit a37530d3dc

View File

@ -54,28 +54,24 @@ file_info_debug:
_ramdisk db '/RD/1/' _ramdisk db '/RD/1/'
filepos dd 0x0 filepos dd 0x0
; info by Privalov: starting from FASM 1.51
; ~3/8 - additional memory
; ~5/8 - main memory
init_memory: init_memory:
mcall 18, 16
cmp ecx, 0x38000000 shr 9 mov ecx, 16*1024*1024
jbe @f
mov ecx, 0x38000000 shr 9 allocate_memory:
@@: mov [memory_setting],ecx
shl ecx, 9
mcall 68, 12 mcall 68, 12
mov [memory_start], eax or eax,eax
mov [memblock], eax jz out_of_memory
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
mov [additional_memory],eax 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 ret
exit_program: exit_program: