Guest User

Untitled

a guest
Feb 3rd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. .global strlen
  2. strlen:
  3. mov $0x1, %eax
  4. cpuid
  5. test $0x100000, %eax
  6. je .unoptim
  7. push %ebp
  8. mov %esp, %ebp
  9. push %edi
  10. push %ebx
  11. sub $0x10, %esp
  12. mov 0x8(%ebp), %ecx
  13. mov %ecx, %edx
  14. mov $0xFFFFFFF0, %eax
  15. pxor %xmm0, %xmm0
  16. .strlen_start:
  17. add $0x10, %eax
  18. pcmpistri $0x8,(%eax,%edx,1),%xmm0
  19. jne .strlen_start
  20. add %ecx, %eax
  21. leave
  22. ret
  23. .unoptim:
  24. push %esi
  25. xor %ecx, %ecx
  26. dec %ecx
  27. .loop:
  28. inc %ecx
  29. lodsb
  30. jne .loop:
  31. mov %ecx, %eax
  32. pop %esi
  33. ret
Advertisement
Add Comment
Please, Sign In to add comment