Advertisement
LincolnArantes

Exemplo usando pilha e função

Oct 27th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Este código usa o push como exemplo
  2. ;Lincoln Cesar dos Reis Arantes
  3.  
  4. global _start
  5.  
  6. _start:
  7.     call func
  8.     mov eax, 1
  9.     mov ebx, 0
  10.     int 0x80
  11.  
  12. func:
  13.     push ebp
  14.     mov ebp, esp
  15.     sub esp, 4
  16.     mov [esp], byte 'H'
  17.     mov [esp+1], byte 'o'
  18.     mov [esp+2], byte 'l'
  19.     mov [esp+3], byte 'a'
  20.    
  21.    
  22.    
  23.     ; printa os dados na tela
  24.    
  25.     mov eax, 4    ; sys_write system call
  26.     mov ebx, 1    ; stdout file descriptor
  27.     mov ecx, esp  ; bytes to write
  28.     mov edx, 4    ; number of bytes to write
  29.     int 0x80      ; perform system call
  30.  
  31.     mov esp, ebp
  32.     pop ebp
  33.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement