SetMem32.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #------------------------------------------------------------------------------
  2. #
  3. # Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
  4. # This program and the accompanying materials
  5. # are licensed and made available under the terms and conditions of the BSD License
  6. # which accompanies this distribution. The full text of the license may be found at
  7. # http://opensource.org/licenses/bsd-license.php.
  8. #
  9. # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  10. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  11. #
  12. # Module Name:
  13. #
  14. # SetMem32.asm
  15. #
  16. # Abstract:
  17. #
  18. # SetMem32 function
  19. #
  20. # Notes:
  21. #
  22. #------------------------------------------------------------------------------
  23. ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
  24. #------------------------------------------------------------------------------
  25. # VOID *
  26. # EFIAPI
  27. # InternalMemSetMem32 (
  28. # IN VOID *Buffer,
  29. # IN UINTN Count,
  30. # IN UINT32 Value
  31. # );
  32. #------------------------------------------------------------------------------
  33. ASM_PFX(InternalMemSetMem32):
  34. push %edi
  35. movl 12(%esp), %edx
  36. movl 8(%esp), %edi
  37. xorl %ecx, %ecx
  38. subl %edi, %ecx
  39. andl $15, %ecx # ecx + edi aligns on 16-byte boundary
  40. movl 16(%esp), %eax
  41. jz L0
  42. shrl $2, %ecx
  43. cmpl %edx, %ecx
  44. cmova %edx, %ecx
  45. subl %ecx, %edx
  46. rep
  47. stosl
  48. L0:
  49. movl %edx, %ecx
  50. andl $3, %edx
  51. shrl $2, %ecx
  52. jz L_SetDwords
  53. movd %eax, %xmm0
  54. pshufd $0, %xmm0, %xmm0
  55. L1:
  56. movntdq %xmm0, (%edi)
  57. addl $16, %edi
  58. loop L1
  59. mfence
  60. L_SetDwords:
  61. movl %edx, %ecx
  62. rep
  63. stosl
  64. movl 8(%esp), %eax
  65. pop %edi
  66. ret