Advertisement
Guest User

Untitled

a guest
Oct 10th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .section .data
  2. .global op1
  3. .global op2
  4. .global res
  5.    
  6. .section .text
  7. .global sum # void sum(void)
  8.  sum:
  9.  
  10. # prologue
  11. pushl %ebp # save previous stack frame pointer
  12. movl %esp, %ebp # the stack frame pointer for sum function
  13. movl op1, %ebx #place op1 in ebx
  14. movl op2, %eax #place op2 in eax
  15. addl %ebx, %eax #add ebx to eax. Result is in eax
  16. movl %eax, res # copy the result to res
  17.  
  18. # epilogue
  19. movl %ebp, %esp # restore the previous stack pointer ("clear" the stack)
  20. popl %ebp # restore the previous stack frame pointer
  21. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement