PDA

View Full Version : [Asm x86]Stack


Luc@s
03-09-2004, 23:06
If the stack expands in this mode(after a push ebp and mov esp, ebp):

esp(0x00)
-----
| | |
| \./ |
|_____|
| |
| arg1| esp+0x04
|_____|
| |
| arg2| esp+0x08
|_____|
| |
-----

If I add anything(push), the stack'll expands to down.
If I sub anything(pop), the stack'll return to up(this is, in other words, the mothod to clean the stack... in tihs case we can use both sub esp, 0x08 and ret08).

Am I wrong?

P.S: to clean stack....is enougth do this?

mov esp, ebp
pop ebp

Luc@s
04-09-2004, 10:27
scusate l'inglese ma ieri sera ero npo stanco :(

cionci
04-09-2004, 11:56
Scusa, ma gli argomenti li prepari prima di entrare nella tua proc (con la push e la pop)...

Vuoi pulire la memoria di parametri ?!?!?!? Allora credo che il mdoo migliore sia la RET...