18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  linux/arch/arm/lib/memcpy.S
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Author:	Nicolas Pitre
68c2ecf20Sopenharmony_ci *  Created:	Sep 28, 2005
78c2ecf20Sopenharmony_ci *  Copyright:	MontaVista Software, Inc.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/linkage.h>
118c2ecf20Sopenharmony_ci#include <asm/assembler.h>
128c2ecf20Sopenharmony_ci#include <asm/unwind.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define LDR1W_SHIFT	0
158c2ecf20Sopenharmony_ci#define STR1W_SHIFT	0
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	.macro ldr1w ptr reg abort
188c2ecf20Sopenharmony_ci	W(ldr) \reg, [\ptr], #4
198c2ecf20Sopenharmony_ci	.endm
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	.macro ldr4w ptr reg1 reg2 reg3 reg4 abort
228c2ecf20Sopenharmony_ci	ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4}
238c2ecf20Sopenharmony_ci	.endm
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	.macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
268c2ecf20Sopenharmony_ci	ldmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
278c2ecf20Sopenharmony_ci	.endm
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	.macro ldr1b ptr reg cond=al abort
308c2ecf20Sopenharmony_ci	ldrb\cond \reg, [\ptr], #1
318c2ecf20Sopenharmony_ci	.endm
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	.macro str1w ptr reg abort
348c2ecf20Sopenharmony_ci	W(str) \reg, [\ptr], #4
358c2ecf20Sopenharmony_ci	.endm
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	.macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
388c2ecf20Sopenharmony_ci	stmia \ptr!, {\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8}
398c2ecf20Sopenharmony_ci	.endm
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	.macro str1b ptr reg cond=al abort
428c2ecf20Sopenharmony_ci	strb\cond \reg, [\ptr], #1
438c2ecf20Sopenharmony_ci	.endm
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci	.macro enter reg1 reg2
468c2ecf20Sopenharmony_ci	stmdb sp!, {r0, \reg1, \reg2}
478c2ecf20Sopenharmony_ci	.endm
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	.macro usave reg1 reg2
508c2ecf20Sopenharmony_ci	UNWIND(	.save	{r0, \reg1, \reg2}	)
518c2ecf20Sopenharmony_ci	.endm
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	.macro exit reg1 reg2
548c2ecf20Sopenharmony_ci	ldmfd sp!, {r0, \reg1, \reg2}
558c2ecf20Sopenharmony_ci	.endm
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	.text
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciENTRY(__memcpy)
628c2ecf20Sopenharmony_ciENTRY(mmiocpy)
638c2ecf20Sopenharmony_ciWEAK(memcpy)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#include "copy_template.S"
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciENDPROC(memcpy)
688c2ecf20Sopenharmony_ciENDPROC(mmiocpy)
698c2ecf20Sopenharmony_ciENDPROC(__memcpy)
70