xref: /openbmc/linux/arch/arm64/lib/memcpy.S (revision b830f94f)
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 ptr, regB, val
28	ldrb  \ptr, [\regB], \val
29	.endm
30
31	.macro strb1 ptr, regB, val
32	strb \ptr, [\regB], \val
33	.endm
34
35	.macro ldrh1 ptr, regB, val
36	ldrh  \ptr, [\regB], \val
37	.endm
38
39	.macro strh1 ptr, regB, val
40	strh \ptr, [\regB], \val
41	.endm
42
43	.macro ldr1 ptr, regB, val
44	ldr \ptr, [\regB], \val
45	.endm
46
47	.macro str1 ptr, regB, val
48	str \ptr, [\regB], \val
49	.endm
50
51	.macro ldp1 ptr, regB, regC, val
52	ldp \ptr, \regB, [\regC], \val
53	.endm
54
55	.macro stp1 ptr, regB, regC, val
56	stp \ptr, \regB, [\regC], \val
57	.endm
58
59	.weak memcpy
60ENTRY(__memcpy)
61ENTRY(memcpy)
62#include "copy_template.S"
63	ret
64ENDPIPROC(memcpy)
65EXPORT_SYMBOL(memcpy)
66ENDPROC(__memcpy)
67EXPORT_SYMBOL(__memcpy)
68