ZeroMem.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #
  2. # ConvertAsm.py: Automatically generated from ZeroMem.asm
  3. #
  4. #------------------------------------------------------------------------------
  5. #
  6. # Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
  7. # This program and the accompanying materials
  8. # are licensed and made available under the terms and conditions of the BSD License
  9. # which accompanies this distribution. The full text of the license may be found at
  10. # http://opensource.org/licenses/bsd-license.php.
  11. #
  12. # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  14. #
  15. # Module Name:
  16. #
  17. # ZeroMem.S
  18. #
  19. # Abstract:
  20. #
  21. # ZeroMem function
  22. #
  23. # Notes:
  24. #
  25. #------------------------------------------------------------------------------
  26. #------------------------------------------------------------------------------
  27. # VOID *
  28. # InternalMemZeroMem (
  29. # IN VOID *Buffer,
  30. # IN UINTN Count
  31. # );
  32. #------------------------------------------------------------------------------
  33. ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
  34. ASM_PFX(InternalMemZeroMem):
  35. pushq %rdi
  36. movq %rcx, %rdi
  37. xorq %rcx, %rcx
  38. xorl %eax, %eax
  39. subq %rdi, %rcx
  40. andq $15, %rcx
  41. movq %rdi, %r8
  42. jz L0
  43. cmpq %rdx, %rcx
  44. cmova %rdx, %rcx
  45. subq %rcx, %rdx
  46. rep stosb
  47. L0:
  48. movq %rdx, %rcx
  49. andl $15, %edx
  50. shrq $4, %rcx
  51. jz L_ZeroBytes
  52. pxor %xmm0, %xmm0
  53. L1:
  54. movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned
  55. addq $16, %rdi
  56. loop L1
  57. mfence
  58. L_ZeroBytes:
  59. movl %edx, %ecx
  60. rep stosb
  61. movq %r8, %rax
  62. popq %rdi
  63. ret