Catalin Marinas | 4a89922 | 2013-03-21 16:16:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 ARM Ltd. |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 3 | * Copyright (C) 2013 Linaro. |
| 4 | * |
| 5 | * This code is based on glibc cortex strings work originally authored by Linaro |
| 6 | * and re-licensed under GPLv2 for the Linux kernel. The original code can |
| 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 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License version 2 as |
| 14 | * published by the Free Software Foundation. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | */ |
| 24 | |
| 25 | #include <linux/linkage.h> |
| 26 | #include <asm/assembler.h> |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 27 | #include <asm/cache.h> |
Catalin Marinas | 4a89922 | 2013-03-21 16:16:43 +0000 | [diff] [blame] | 28 | |
| 29 | /* |
| 30 | * Copy a buffer from src to dest (alignment handled by the hardware) |
| 31 | * |
| 32 | * Parameters: |
| 33 | * x0 - dest |
| 34 | * x1 - src |
| 35 | * x2 - n |
| 36 | * Returns: |
| 37 | * x0 - dest |
| 38 | */ |
Feng Kan | e5c88e3 | 2015-09-23 11:55:38 -0700 | [diff] [blame] | 39 | .macro ldrb1 ptr, regB, val |
| 40 | ldrb \ptr, [\regB], \val |
| 41 | .endm |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 42 | |
Feng Kan | e5c88e3 | 2015-09-23 11:55:38 -0700 | [diff] [blame] | 43 | .macro strb1 ptr, regB, val |
| 44 | strb \ptr, [\regB], \val |
| 45 | .endm |
| 46 | |
| 47 | .macro ldrh1 ptr, regB, val |
| 48 | ldrh \ptr, [\regB], \val |
| 49 | .endm |
| 50 | |
| 51 | .macro strh1 ptr, regB, val |
| 52 | strh \ptr, [\regB], \val |
| 53 | .endm |
| 54 | |
| 55 | .macro ldr1 ptr, regB, val |
| 56 | ldr \ptr, [\regB], \val |
| 57 | .endm |
| 58 | |
| 59 | .macro str1 ptr, regB, val |
| 60 | str \ptr, [\regB], \val |
| 61 | .endm |
| 62 | |
| 63 | .macro ldp1 ptr, regB, regC, val |
| 64 | ldp \ptr, \regB, [\regC], \val |
| 65 | .endm |
| 66 | |
| 67 | .macro stp1 ptr, regB, regC, val |
| 68 | stp \ptr, \regB, [\regC], \val |
| 69 | .endm |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 70 | |
Andrey Ryabinin | 39d114d | 2015-10-12 18:52:58 +0300 | [diff] [blame] | 71 | .weak memcpy |
| 72 | ENTRY(__memcpy) |
Catalin Marinas | 4a89922 | 2013-03-21 16:16:43 +0000 | [diff] [blame] | 73 | ENTRY(memcpy) |
Feng Kan | e5c88e3 | 2015-09-23 11:55:38 -0700 | [diff] [blame] | 74 | #include "copy_template.S" |
zhichang.yuan | 808dbac | 2014-04-28 06:11:29 +0100 | [diff] [blame] | 75 | ret |
Ard Biesheuvel | 2079184 | 2015-10-08 20:02:03 +0100 | [diff] [blame] | 76 | ENDPIPROC(memcpy) |
Andrey Ryabinin | 39d114d | 2015-10-12 18:52:58 +0300 | [diff] [blame] | 77 | ENDPROC(__memcpy) |