2014-12-26 21:27:51 +01:00
|
|
|
format COFF
|
|
|
|
|
|
|
|
;include "proc32.inc"
|
|
|
|
section '.text' code
|
|
|
|
public _malloc
|
|
|
|
public _free
|
|
|
|
public _realloc
|
|
|
|
|
|
|
|
align 4
|
|
|
|
_malloc:
|
|
|
|
|
2014-12-29 11:38:54 +01:00
|
|
|
push ebx
|
2014-12-26 21:27:51 +01:00
|
|
|
mov eax,68
|
|
|
|
mov ebx,12
|
2014-12-29 11:38:54 +01:00
|
|
|
mov ecx,[esp+8] ;size
|
2014-12-26 21:27:51 +01:00
|
|
|
int 0x40
|
2014-12-29 11:38:54 +01:00
|
|
|
pop ebx
|
2014-12-26 21:27:51 +01:00
|
|
|
|
|
|
|
ret 4
|
|
|
|
|
|
|
|
align 4
|
|
|
|
_free:
|
|
|
|
|
2014-12-29 11:38:54 +01:00
|
|
|
push ebx
|
2014-12-26 21:27:51 +01:00
|
|
|
mov eax,68
|
|
|
|
mov ebx,13
|
2014-12-29 11:38:54 +01:00
|
|
|
mov ecx,[esp+8]
|
2014-12-26 21:27:51 +01:00
|
|
|
int 0x40
|
2014-12-29 11:38:54 +01:00
|
|
|
pop ebx
|
2014-12-26 21:27:51 +01:00
|
|
|
|
|
|
|
ret 4
|
|
|
|
|
|
|
|
align 4
|
|
|
|
_realloc:
|
|
|
|
|
2014-12-29 11:38:54 +01:00
|
|
|
push ebx
|
2014-12-26 21:27:51 +01:00
|
|
|
mov ebx,20
|
|
|
|
mov eax,68
|
2014-12-29 11:38:54 +01:00
|
|
|
mov ecx,[esp+8]
|
|
|
|
mov edx,[esp+12]
|
2014-12-26 21:27:51 +01:00
|
|
|
int 0x40
|
2014-12-29 11:38:54 +01:00
|
|
|
pop ebx
|
2014-12-26 21:27:51 +01:00
|
|
|
|
|
|
|
ret 8
|