Rev 6412 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
647 | andrew_pro | 1 | format ELF |
2 | |||
3 | ;include "proc32.inc" |
||
4 | section '.text' executable |
||
5 | public malloc |
||
6 | public free |
||
7 | public realloc |
||
8 | |||
9 | align 4 |
||
10 | malloc: |
||
6433 | siemargl | 11 | push ebx |
647 | andrew_pro | 12 | mov eax,68 |
13 | mov ebx,12 |
||
6433 | siemargl | 14 | mov ecx,[esp+8] ;size |
647 | andrew_pro | 15 | int 0x40 |
6433 | siemargl | 16 | pop ebx |
647 | andrew_pro | 17 | ret 4 |
18 | |||
19 | align 4 |
||
20 | free: |
||
6433 | siemargl | 21 | push ebx |
647 | andrew_pro | 22 | mov eax,68 |
23 | mov ebx,13 |
||
6433 | siemargl | 24 | mov ecx,[esp+8] |
647 | andrew_pro | 25 | int 0x40 |
6433 | siemargl | 26 | pop ebx |
647 | andrew_pro | 27 | ret 4 |
28 | |||
29 | align 4 |
||
30 | realloc: |
||
6433 | siemargl | 31 | push ebx |
647 | andrew_pro | 32 | mov ebx,20 |
33 | mov eax,68 |
||
6433 | siemargl | 34 | mov edx,[esp+8] ; pointer |
35 | mov ecx,[esp+12] ; size |
||
647 | andrew_pro | 36 | int 0x40 |
6433 | siemargl | 37 | pop ebx |
647 | andrew_pro | 38 | ret 8 |