Ladies_Man

#ccc hallo world with args from stack

Dec 17th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2. msg:
  3.     .ascii "hallo w orld"
  4.     .set len, .-msg
  5.    
  6. .section .text
  7.  
  8. .globl _start
  9. _start:
  10.     jmp stub
  11.     #write
  12. myfunc:
  13.     pushq %rbp
  14.     mov %rsp,   %rbp
  15.    
  16.     movq 16(%rbp), %rdx
  17.     movq %rbp,   %rsi
  18.     addq $24, %rsi
  19.    
  20.     movq $1,     %rax
  21.     movq $1,     %rdi
  22.  
  23.     syscall
  24.    
  25.     popq %rbp
  26.     ret
  27.    
  28. stub:
  29.     movq $1, %rax
  30.     movq $'X', %rbx
  31.     pushq %rbx
  32.     pushq %rax
  33.     call myfunc
  34.    
  35.     #exit
  36.     movq $60,     %rax
  37.     movq $0,     %rdi
  38.     syscall
Advertisement
Add Comment
Please, Sign In to add comment