Thomas Gleixner | caab277 | 2019-06-03 07:44:50 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Catalin Marinas | 4a89922 | 2013-03-21 16:16:43 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013 ARM Ltd. |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 4 | * Copyright (C) 2013 Linaro. |
| 5 | * |
| 6 | * This code is based on glibc cortex strings work originally authored by Linaro |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 7 | * be found @ |
| 8 | * |
| 9 | * http://bazaar.launchpad.net/~linaro-toolchain-dev/cortex-strings/trunk/ |
| 10 | * files/head:/src/aarch64/ |
Catalin Marinas | 4a89922 | 2013-03-21 16:16:43 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <linux/linkage.h> |
| 14 | #include <asm/assembler.h> |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 15 | #include <asm/cache.h> |
Catalin Marinas | 4a89922 | 2013-03-21 16:16:43 +0000 | [diff] [blame] | 16 | |
| 17 | /* |
| 18 | * Copy a buffer from src to dest (alignment handled by the hardware) |
| 19 | * |
| 20 | * Parameters: |
| 21 | * x0 - dest |
| 22 | * x1 - src |
| 23 | * x2 - n |
| 24 | * Returns: |
| 25 | * x0 - dest |
| 26 | */ |
Feng Kan | e5c88e3 | 2015-09-23 11:55:38 -0700 | [diff] [blame] | 27 | .macro ldrb1 ptr, regB, val |
| 28 | ldrb \ptr, [\regB], \val |
| 29 | .endm |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 30 | |
Feng Kan | e5c88e3 | 2015-09-23 11:55:38 -0700 | [diff] [blame] | 31 | .macro strb1 ptr, regB, val |
| 32 | strb \ptr, [\regB], \val |
| 33 | .endm |
| 34 | |
| 35 | .macro ldrh1 ptr, regB, val |
| 36 | ldrh \ptr, [\regB], \val |
| 37 | .endm |
| 38 | |
| 39 | .macro strh1 ptr, regB, val |
| 40 | strh \ptr, [\regB], \val |
| 41 | .endm |
| 42 | |
| 43 | .macro ldr1 ptr, regB, val |
| 44 | ldr \ptr, [\regB], \val |
| 45 | .endm |
| 46 | |
| 47 | .macro str1 ptr, regB, val |
| 48 | str \ptr, [\regB], \val |
| 49 | .endm |
| 50 | |
| 51 | .macro ldp1 ptr, regB, regC, val |
| 52 | ldp \ptr, \regB, [\regC], \val |
| 53 | .endm |
| 54 | |
| 55 | .macro stp1 ptr, regB, regC, val |
| 56 | stp \ptr, \regB, [\regC], \val |
| 57 | .endm |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 58 | |
Andrey Ryabinin | 39d114d | 2015-10-12 18:52:58 +0300 | [diff] [blame] | 59 | .weak memcpy |
| 60 | ENTRY(__memcpy) |
Catalin Marinas | 4a89922 | 2013-03-21 16:16:43 +0000 | [diff] [blame] | 61 | ENTRY(memcpy) |
Feng Kan | e5c88e3 | 2015-09-23 11:55:38 -0700 | [diff] [blame] | 62 | #include "copy_template.S" |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 63 | ret |
Ard Biesheuvel | 2079184 | 2015-10-08 20:02:03 +0100 | [diff] [blame] | 64 | ENDPIPROC(memcpy) |
Mark Rutland | ac0e8c7 | 2018-12-07 18:08:21 +0000 | [diff] [blame] | 65 | EXPORT_SYMBOL(memcpy) |
Andrey Ryabinin | 39d114d | 2015-10-12 18:52:58 +0300 | [diff] [blame] | 66 | ENDPROC(__memcpy) |
Mark Rutland | ac0e8c7 | 2018-12-07 18:08:21 +0000 | [diff] [blame] | 67 | EXPORT_SYMBOL(__memcpy) |