flat assembler
Message board for the users of flat assembler.
Index
> Main > where this mem alloc is freed? |
Author |
|
edfed 01 Jun 2011, 14:23
i found exactlly 5 add esp,4 in this code.
apparentlly, ebp is the frame pointer, push ecx is a variable creation, and this variable is used a lot in your code. its name is tv64. Code: tv64 equ ebp-4 argc equ ebp+8 argv equ ebp+12 mov eax,[argc] ; mov [tv64], eax mov ecx,[tv64] sub ecx, 1 mov [tv64], ecx cmp [tv64], 3 ja .5 mov edx, [tv64] |
|||
01 Jun 2011, 14:23 |
|
Teehee 01 Jun 2011, 14:36
edfed wrote: i found exactlly 5 add esp,4 in this code. But they are freeing the param of each call function (Calling Convention cdecl i think) and not the push ecx. _________________ Sorry if bad english. |
|||
01 Jun 2011, 14:36 |
|
edfed 01 Jun 2011, 14:43
i see mov esp,ebp
Code: $L803: xor eax, eax mov esp, ebp ;;;;;;;;;;;;;;;;;; here pop ebp ret 0 it is exactlly what you seek. |
|||
01 Jun 2011, 14:43 |
|
Teehee 01 Jun 2011, 14:50
i dont got it
it seems "pop ebp" is popping "push ecx", so "push ebp" is trashed. I think its bc in a main function there is no need to free the stack when returning back to the system control. |
|||
01 Jun 2011, 14:50 |
|
edfed 01 Jun 2011, 15:03
edfed wrote: i see mov esp,ebp |
|||
01 Jun 2011, 15:03 |
|
Teehee 01 Jun 2011, 15:17
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hahahaha sorry im a lil bit slow
|
|||
01 Jun 2011, 15:17 |
|
vid 01 Jun 2011, 18:45
Teehee: best solution is to walk over the code yourself in debugger, and watch ESP value
|
|||
01 Jun 2011, 18:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.