fixed kernel malfunction when loading a program with mem_size > os_base .

git-svn-id: svn://kolibrios.org@9794 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2022-04-26 13:09:12 +00:00
parent 90df188638
commit 906a16d3a2

View File

@ -234,6 +234,17 @@ test_app_header:
mov [ebx + APP_HDR.eip], ecx
mov edx, [APP_HEADER_00.mem_size]
mov [ebx + APP_HDR._emem], edx
cmp edx, [APP_HEADER_00.i_end]
jb .fail
cmp edx, OS_BASE ;check memory
jae .fail
mov ecx, [pg_data.pages_free]
shl ecx, 12 ; ecx * 4kb
cmp edx, ecx
jae .fail
shr edx, 1
sub edx, 0x10
mov [ebx + APP_HDR.esp], edx
@ -261,6 +272,12 @@ test_app_header:
cmp edx, [APP_HEADER_01.i_end]
jb .fail
; \end{diamond}[20.08.2006]
cmp edx, OS_BASE ;check memory
jae .fail
mov ecx, [pg_data.pages_free]
shl ecx, 12 ; ecx * 4kb
cmp edx, ecx
jae .fail
mov [ebx + APP_HDR._emem], edx
mov ecx, [APP_HEADER_01.stack_top]