1caab277bSThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */ 20aea86a2SCatalin Marinas/* 30aea86a2SCatalin Marinas * Copyright (C) 2012 ARM Ltd. 40aea86a2SCatalin Marinas */ 50aea86a2SCatalin Marinas 60aea86a2SCatalin Marinas#include <linux/linkage.h> 7338d4f49SJames Morse 8b4b8664dSAl Viro#include <asm/asm-uaccess.h> 956c08ec5SMark Rutland#include <asm/assembler.h> 1056c08ec5SMark Rutland#include <asm/cache.h> 110aea86a2SCatalin Marinas 120aea86a2SCatalin Marinas/* 130aea86a2SCatalin Marinas * Copy from user space to a kernel buffer (alignment handled by the hardware) 140aea86a2SCatalin Marinas * 150aea86a2SCatalin Marinas * Parameters: 160aea86a2SCatalin Marinas * x0 - to 170aea86a2SCatalin Marinas * x1 - from 180aea86a2SCatalin Marinas * x2 - n 190aea86a2SCatalin Marinas * Returns: 200aea86a2SCatalin Marinas * x0 - bytes not copied 210aea86a2SCatalin Marinas */ 2240426882SFeng Kan 23*ada66f18SCatalin Marinas .macro ldrb1 reg, ptr, val 24*ada66f18SCatalin Marinas uao_user_alternative 9998f, ldrb, ldtrb, \reg, \ptr, \val 2540426882SFeng Kan .endm 2640426882SFeng Kan 27*ada66f18SCatalin Marinas .macro strb1 reg, ptr, val 28*ada66f18SCatalin Marinas strb \reg, [\ptr], \val 2940426882SFeng Kan .endm 3040426882SFeng Kan 31*ada66f18SCatalin Marinas .macro ldrh1 reg, ptr, val 32*ada66f18SCatalin Marinas uao_user_alternative 9998f, ldrh, ldtrh, \reg, \ptr, \val 3340426882SFeng Kan .endm 3440426882SFeng Kan 35*ada66f18SCatalin Marinas .macro strh1 reg, ptr, val 36*ada66f18SCatalin Marinas strh \reg, [\ptr], \val 3740426882SFeng Kan .endm 3840426882SFeng Kan 39*ada66f18SCatalin Marinas .macro ldr1 reg, ptr, val 40*ada66f18SCatalin Marinas uao_user_alternative 9998f, ldr, ldtr, \reg, \ptr, \val 4140426882SFeng Kan .endm 4240426882SFeng Kan 43*ada66f18SCatalin Marinas .macro str1 reg, ptr, val 44*ada66f18SCatalin Marinas str \reg, [\ptr], \val 4540426882SFeng Kan .endm 4640426882SFeng Kan 47*ada66f18SCatalin Marinas .macro ldp1 reg1, reg2, ptr, val 48*ada66f18SCatalin Marinas uao_ldp 9998f, \reg1, \reg2, \ptr, \val 4940426882SFeng Kan .endm 5040426882SFeng Kan 51*ada66f18SCatalin Marinas .macro stp1 reg1, reg2, ptr, val 52*ada66f18SCatalin Marinas stp \reg1, \reg2, [\ptr], \val 5340426882SFeng Kan .endm 5440426882SFeng Kan 5540426882SFeng Kanend .req x5 563ac0f452SMark BrownSYM_FUNC_START(__arch_copy_from_user) 5740426882SFeng Kan add end, x0, x2 5840426882SFeng Kan#include "copy_template.S" 5940426882SFeng Kan mov x0, #0 // Nothing to copy 600aea86a2SCatalin Marinas ret 613ac0f452SMark BrownSYM_FUNC_END(__arch_copy_from_user) 6256c08ec5SMark RutlandEXPORT_SYMBOL(__arch_copy_from_user) 630aea86a2SCatalin Marinas 640aea86a2SCatalin Marinas .section .fixup,"ax" 650aea86a2SCatalin Marinas .align 2 664855bd25SAl Viro9998: sub x0, end, dst // bytes not copied 670aea86a2SCatalin Marinas ret 680aea86a2SCatalin Marinas .previous 69