.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Memory copy functions for 32-bit PowerPC. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 1996-2005 Paul Mackerras. |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License |
---|
8 | | - * as published by the Free Software Foundation; either version |
---|
9 | | - * 2 of the License, or (at your option) any later version. |
---|
10 | 6 | */ |
---|
11 | 7 | #include <asm/processor.h> |
---|
12 | 8 | #include <asm/cache.h> |
---|
.. | .. |
---|
14 | 10 | #include <asm/ppc_asm.h> |
---|
15 | 11 | #include <asm/export.h> |
---|
16 | 12 | #include <asm/code-patching-asm.h> |
---|
| 13 | +#include <asm/kasan.h> |
---|
17 | 14 | |
---|
18 | 15 | #define COPY_16_BYTES \ |
---|
19 | 16 | lwz r7,4(r4); \ |
---|
.. | .. |
---|
68 | 65 | LG_CACHELINE_BYTES = L1_CACHE_SHIFT |
---|
69 | 66 | CACHELINE_MASK = (L1_CACHE_BYTES-1) |
---|
70 | 67 | |
---|
| 68 | +#ifndef CONFIG_KASAN |
---|
71 | 69 | _GLOBAL(memset16) |
---|
72 | 70 | rlwinm. r0 ,r5, 31, 1, 31 |
---|
73 | 71 | addi r6, r3, -4 |
---|
.. | .. |
---|
81 | 79 | sth r4, 4(r6) |
---|
82 | 80 | blr |
---|
83 | 81 | EXPORT_SYMBOL(memset16) |
---|
| 82 | +#endif |
---|
84 | 83 | |
---|
85 | 84 | /* |
---|
86 | 85 | * Use dcbz on the complete cache lines in the destination |
---|
.. | .. |
---|
91 | 90 | * We therefore skip the optimised bloc that uses dcbz. This jump is |
---|
92 | 91 | * replaced by a nop once cache is active. This is done in machine_init() |
---|
93 | 92 | */ |
---|
94 | | -_GLOBAL(memset) |
---|
| 93 | +_GLOBAL_KASAN(memset) |
---|
95 | 94 | cmplwi 0,r5,4 |
---|
96 | 95 | blt 7f |
---|
97 | 96 | |
---|
.. | .. |
---|
151 | 150 | bdnz 9b |
---|
152 | 151 | blr |
---|
153 | 152 | EXPORT_SYMBOL(memset) |
---|
| 153 | +EXPORT_SYMBOL_KASAN(memset) |
---|
154 | 154 | |
---|
155 | 155 | /* |
---|
156 | 156 | * This version uses dcbz on the complete cache lines in the |
---|
.. | .. |
---|
163 | 163 | * We therefore jump to generic_memcpy which doesn't use dcbz. This jump is |
---|
164 | 164 | * replaced by a nop once cache is active. This is done in machine_init() |
---|
165 | 165 | */ |
---|
166 | | -_GLOBAL(memmove) |
---|
| 166 | +_GLOBAL_KASAN(memmove) |
---|
167 | 167 | cmplw 0,r3,r4 |
---|
168 | 168 | bgt backwards_memcpy |
---|
169 | 169 | /* fall through */ |
---|
170 | 170 | |
---|
171 | | -_GLOBAL(memcpy) |
---|
| 171 | +_GLOBAL_KASAN(memcpy) |
---|
172 | 172 | 1: b generic_memcpy |
---|
173 | 173 | patch_site 1b, patch__memcpy_nocache |
---|
174 | 174 | |
---|
.. | .. |
---|
244 | 244 | 65: blr |
---|
245 | 245 | EXPORT_SYMBOL(memcpy) |
---|
246 | 246 | EXPORT_SYMBOL(memmove) |
---|
| 247 | +EXPORT_SYMBOL_KASAN(memcpy) |
---|
| 248 | +EXPORT_SYMBOL_KASAN(memmove) |
---|
247 | 249 | |
---|
248 | 250 | generic_memcpy: |
---|
249 | 251 | srwi. r7,r5,3 |
---|