forked from KolibriOS/kolibrios
heap.inc: Fix indention. Why don't we use 12 spaces ?
git-svn-id: svn://kolibrios.org@3246 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
4ed6be1119
commit
629515a9f6
@ -54,7 +54,7 @@ md:
|
|||||||
inc [mem_hash_cnt+eax*4]
|
inc [mem_hash_cnt+eax*4]
|
||||||
|
|
||||||
lea ecx, [mem_used_list+eax*8]
|
lea ecx, [mem_used_list+eax*8]
|
||||||
list_add esi, ecx
|
list_add esi, ecx
|
||||||
mov [esi+block_flags], USED_BLOCK
|
mov [esi+block_flags], USED_BLOCK
|
||||||
mov eax, [esi+block_size]
|
mov eax, [esi+block_size]
|
||||||
sub [heap_free], eax
|
sub [heap_free], eax
|
||||||
@ -95,7 +95,7 @@ align 4
|
|||||||
jne .fatal
|
jne .fatal
|
||||||
|
|
||||||
dec [mem_hash_cnt+ecx*4]
|
dec [mem_hash_cnt+ecx*4]
|
||||||
list_del esi
|
list_del esi
|
||||||
.done:
|
.done:
|
||||||
ret
|
ret
|
||||||
.fatal: ;FIXME panic here
|
.fatal: ;FIXME panic here
|
||||||
@ -176,7 +176,7 @@ proc init_kernel_heap
|
|||||||
mov [mem_block_mask+4], 0x80000000
|
mov [mem_block_mask+4], 0x80000000
|
||||||
|
|
||||||
mov ecx, mem_block_list+63*8
|
mov ecx, mem_block_list+63*8
|
||||||
list_add ebx, ecx
|
list_add ebx, ecx
|
||||||
|
|
||||||
mov ecx, 4096-3-1
|
mov ecx, 4096-3-1
|
||||||
mov eax, HEAP_BASE+sizeof.MEM_BLOCK*4
|
mov eax, HEAP_BASE+sizeof.MEM_BLOCK*4
|
||||||
@ -393,7 +393,7 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
|||||||
cmp [edi+block_flags], FREE_BLOCK
|
cmp [edi+block_flags], FREE_BLOCK
|
||||||
jne .prev
|
jne .prev
|
||||||
|
|
||||||
list_del edi
|
list_del edi
|
||||||
|
|
||||||
mov edx, [edi+block_next]
|
mov edx, [edi+block_next]
|
||||||
mov [esi+block_next], edx
|
mov [esi+block_next], edx
|
||||||
@ -401,7 +401,7 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
|||||||
mov ecx, [edi+block_size]
|
mov ecx, [edi+block_size]
|
||||||
add [esi+block_size], ecx
|
add [esi+block_size], ecx
|
||||||
|
|
||||||
calc_index ecx
|
calc_index ecx
|
||||||
|
|
||||||
lea edx, [mem_block_list+ecx*8]
|
lea edx, [mem_block_list+ecx*8]
|
||||||
cmp edx, [edx]
|
cmp edx, [edx]
|
||||||
@ -427,23 +427,24 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
|||||||
add eax, ecx
|
add eax, ecx
|
||||||
mov [edi+block_size], eax
|
mov [edi+block_size], eax
|
||||||
|
|
||||||
calc_index eax ;new index
|
calc_index eax ;new index
|
||||||
calc_index ecx ;old index
|
calc_index ecx ;old index
|
||||||
cmp eax, ecx
|
cmp eax, ecx
|
||||||
je .m_eq
|
je .m_eq
|
||||||
|
|
||||||
push ecx
|
push ecx
|
||||||
list_del edi
|
list_del edi
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
lea edx, [mem_block_list+ecx*8]
|
lea edx, [mem_block_list+ecx*8]
|
||||||
cmp edx, [edx]
|
cmp edx, [edx]
|
||||||
jne .add_block
|
jne .add_block
|
||||||
btr [mem_block_mask], ecx
|
btr [mem_block_mask], ecx
|
||||||
|
|
||||||
.add_block:
|
.add_block:
|
||||||
bts [mem_block_mask], eax
|
bts [mem_block_mask], eax
|
||||||
lea edx, [mem_block_list+eax*8]
|
lea edx, [mem_block_list+eax*8]
|
||||||
list_add edi, edx
|
list_add edi, edx
|
||||||
.m_eq:
|
.m_eq:
|
||||||
mov ecx, heap_mutex
|
mov ecx, heap_mutex
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
@ -453,7 +454,7 @@ proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
|
|||||||
.insert:
|
.insert:
|
||||||
mov [esi+block_flags], FREE_BLOCK
|
mov [esi+block_flags], FREE_BLOCK
|
||||||
mov eax, [esi+block_size]
|
mov eax, [esi+block_size]
|
||||||
calc_index eax
|
calc_index eax
|
||||||
mov edi, esi
|
mov edi, esi
|
||||||
jmp .add_block
|
jmp .add_block
|
||||||
|
|
||||||
@ -466,10 +467,10 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc kernel_alloc stdcall, size:dword
|
proc kernel_alloc stdcall, size:dword
|
||||||
locals
|
locals
|
||||||
lin_addr dd ?
|
lin_addr dd ?
|
||||||
pages_count dd ?
|
pages_count dd ?
|
||||||
endl
|
endl
|
||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
push edi
|
push edi
|
||||||
@ -758,11 +759,13 @@ proc user_alloc_at stdcall, address:dword, alloc_size:dword
|
|||||||
inc ebx
|
inc ebx
|
||||||
dec eax
|
dec eax
|
||||||
jnz .fill
|
jnz .fill
|
||||||
|
|
||||||
.second_nofill:
|
.second_nofill:
|
||||||
sub ecx, edx
|
sub ecx, edx
|
||||||
jz .nothird
|
jz .nothird
|
||||||
or cl, FREE_BLOCK
|
or cl, FREE_BLOCK
|
||||||
mov [page_tabs+ebx*4], ecx
|
mov [page_tabs+ebx*4], ecx
|
||||||
|
|
||||||
.nothird:
|
.nothird:
|
||||||
|
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
@ -822,6 +825,7 @@ proc user_free stdcall, base:dword
|
|||||||
inc esi
|
inc esi
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .release
|
jnz .release
|
||||||
|
|
||||||
.released:
|
.released:
|
||||||
push edi
|
push edi
|
||||||
|
|
||||||
@ -1288,11 +1292,11 @@ SHM_OPEN_MASK equ (3 shl 2)
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc shmem_open stdcall name:dword, size:dword, access:dword
|
proc shmem_open stdcall name:dword, size:dword, access:dword
|
||||||
locals
|
locals
|
||||||
action dd ?
|
action dd ?
|
||||||
owner_access dd ?
|
owner_access dd ?
|
||||||
mapped dd ?
|
mapped dd ?
|
||||||
endl
|
endl
|
||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
push esi
|
push esi
|
||||||
|
Loading…
Reference in New Issue
Block a user