Why can I restore old ESP value

0

Well I have here an issue that involves assembly and C.

The variable format has more than 4 bytes, but I can still push of it without casting and returning the old ESP value after pushing. How is it possible?

ASM

segment .data
 format db "oleeee %d",10,0;tem muito mais que 4 bytes

segment .text
    global  _my_func
    extern _printf
    extern _soma


 _my_func:
    push ebp
    mov ebp, esp ;inicio 

    push dword [numero]
    push dword format
    call _printf
    add esp, 8 ;remover

    push dword 5
    push dword 200
    call _soma
    add esp,8 ;remover

    push eax
    push dword format
    call _printf


    mov esp,ebp
    pop ebp ;fim
    ret

C

int soma(int a, int b){

return a+b;
 }

 int main()
 {
   int ret_status;
   ret_status = my_func();
   return ret_status;
 }
    
asked by anonymous 24.03.2016 / 16:47

0 answers