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