| .. | .. |
|---|
| 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 to user space from a kernel buffer (alignment handled by the hardware) |
|---|
| .. | .. |
|---|
| 29 | 19 | * Returns: |
|---|
| 30 | 20 | * x0 - bytes not copied |
|---|
| 31 | 21 | */ |
|---|
| 32 | | - .macro ldrb1 ptr, regB, val |
|---|
| 33 | | - ldrb \ptr, [\regB], \val |
|---|
| 22 | + .macro ldrb1 reg, ptr, val |
|---|
| 23 | + ldrb \reg, [\ptr], \val |
|---|
| 34 | 24 | .endm |
|---|
| 35 | 25 | |
|---|
| 36 | | - .macro strb1 ptr, regB, val |
|---|
| 37 | | - uao_user_alternative 9998f, strb, sttrb, \ptr, \regB, \val |
|---|
| 26 | + .macro strb1 reg, ptr, val |
|---|
| 27 | + uao_user_alternative 9998f, strb, sttrb, \reg, \ptr, \val |
|---|
| 38 | 28 | .endm |
|---|
| 39 | 29 | |
|---|
| 40 | | - .macro ldrh1 ptr, regB, val |
|---|
| 41 | | - ldrh \ptr, [\regB], \val |
|---|
| 30 | + .macro ldrh1 reg, ptr, val |
|---|
| 31 | + ldrh \reg, [\ptr], \val |
|---|
| 42 | 32 | .endm |
|---|
| 43 | 33 | |
|---|
| 44 | | - .macro strh1 ptr, regB, val |
|---|
| 45 | | - uao_user_alternative 9997f, strh, sttrh, \ptr, \regB, \val |
|---|
| 34 | + .macro strh1 reg, ptr, val |
|---|
| 35 | + uao_user_alternative 9997f, strh, sttrh, \reg, \ptr, \val |
|---|
| 46 | 36 | .endm |
|---|
| 47 | 37 | |
|---|
| 48 | | - .macro ldr1 ptr, regB, val |
|---|
| 49 | | - ldr \ptr, [\regB], \val |
|---|
| 38 | + .macro ldr1 reg, ptr, val |
|---|
| 39 | + ldr \reg, [\ptr], \val |
|---|
| 50 | 40 | .endm |
|---|
| 51 | 41 | |
|---|
| 52 | | - .macro str1 ptr, regB, val |
|---|
| 53 | | - uao_user_alternative 9997f, str, sttr, \ptr, \regB, \val |
|---|
| 42 | + .macro str1 reg, ptr, val |
|---|
| 43 | + uao_user_alternative 9997f, str, sttr, \reg, \ptr, \val |
|---|
| 54 | 44 | .endm |
|---|
| 55 | 45 | |
|---|
| 56 | | - .macro ldp1 ptr, regB, regC, val |
|---|
| 57 | | - ldp \ptr, \regB, [\regC], \val |
|---|
| 46 | + .macro ldp1 reg1, reg2, ptr, val |
|---|
| 47 | + ldp \reg1, \reg2, [\ptr], \val |
|---|
| 58 | 48 | .endm |
|---|
| 59 | 49 | |
|---|
| 60 | | - .macro stp1 ptr, regB, regC, val |
|---|
| 61 | | - uao_stp 9997f, \ptr, \regB, \regC, \val |
|---|
| 50 | + .macro stp1 reg1, reg2, ptr, val |
|---|
| 51 | + uao_stp 9997f, \reg1, \reg2, \ptr, \val |
|---|
| 62 | 52 | .endm |
|---|
| 63 | 53 | |
|---|
| 64 | 54 | end .req x5 |
|---|
| 65 | 55 | srcin .req x15 |
|---|
| 66 | | -ENTRY(__arch_copy_to_user) |
|---|
| 67 | | - uaccess_enable_not_uao x3, x4, x5 |
|---|
| 56 | +SYM_FUNC_START(__arch_copy_to_user) |
|---|
| 68 | 57 | add end, x0, x2 |
|---|
| 69 | 58 | mov srcin, x1 |
|---|
| 70 | 59 | #include "copy_template.S" |
|---|
| 71 | | - uaccess_disable_not_uao x3, x4 |
|---|
| 72 | 60 | mov x0, #0 |
|---|
| 73 | 61 | ret |
|---|
| 74 | | -ENDPROC(__arch_copy_to_user) |
|---|
| 62 | +SYM_FUNC_END(__arch_copy_to_user) |
|---|
| 63 | +EXPORT_SYMBOL(__arch_copy_to_user) |
|---|
| 75 | 64 | |
|---|
| 76 | 65 | .section .fixup,"ax" |
|---|
| 77 | 66 | .align 2 |
|---|
| .. | .. |
|---|
| 82 | 71 | USER(9998f, sttrb tmp1w, [dst]) |
|---|
| 83 | 72 | add dst, 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 |
|---|