| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012 ARM Ltd. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | | - * GNU General Public License for more details. |
|---|
| 12 | | - * |
|---|
| 13 | | - * You should have received a copy of the GNU General Public License |
|---|
| 14 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 15 | 4 | */ |
|---|
| 16 | 5 | |
|---|
| 17 | 6 | #include <linux/linkage.h> |
|---|
| 18 | 7 | |
|---|
| 19 | | -#include <asm/cache.h> |
|---|
| 20 | 8 | #include <asm/asm-uaccess.h> |
|---|
| 9 | +#include <asm/assembler.h> |
|---|
| 10 | +#include <asm/cache.h> |
|---|
| 21 | 11 | |
|---|
| 22 | 12 | /* |
|---|
| 23 | 13 | * Copy from user space to a kernel buffer (alignment handled by the hardware) |
|---|
| .. | .. |
|---|
| 30 | 20 | * x0 - bytes not copied |
|---|
| 31 | 21 | */ |
|---|
| 32 | 22 | |
|---|
| 33 | | - .macro ldrb1 ptr, regB, val |
|---|
| 34 | | - uao_user_alternative 9998f, ldrb, ldtrb, \ptr, \regB, \val |
|---|
| 23 | + .macro ldrb1 reg, ptr, val |
|---|
| 24 | + uao_user_alternative 9998f, ldrb, ldtrb, \reg, \ptr, \val |
|---|
| 35 | 25 | .endm |
|---|
| 36 | 26 | |
|---|
| 37 | | - .macro strb1 ptr, regB, val |
|---|
| 38 | | - strb \ptr, [\regB], \val |
|---|
| 27 | + .macro strb1 reg, ptr, val |
|---|
| 28 | + strb \reg, [\ptr], \val |
|---|
| 39 | 29 | .endm |
|---|
| 40 | 30 | |
|---|
| 41 | | - .macro ldrh1 ptr, regB, val |
|---|
| 42 | | - uao_user_alternative 9997f, ldrh, ldtrh, \ptr, \regB, \val |
|---|
| 31 | + .macro ldrh1 reg, ptr, val |
|---|
| 32 | + uao_user_alternative 9997f, ldrh, ldtrh, \reg, \ptr, \val |
|---|
| 43 | 33 | .endm |
|---|
| 44 | 34 | |
|---|
| 45 | | - .macro strh1 ptr, regB, val |
|---|
| 46 | | - strh \ptr, [\regB], \val |
|---|
| 35 | + .macro strh1 reg, ptr, val |
|---|
| 36 | + strh \reg, [\ptr], \val |
|---|
| 47 | 37 | .endm |
|---|
| 48 | 38 | |
|---|
| 49 | | - .macro ldr1 ptr, regB, val |
|---|
| 50 | | - uao_user_alternative 9997f, ldr, ldtr, \ptr, \regB, \val |
|---|
| 39 | + .macro ldr1 reg, ptr, val |
|---|
| 40 | + uao_user_alternative 9997f, ldr, ldtr, \reg, \ptr, \val |
|---|
| 51 | 41 | .endm |
|---|
| 52 | 42 | |
|---|
| 53 | | - .macro str1 ptr, regB, val |
|---|
| 54 | | - str \ptr, [\regB], \val |
|---|
| 43 | + .macro str1 reg, ptr, val |
|---|
| 44 | + str \reg, [\ptr], \val |
|---|
| 55 | 45 | .endm |
|---|
| 56 | 46 | |
|---|
| 57 | | - .macro ldp1 ptr, regB, regC, val |
|---|
| 58 | | - uao_ldp 9997f, \ptr, \regB, \regC, \val |
|---|
| 47 | + .macro ldp1 reg1, reg2, ptr, val |
|---|
| 48 | + uao_ldp 9997f, \reg1, \reg2, \ptr, \val |
|---|
| 59 | 49 | .endm |
|---|
| 60 | 50 | |
|---|
| 61 | | - .macro stp1 ptr, regB, regC, val |
|---|
| 62 | | - stp \ptr, \regB, [\regC], \val |
|---|
| 51 | + .macro stp1 reg1, reg2, ptr, val |
|---|
| 52 | + stp \reg1, \reg2, [\ptr], \val |
|---|
| 63 | 53 | .endm |
|---|
| 64 | 54 | |
|---|
| 65 | 55 | end .req x5 |
|---|
| 66 | 56 | srcin .req x15 |
|---|
| 67 | | -ENTRY(__arch_copy_from_user) |
|---|
| 68 | | - uaccess_enable_not_uao x3, x4, x5 |
|---|
| 57 | +SYM_FUNC_START(__arch_copy_from_user) |
|---|
| 69 | 58 | add end, x0, x2 |
|---|
| 70 | 59 | mov srcin, x1 |
|---|
| 71 | 60 | #include "copy_template.S" |
|---|
| 72 | | - uaccess_disable_not_uao x3, x4 |
|---|
| 73 | 61 | mov x0, #0 // Nothing to copy |
|---|
| 74 | 62 | ret |
|---|
| 75 | | -ENDPROC(__arch_copy_from_user) |
|---|
| 63 | +SYM_FUNC_END(__arch_copy_from_user) |
|---|
| 64 | +EXPORT_SYMBOL(__arch_copy_from_user) |
|---|
| 76 | 65 | |
|---|
| 77 | 66 | .section .fixup,"ax" |
|---|
| 78 | 67 | .align 2 |
|---|
| .. | .. |
|---|
| 82 | 71 | USER(9998f, ldtrb tmp1w, [srcin]) |
|---|
| 83 | 72 | strb tmp1w, [dst], #1 |
|---|
| 84 | 73 | 9998: sub x0, end, dst // bytes not copied |
|---|
| 85 | | - uaccess_disable_not_uao x3, x4 |
|---|
| 86 | 74 | ret |
|---|
| 87 | 75 | .previous |
|---|