memcpy.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2013 ARM Ltd.
  3. * Copyright (C) 2013 Linaro.
  4. *
  5. * This code is based on glibc cortex strings work originally authored by Linaro
  6. * and re-licensed under GPLv2 for the Linux kernel. The original code can
  7. * be found @
  8. *
  9. * http://bazaar.launchpad.net/~linaro-toolchain-dev/cortex-strings/trunk/
  10. * files/head:/src/aarch64/
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. */
  24. #include <linux/linkage.h>
  25. #include <asm/assembler.h>
  26. #include <asm/cache.h>
  27. /*
  28. * Copy a buffer from src to dest (alignment handled by the hardware)
  29. *
  30. * Parameters:
  31. * x0 - dest
  32. * x1 - src
  33. * x2 - n
  34. * Returns:
  35. * x0 - dest
  36. */
  37. .macro ldrb1 ptr, regB, val
  38. ldrb \ptr, [\regB], \val
  39. .endm
  40. .macro strb1 ptr, regB, val
  41. strb \ptr, [\regB], \val
  42. .endm
  43. .macro ldrh1 ptr, regB, val
  44. ldrh \ptr, [\regB], \val
  45. .endm
  46. .macro strh1 ptr, regB, val
  47. strh \ptr, [\regB], \val
  48. .endm
  49. .macro ldr1 ptr, regB, val
  50. ldr \ptr, [\regB], \val
  51. .endm
  52. .macro str1 ptr, regB, val
  53. str \ptr, [\regB], \val
  54. .endm
  55. .macro ldp1 ptr, regB, regC, val
  56. ldp \ptr, \regB, [\regC], \val
  57. .endm
  58. .macro stp1 ptr, regB, regC, val
  59. stp \ptr, \regB, [\regC], \val
  60. .endm
  61. .weak memcpy
  62. ENTRY(__memcpy)
  63. ENTRY(memcpy)
  64. #include "copy_template.S"
  65. ret
  66. ENDPIPROC(memcpy)
  67. ENDPROC(__memcpy)