xref: /openbmc/linux/arch/arm/lib/csumpartialcopy.S (revision 20e2fc42)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 *  linux/arch/arm/lib/csumpartialcopy.S
4 *
5 *  Copyright (C) 1995-1998 Russell King
6 */
7#include <linux/linkage.h>
8#include <asm/assembler.h>
9
10		.text
11
12/* Function: __u32 csum_partial_copy_nocheck(const char *src, char *dst, int len, __u32 sum)
13 * Params  : r0 = src, r1 = dst, r2 = len, r3 = checksum
14 * Returns : r0 = new checksum
15 */
16
17		.macro	save_regs
18		stmfd	sp!, {r1, r4 - r8, lr}
19		.endm
20
21		.macro	load_regs
22		ldmfd	sp!, {r1, r4 - r8, pc}
23		.endm
24
25		.macro	load1b, reg1
26		ldrb	\reg1, [r0], #1
27		.endm
28
29		.macro	load2b, reg1, reg2
30		ldrb	\reg1, [r0], #1
31		ldrb	\reg2, [r0], #1
32		.endm
33
34		.macro	load1l, reg1
35		ldr	\reg1, [r0], #4
36		.endm
37
38		.macro	load2l, reg1, reg2
39		ldr	\reg1, [r0], #4
40		ldr	\reg2, [r0], #4
41		.endm
42
43		.macro	load4l, reg1, reg2, reg3, reg4
44		ldmia	r0!, {\reg1, \reg2, \reg3, \reg4}
45		.endm
46
47#define FN_ENTRY	ENTRY(csum_partial_copy_nocheck)
48#define FN_EXIT		ENDPROC(csum_partial_copy_nocheck)
49
50#include "csumpartialcopygeneric.S"
51