1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * linux/arch/arm/lib/csumpartialcopyuser.S 4 * 5 * Copyright (C) 1995-1998 Russell King 6 * 7 * 27/03/03 Ian Molton Clean up CONFIG_CPU 8 */ 9#include <linux/linkage.h> 10#include <asm/assembler.h> 11#include <asm/errno.h> 12#include <asm/asm-offsets.h> 13 14 .text 15 16#ifdef CONFIG_CPU_SW_DOMAIN_PAN 17 .macro save_regs 18 mrc p15, 0, ip, c3, c0, 0 19 stmfd sp!, {r1, r2, r4 - r8, ip, lr} 20 uaccess_enable ip 21 .endm 22 23 .macro load_regs 24 ldmfd sp!, {r1, r2, r4 - r8, ip, lr} 25 mcr p15, 0, ip, c3, c0, 0 26 ret lr 27 .endm 28#else 29 .macro save_regs 30 stmfd sp!, {r1, r2, r4 - r8, lr} 31 .endm 32 33 .macro load_regs 34 ldmfd sp!, {r1, r2, r4 - r8, pc} 35 .endm 36#endif 37 38 .macro load1b, reg1 39 ldrusr \reg1, r0, 1 40 .endm 41 42 .macro load2b, reg1, reg2 43 ldrusr \reg1, r0, 1 44 ldrusr \reg2, r0, 1 45 .endm 46 47 .macro load1l, reg1 48 ldrusr \reg1, r0, 4 49 .endm 50 51 .macro load2l, reg1, reg2 52 ldrusr \reg1, r0, 4 53 ldrusr \reg2, r0, 4 54 .endm 55 56 .macro load4l, reg1, reg2, reg3, reg4 57 ldrusr \reg1, r0, 4 58 ldrusr \reg2, r0, 4 59 ldrusr \reg3, r0, 4 60 ldrusr \reg4, r0, 4 61 .endm 62 63/* 64 * unsigned int 65 * csum_partial_copy_from_user(const char *src, char *dst, int len) 66 * r0 = src, r1 = dst, r2 = len 67 * Returns : r0 = checksum or 0 68 */ 69 70#define FN_ENTRY ENTRY(csum_partial_copy_from_user) 71#define FN_EXIT ENDPROC(csum_partial_copy_from_user) 72 73#include "csumpartialcopygeneric.S" 74 75/* 76 * We report fault by returning 0 csum - impossible in normal case, since 77 * we start with 0xffffffff for initial sum. 78 */ 79 .pushsection .text.fixup,"ax" 80 .align 4 819001: mov r0, #0 82 load_regs 83 .popsection 84