forked from KolibriOS/kolibrios
fix Alloc function, clean code
git-svn-id: svn://kolibrios.org@8196 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
25cf1adde0
commit
8b59b0bc76
@ -101,19 +101,11 @@ end if
|
||||
movsd
|
||||
Kolibri_Put_MovEaxVal_Ret @Kolibri@GetPid$qv,edx
|
||||
if defined KolibriHeapInit
|
||||
mov ecx,esp
|
||||
push ebx
|
||||
push ecx
|
||||
push U_END
|
||||
call KolibriHeapInit ; Initialize a dynamic heap and create new memory in its begin.
|
||||
pop ecx ; Parameters: begin of a new heap, end of data to create in
|
||||
mov [esp+4],eax ; the begin of a heap. Return address of the created data.
|
||||
mov dword [esp],0
|
||||
else
|
||||
call KolibriHeapInit ; Initialize a dynamic heap
|
||||
end if
|
||||
xor eax,eax
|
||||
push eax
|
||||
push eax
|
||||
end if
|
||||
call @Kolibri@ThreadMain$qpvt1
|
||||
.ThreadFinish:
|
||||
add esp,8
|
||||
|
@ -2,31 +2,15 @@
|
||||
#define __KOLIBRI_HEAP_H_INCLUDED_
|
||||
|
||||
#include "kolibri.h"
|
||||
#include "memheap.h"
|
||||
|
||||
// Kolibri memory heap interface.
|
||||
|
||||
namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace.
|
||||
{
|
||||
long _HeapInit()
|
||||
{
|
||||
return MemoryHeap::mem_Init();
|
||||
}
|
||||
|
||||
void *Alloc(unsigned int size)
|
||||
{
|
||||
return MemoryHeap::mem_Alloc(size);
|
||||
}
|
||||
|
||||
void *ReAlloc(void *mem, unsigned int size)
|
||||
{
|
||||
return MemoryHeap::mem_ReAlloc(size, mem);
|
||||
}
|
||||
|
||||
void Free(void *mem)
|
||||
{
|
||||
MemoryHeap::mem_Free(mem);
|
||||
}
|
||||
long HeapInit();
|
||||
void *Alloc(unsigned long int size);
|
||||
void *ReAlloc(void *mem, unsigned long int size);
|
||||
void Free(void *mem);
|
||||
}
|
||||
|
||||
#endif // ndef __KOLIBRI_HEAP_H_INCLUDED_
|
||||
|
@ -1,37 +1,42 @@
|
||||
;/***
|
||||
|
||||
KolibriHeapInit = @@Kolibri@_HeapInit$qv
|
||||
KolibriHeapInit = @Kolibri@HeapInit$qv
|
||||
|
||||
KolibriHeapAlloc = @@Kolibri@Alloc$qui
|
||||
KolibriHeapAlloc = @Kolibri@Alloc$qul
|
||||
|
||||
KolibriHeapReAlloc = @@Kolibri@ReAlloc$qpvui
|
||||
KolibriHeapReAlloc = @Kolibri@ReAlloc$qpvul
|
||||
|
||||
KolibriHeapFree = @@Kolibri@Free$qpv
|
||||
KolibriHeapFree = @Kolibri@Free$qpv
|
||||
|
||||
proc @MemoryHeap@mem_Init$qv uses ebx
|
||||
align 4
|
||||
proc @Kolibri@HeapInit$qv uses ebx
|
||||
mov eax,SF_SYS_MISC
|
||||
mov ebx,SSF_HEAP_INIT
|
||||
int 0x40
|
||||
ret
|
||||
endp
|
||||
|
||||
proc @MemoryHeap@mem_Alloc$qul uses ebx
|
||||
align 4
|
||||
proc @Kolibri@Alloc$qul uses ebx
|
||||
mov eax,SF_SYS_MISC
|
||||
mov ebx,SSF_MEM_ALLOC
|
||||
mov ecx,[esp+8]
|
||||
int 0x40
|
||||
ret
|
||||
endp
|
||||
|
||||
proc @MemoryHeap@mem_ReAlloc$qulpv uses ebx
|
||||
align 4
|
||||
proc @Kolibri@ReAlloc$qpvul uses ebx
|
||||
mov eax,SF_SYS_MISC
|
||||
mov ebx,SSF_MEM_REALLOC
|
||||
mov ecx,[esp+8]
|
||||
mov edx,[esp+12]
|
||||
mov ecx,[esp+12]
|
||||
mov edx,[esp+8]
|
||||
int 0x40
|
||||
ret
|
||||
endp
|
||||
|
||||
proc @MemoryHeap@mem_Free$qpv uses ebx
|
||||
align 4
|
||||
proc @Kolibri@Free$qpv uses ebx
|
||||
mov eax,SF_SYS_MISC
|
||||
mov ebx,SSF_MEM_FREE
|
||||
mov ecx,[esp+8]
|
||||
|
@ -1,13 +0,0 @@
|
||||
#ifndef __MEMORY_HEAP_H_INCLUDED_
|
||||
#define __MEMORY_HEAP_H_INCLUDED_
|
||||
|
||||
namespace MemoryHeap
|
||||
{
|
||||
long mem_Init();
|
||||
void *mem_Alloc(unsigned long size);
|
||||
void *mem_ReAlloc(unsigned long size, void *mem);
|
||||
bool mem_Free(void *mem);
|
||||
}
|
||||
|
||||
#endif // ndef __MEMORY_HEAP_H_INCLUDED_
|
||||
|
Loading…
Reference in New Issue
Block a user