565,7 → 565,8 |
align 4 |
proc init_heap |
|
mov ebx, [current_process] |
mov ebx, [current_slot] |
mov ebx, [ebx+APPDATA.process] |
mov eax, [ebx+PROC.heap_top] |
test eax, eax |
jz @F |
601,7 → 602,8 |
add ecx, (4095+PAGE_SIZE) |
and ecx, not 4095 |
|
mov ebx, [current_process] |
mov ebx, [current_slot] |
mov ebx, [ebx+APPDATA.process] |
mov esi, dword [ebx+PROC.heap_base] ; heap_base |
mov edi, dword [ebx+PROC.heap_top] ; heap_top |
.scan: |
637,7 → 639,9 |
jnz @B |
.no: |
|
mov edx, [current_process] |
mov edx, [current_slot] |
mov edx, [edx+APPDATA.process] |
|
mov ebx, [alloc_size] |
add ebx, 0xFFF |
and ebx, not 0xFFF |
672,7 → 676,8 |
push esi |
push edi |
|
mov ebx, [current_process] |
mov ebx, [current_slot] |
mov ebx, [ebx+APPDATA.process] |
|
mov edx, [address] |
and edx, not 0xFFF |
748,7 → 753,9 |
mov [page_tabs+ebx*4], ecx |
|
.nothird: |
mov edx, [current_process] |
mov edx, [current_slot] |
mov edx, [edx+APPDATA.process] |
|
mov ebx, [alloc_size] |
add ebx, 0xFFF |
and ebx, not 0xFFF |
808,7 → 815,8 |
.released: |
push edi |
|
mov edx, [current_process] |
mov edx, [current_slot] |
mov edx, [edx+APPDATA.process] |
mov esi, dword [edx+PROC.heap_base] |
mov edi, dword [edx+PROC.heap_top] |
sub ebx, [edx+PROC.mem_used] |
996,7 → 1004,8 |
jnz .nofreeall |
mov eax, [page_tabs+ecx*4] |
and eax, not 0xFFF |
mov edx, [current_process] |
mov edx, [current_slot] |
mov edx, [edx+APPDATA.process] |
mov ebx, [edx+PROC.mem_used] |
sub ebx, eax |
add ebx, 0x1000 |
1017,7 → 1026,8 |
shr ebx, 12 |
sub ebx, edx |
push ebx ecx edx |
mov edx, [current_process] |
mov edx, [current_slot] |
mov edx, [edx+APPDATA.process] |
shl ebx, 12 |
sub ebx, [edx+PROC.mem_used] |
neg ebx |
1031,7 → 1041,8 |
shl ebx, 12 |
jz .ret |
push esi |
mov esi, [current_process] |
mov esi, [current_slot] |
mov esi, [esi+APPDATA.process] |
mov esi, [esi+PROC.heap_top] |
shr esi, 12 |
@@: |
1055,7 → 1066,8 |
ret |
.realloc_add: |
; get some additional memory |
mov eax, [current_process] |
mov eax, [current_slot] |
mov eax, [eax+APPDATA.process] |
mov eax, [eax+PROC.heap_top] |
shr eax, 12 |
cmp edx, eax |
1088,7 → 1100,8 |
cld |
rep stosd |
pop edi |
mov edx, [current_process] |
mov edx, [current_slot] |
mov edx, [edx+APPDATA.process] |
shl ebx, 12 |
add [edx+PROC.mem_used], ebx |
pop eax edx ecx |
1095,7 → 1108,8 |
ret |
.cant_inplace: |
push esi edi |
mov eax, [current_process] |
mov eax, [current_slot] |
mov eax, [eax+APPDATA.process] |
mov esi, [eax+PROC.heap_base] |
mov edi, [eax+PROC.heap_top] |
shr esi, 12 |
1160,7 → 1174,8 |
jnz @b |
.no: |
push ebx |
mov edx, [current_process] |
mov edx, [current_slot] |
mov edx, [eax+APPDATA.process] |
shl ebx, 12 |
add [edx+PROC.mem_used], ebx |
pop ebx |