1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/arm/lib/csumpartialcopyuser.S
5 * Copyright (C) 1995-1998 Russell King
7 * 27/03/03 Ian Molton Clean up CONFIG_CPU
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
11 #include <asm/errno.h>
12 #include <asm/asm-offsets.h>
16 #ifdef CONFIG_CPU_SW_DOMAIN_PAN
18 mrc p15, 0, ip, c3, c0, 0
19 stmfd sp!, {r1, r2, r4 - r8, ip, lr}
24 ldmfd sp!, {r1, r2, r4 - r8, ip, lr}
25 mcr p15, 0, ip, c3, c0, 0
30 stmfd sp!, {r1, r2, r4 - r8, lr}
34 ldmfd sp!, {r1, r2, r4 - r8, pc}
42 .macro load2b, reg1, reg2
51 .macro load2l, reg1, reg2
56 .macro load4l, reg1, reg2, reg3, reg4
65 * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
66 * r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr
67 * Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT
70 #define FN_ENTRY ENTRY(csum_partial_copy_from_user)
71 #define FN_EXIT ENDPROC(csum_partial_copy_from_user)
73 #include "csumpartialcopygeneric.S"
76 * FIXME: minor buglet here
77 * We don't return the checksum for the data present in the buffer. To do
78 * so properly, we would have to add in whatever registers were loaded before
79 * the fault, which, with the current asm above is not predictable.
81 .pushsection .text.fixup,"ax"
83 9001: mov r4, #-EFAULT
84 #ifdef CONFIG_CPU_SW_DOMAIN_PAN
85 ldr r5, [sp, #9*4] @ *err_ptr
87 ldr r5, [sp, #8*4] @ *err_ptr
90 ldmia sp, {r1, r2} @ retrieve dst, len
92 mov r0, #0 @ zero the buffer