SetMem.asm 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ;------------------------------------------------------------------------------
  2. ;
  3. ; SetMem() 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. Set Buffer to Value for Size bytes.
  20. @param Buffer Memory to set.
  21. @param Length Number of bytes to set
  22. @param Value Value of the set operation.
  23. @return Buffer
  24. VOID *
  25. EFIAPI
  26. InternalMemSetMem (
  27. OUT VOID *Buffer,
  28. IN UINTN Length,
  29. IN UINT8 Value
  30. )
  31. **/
  32. EXPORT InternalMemSetMem
  33. AREA AsmMemStuff, CODE, READONLY
  34. InternalMemSetMem
  35. stmfd sp!, {lr}
  36. tst r0, #3
  37. movne r3, #0
  38. moveq r3, #1
  39. cmp r1, #127
  40. movls lr, #0
  41. andhi lr, r3, #1
  42. cmp lr, #0
  43. mov r12, r0
  44. bne L31
  45. L32
  46. mov r3, #0
  47. b L43
  48. L31
  49. vdup.8 q0,r2
  50. vmov q1,q0
  51. vmov q2,q0
  52. vmov q3,q0
  53. vmov q4,q0
  54. vmov q5,q0
  55. vmov q6,q0
  56. vmov q7,q0
  57. b L32
  58. L34
  59. cmp lr, #0
  60. streqb r2, [r12], #1
  61. subeq r1, r1, #1
  62. beq L43
  63. sub r1, r1, #128
  64. cmp r1, #127
  65. movls lr, r3
  66. vstm r12!, {d0-d15}
  67. L43
  68. cmp r1, #0
  69. bne L34
  70. ldmfd sp!, {pc}
  71. END