| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/arch/arm/lib/csumpartialcopyuser.S |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 1995-1998 Russell King |
|---|
| 5 | 6 | * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | 7 | * 27/03/03 Ian Molton Clean up CONFIG_CPU |
|---|
| 11 | | - * |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | #include <linux/linkage.h> |
|---|
| 14 | 10 | #include <asm/assembler.h> |
|---|
| .. | .. |
|---|
| 66 | 62 | |
|---|
| 67 | 63 | /* |
|---|
| 68 | 64 | * unsigned int |
|---|
| 69 | | - * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr) |
|---|
| 70 | | - * r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr |
|---|
| 71 | | - * Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT |
|---|
| 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 |
|---|
| 72 | 68 | */ |
|---|
| 73 | 69 | |
|---|
| 74 | 70 | #define FN_ENTRY ENTRY(csum_partial_copy_from_user) |
|---|
| .. | .. |
|---|
| 77 | 73 | #include "csumpartialcopygeneric.S" |
|---|
| 78 | 74 | |
|---|
| 79 | 75 | /* |
|---|
| 80 | | - * FIXME: minor buglet here |
|---|
| 81 | | - * We don't return the checksum for the data present in the buffer. To do |
|---|
| 82 | | - * so properly, we would have to add in whatever registers were loaded before |
|---|
| 83 | | - * the fault, which, with the current asm above is not predictable. |
|---|
| 76 | + * We report fault by returning 0 csum - impossible in normal case, since |
|---|
| 77 | + * we start with 0xffffffff for initial sum. |
|---|
| 84 | 78 | */ |
|---|
| 85 | 79 | .pushsection .text.fixup,"ax" |
|---|
| 86 | 80 | .align 4 |
|---|
| 87 | | -9001: mov r4, #-EFAULT |
|---|
| 88 | | -#ifdef CONFIG_CPU_SW_DOMAIN_PAN |
|---|
| 89 | | - ldr r5, [sp, #9*4] @ *err_ptr |
|---|
| 90 | | -#else |
|---|
| 91 | | - ldr r5, [sp, #8*4] @ *err_ptr |
|---|
| 92 | | -#endif |
|---|
| 93 | | - str r4, [r5] |
|---|
| 94 | | - ldmia sp, {r1, r2} @ retrieve dst, len |
|---|
| 95 | | - add r2, r2, r1 |
|---|
| 96 | | - mov r0, #0 @ zero the buffer |
|---|
| 97 | | -9002: teq r2, r1 |
|---|
| 98 | | - strneb r0, [r1], #1 |
|---|
| 99 | | - bne 9002b |
|---|
| 81 | +9001: mov r0, #0 |
|---|
| 100 | 82 | load_regs |
|---|
| 101 | 83 | .popsection |
|---|