Guest User

Untitled

a guest
Jun 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. globl old_memcpy
  2. .type old_memcpy, @function
  3. old_memcpy:
  4. pushl %ebp
  5. movl %esp, %ebp
  6. subl $20, %esp
  7. movl 12(%ebp), %eax
  8. movl %eax, -4(%ebp)
  9. movl 8(%ebp), %eax
  10. movl %eax, -8(%ebp)
  11. jmp .L2
  12. .L3:
  13. movl -4(%ebp), %eax
  14. movzbl (%eax), %edx
  15. movl -8(%ebp), %eax
  16. movb %dl, (%eax)
  17. addl $1, -8(%ebp)
  18. addl $1, -4(%ebp)
  19. subl $1, 16(%ebp)
  20. .L2:
  21. cmpl $0, 16(%ebp)
  22. jne .L3
  23. leave
  24. ret
  25. .size old_memcpy, .-old_memcpy
  26.  
  27. ## memcopy
  28. .globl memcpy
  29. .type memcpy, @function
  30. memcpy:
  31. pushl %ebp
  32. movl %esp, %ebp
  33. subl $32, %esp
  34. movl 8(%ebp), %eax
  35. movl %eax, -4(%ebp)
  36. movl 12(%ebp), %eax
  37. movl %eax, -8(%ebp)
  38. movl 16(%ebp), %eax
  39. shrl $2, %eax
  40. movl %eax, -12(%ebp)
  41. andl $3, 16(%ebp)
  42. jmp .L6
  43. .L7:
  44. movl -8(%ebp), %eax
  45. movl (%eax), %edx
  46. movl -4(%ebp), %eax
  47. movl %edx, (%eax)
  48. addl $4, -4(%ebp)
  49. addl $4, -8(%ebp)
  50. subl $1, -12(%ebp)
  51. .L6:
  52. cmpl $0, -12(%ebp)
  53. jne .L7
  54. movl -8(%ebp), %eax
  55. movl %eax, -16(%ebp)
  56. movl -4(%ebp), %eax
  57. movl %eax, -20(%ebp)
  58. jmp .L8
  59. .L9:
  60. movl -16(%ebp), %eax
  61. movzbl (%eax), %edx
  62. movl -20(%ebp), %eax
  63. movb %dl, (%eax)
  64. addl $1, -20(%ebp)
  65. addl $1, -16(%ebp)
  66. subl $1, 16(%ebp)
  67. .L8:
  68. cmpl $0, 16(%ebp)
  69. jne .L9
  70. movl 8(%ebp), %eax
  71. leave
  72. ret
  73. .size memcpy, .-memcpy
  74. .globl memset
  75. .type memset, @function
Add Comment
Please, Sign In to add comment