hola
estaba estudiando con los videos de security training, pero me surgio una duda sobre el uso de funciones y el stack
voy a poner un ejemplo de como es que yo entiendo que trabaja esp y ebp, para utilizar funciones
push 12
push 20
---------------------
|12| 12 bytes <<-------------
|20| 8 bytes <<-------------
|ret| 4 bytes <<-------------
--------------------------
call suma
----------------------------
suma:
push ebp
|12| 12 bytes <<-------------
|20| 8 bytes <<-----------------------
|ret| 4 bytes <<-------------
|EBP| - antigua direccion <<-------------
--------------------------
mov ebp, esp
|ret| 4 bytes <<-------------
|EBP| - antigua direccion - 4 bytes <<-------------
|12| 8 bytes <<-------------
|20| 12 bytes <<-------------
mov ah, 1
mov bh, 4
mov cx, [ebp - 8]
mov dx, [ebp - 12]
add cx, dx
int 0x80
--------------------------
mov esp, ebp
|12| 12 bytes <<-------------
|20| 8 bytes <<-------------
|ret| 4 bytes <<-------------
|EBP| - antigua direccion <<-------------
-------------------------------
pop ebp
|12| 12 bytes <<-------------
|20| 8 bytes <<-------------
|ret| 4 bytes <<-------------
---------------
salida del programa
mov ah, 1
int 0x80
--------------------------
espero me puedan decir si estoy bien, o estoy equivocado, y ojala alguien pueda explicarme como funciona en realidad
salu2