blob: 67613937711f10d209b3be73ce6a322f674581b5 [file] [log] [blame]
Catalin Marinas4a899222013-03-21 16:16:43 +00001/*
2 * Copyright (C) 2013 ARM Ltd.
zhichang.yuan808dbac2014-04-28 06:11:29 +01003 * 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/
Catalin Marinas4a899222013-03-21 16:16:43 +000011 *
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
25#include <linux/linkage.h>
26#include <asm/assembler.h>
zhichang.yuan808dbac2014-04-28 06:11:29 +010027#include <asm/cache.h>
Catalin Marinas4a899222013-03-21 16:16:43 +000028
29/*
30 * Copy a buffer from src to dest (alignment handled by the hardware)
31 *
32 * Parameters:
33 * x0 - dest
34 * x1 - src
35 * x2 - n
36 * Returns:
37 * x0 - dest
38 */
Feng Kane5c88e32015-09-23 11:55:38 -070039 .macro ldrb1 ptr, regB, val
40 ldrb \ptr, [\regB], \val
41 .endm
zhichang.yuan808dbac2014-04-28 06:11:29 +010042
Feng Kane5c88e32015-09-23 11:55:38 -070043 .macro strb1 ptr, regB, val
44 strb \ptr, [\regB], \val
45 .endm
46
47 .macro ldrh1 ptr, regB, val
48 ldrh \ptr, [\regB], \val
49 .endm
50
51 .macro strh1 ptr, regB, val
52 strh \ptr, [\regB], \val
53 .endm
54
55 .macro ldr1 ptr, regB, val
56 ldr \ptr, [\regB], \val
57 .endm
58
59 .macro str1 ptr, regB, val
60 str \ptr, [\regB], \val
61 .endm
62
63 .macro ldp1 ptr, regB, regC, val
64 ldp \ptr, \regB, [\regC], \val
65 .endm
66
67 .macro stp1 ptr, regB, regC, val
68 stp \ptr, \regB, [\regC], \val
69 .endm
zhichang.yuan808dbac2014-04-28 06:11:29 +010070
Andrey Ryabinin39d114d2015-10-12 18:52:58 +030071 .weak memcpy
72ENTRY(__memcpy)
Catalin Marinas4a899222013-03-21 16:16:43 +000073ENTRY(memcpy)
Feng Kane5c88e32015-09-23 11:55:38 -070074#include "copy_template.S"
zhichang.yuan808dbac2014-04-28 06:11:29 +010075 ret
Ard Biesheuvel20791842015-10-08 20:02:03 +010076ENDPIPROC(memcpy)
Andrey Ryabinin39d114d2015-10-12 18:52:58 +030077ENDPROC(__memcpy)