^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2013 ARM Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2013 Linaro.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * This code is based on glibc cortex strings work originally authored by Linaro
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * be found @
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * http://bazaar.launchpad.net/~linaro-toolchain-dev/cortex-strings/trunk/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * files/head:/src/aarch64/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/assembler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/cache.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Copy a buffer from src to dest (alignment handled by the hardware)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * x0 - dest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * x1 - src
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * x2 - n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * Returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * x0 - dest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) .macro ldrb1 reg, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) ldrb \reg, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) .macro strb1 reg, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) strb \reg, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .macro ldrh1 reg, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ldrh \reg, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .macro strh1 reg, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) strh \reg, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) .macro ldr1 reg, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) ldr \reg, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .macro str1 reg, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) str \reg, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .macro ldp1 reg1, reg2, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ldp \reg1, \reg2, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) .macro stp1 reg1, reg2, ptr, val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) stp \reg1, \reg2, [\ptr], \val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) .endm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) SYM_FUNC_START_ALIAS(__memcpy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) SYM_FUNC_START_WEAK_PI(memcpy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #include "copy_template.S"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) SYM_FUNC_END_PI(memcpy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) EXPORT_SYMBOL(memcpy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) SYM_FUNC_END_ALIAS(__memcpy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) EXPORT_SYMBOL(__memcpy)