SetMem.S 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #------------------------------------------------------------------------------
  2. #
  3. # SemMem() worker for ARM
  4. #
  5. # This file started out as C code that did 64 bit moves if the buffer was
  6. # 32-bit aligned, else it does a byte copy. It also does a byte copy for
  7. # any trailing bytes. Update to use VSTM/VLDM to do 128 byte writes.
  8. #
  9. # Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
  10. # This program and the accompanying materials
  11. # are licensed and made available under the terms and conditions of the BSD License
  12. # which accompanies this distribution. The full text of the license may be found at
  13. # http://opensource.org/licenses/bsd-license.php
  14. #
  15. # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  16. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  17. #
  18. #------------------------------------------------------------------------------
  19. /**
  20. Set Buffer to Value for Size bytes.
  21. @param Buffer Memory to set.
  22. @param Length Number of bytes to set
  23. @param Value Value of the set operation.
  24. @return Buffer
  25. VOID *
  26. EFIAPI
  27. InternalMemSetMem (
  28. OUT VOID *Buffer,
  29. IN UINTN Length,
  30. IN UINT8 Value
  31. )
  32. **/
  33. .text
  34. .align 2
  35. GCC_ASM_EXPORT(InternalMemSetMem)
  36. ASM_PFX(InternalMemSetMem):
  37. stmfd sp!, {r4-r7, lr}
  38. tst r0, #3
  39. movne r3, #0
  40. moveq r3, #1
  41. cmp r1, #127
  42. movls lr, #0
  43. andhi lr, r3, #1
  44. cmp lr, #0
  45. mov r12, r0
  46. bne L31
  47. L32:
  48. mov r3, #0
  49. b L43
  50. L31:
  51. vdup.8 q0,r2
  52. vmov q1,q0
  53. vmov q2,q0
  54. vmov q3,q0
  55. vmov q4,q0
  56. vmov q5,q0
  57. vmov q6,q0
  58. vmov q7,q0
  59. b L32
  60. L34:
  61. cmp lr, #0
  62. streqb r2, [r12], #1
  63. subeq r1, r1, #1
  64. beq L43
  65. sub r1, r1, #128
  66. cmp r1, #127
  67. cmp r1, #31
  68. movls lr, r3
  69. vstm r12!, {d0-d15}
  70. L43:
  71. cmp r1, #0
  72. bne L34
  73. ldmfd sp!, {pc}