2007-10-15 11:42:17 +02:00
|
|
|
format ELF
|
|
|
|
|
|
|
|
;include "proc32.inc"
|
|
|
|
section '.text' executable
|
|
|
|
public malloc
|
|
|
|
public free
|
|
|
|
public realloc
|
|
|
|
|
|
|
|
align 4
|
|
|
|
malloc:
|
2016-05-19 14:15:22 +02:00
|
|
|
push ebx
|
2007-10-15 11:42:17 +02:00
|
|
|
mov eax,68
|
|
|
|
mov ebx,12
|
2016-05-19 14:15:22 +02:00
|
|
|
mov ecx,[esp+8] ;size
|
2007-10-15 11:42:17 +02:00
|
|
|
int 0x40
|
2016-05-19 14:15:22 +02:00
|
|
|
pop ebx
|
2007-10-15 11:42:17 +02:00
|
|
|
ret 4
|
|
|
|
|
|
|
|
align 4
|
|
|
|
free:
|
2016-05-19 14:15:22 +02:00
|
|
|
push ebx
|
2007-10-15 11:42:17 +02:00
|
|
|
mov eax,68
|
|
|
|
mov ebx,13
|
2016-05-19 14:15:22 +02:00
|
|
|
mov ecx,[esp+8]
|
2007-10-15 11:42:17 +02:00
|
|
|
int 0x40
|
2016-05-19 14:15:22 +02:00
|
|
|
pop ebx
|
2007-10-15 11:42:17 +02:00
|
|
|
ret 4
|
|
|
|
|
|
|
|
align 4
|
|
|
|
realloc:
|
2016-05-19 14:15:22 +02:00
|
|
|
push ebx
|
2007-10-15 11:42:17 +02:00
|
|
|
mov ebx,20
|
|
|
|
mov eax,68
|
2016-05-19 14:15:22 +02:00
|
|
|
mov edx,[esp+8] ; pointer
|
|
|
|
mov ecx,[esp+12] ; size
|
2007-10-15 11:42:17 +02:00
|
|
|
int 0x40
|
2016-05-19 14:15:22 +02:00
|
|
|
pop ebx
|
2007-10-15 11:42:17 +02:00
|
|
|
ret 8
|