| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * String handling functions for PowerPC. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 1996 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/errno.h> |
|---|
| 13 | 9 | #include <asm/ppc_asm.h> |
|---|
| 14 | 10 | #include <asm/export.h> |
|---|
| 11 | +#include <asm/kasan.h> |
|---|
| 15 | 12 | |
|---|
| 13 | +#ifndef CONFIG_KASAN |
|---|
| 16 | 14 | _GLOBAL(__memset16) |
|---|
| 17 | 15 | rlwimi r4,r4,16,0,15 |
|---|
| 18 | 16 | /* fall through */ |
|---|
| .. | .. |
|---|
| 29 | 27 | EXPORT_SYMBOL(__memset16) |
|---|
| 30 | 28 | EXPORT_SYMBOL(__memset32) |
|---|
| 31 | 29 | EXPORT_SYMBOL(__memset64) |
|---|
| 30 | +#endif |
|---|
| 32 | 31 | |
|---|
| 33 | | -_GLOBAL(memset) |
|---|
| 32 | +_GLOBAL_KASAN(memset) |
|---|
| 34 | 33 | neg r0,r3 |
|---|
| 35 | 34 | rlwimi r4,r4,8,16,23 |
|---|
| 36 | 35 | andi. r0,r0,7 /* # bytes to be 8-byte aligned */ |
|---|
| .. | .. |
|---|
| 40 | 39 | .Lms: PPC_MTOCRF(1,r0) |
|---|
| 41 | 40 | mr r6,r3 |
|---|
| 42 | 41 | blt cr1,8f |
|---|
| 43 | | - beq+ 3f /* if already 8-byte aligned */ |
|---|
| 42 | + beq 3f /* if already 8-byte aligned */ |
|---|
| 44 | 43 | subf r5,r0,r5 |
|---|
| 45 | 44 | bf 31,1f |
|---|
| 46 | 45 | stb r4,0(r6) |
|---|
| .. | .. |
|---|
| 85 | 84 | addi r6,r6,8 |
|---|
| 86 | 85 | 8: cmpwi r5,0 |
|---|
| 87 | 86 | PPC_MTOCRF(1,r5) |
|---|
| 88 | | - beqlr+ |
|---|
| 87 | + beqlr |
|---|
| 89 | 88 | bf 29,9f |
|---|
| 90 | 89 | stw r4,0(r6) |
|---|
| 91 | 90 | addi r6,r6,4 |
|---|
| .. | .. |
|---|
| 96 | 95 | stb r4,0(r6) |
|---|
| 97 | 96 | blr |
|---|
| 98 | 97 | EXPORT_SYMBOL(memset) |
|---|
| 98 | +EXPORT_SYMBOL_KASAN(memset) |
|---|
| 99 | 99 | |
|---|
| 100 | | -_GLOBAL_TOC(memmove) |
|---|
| 100 | +_GLOBAL_TOC_KASAN(memmove) |
|---|
| 101 | 101 | cmplw 0,r3,r4 |
|---|
| 102 | 102 | bgt backwards_memcpy |
|---|
| 103 | 103 | b memcpy |
|---|
| .. | .. |
|---|
| 139 | 139 | mtctr r7 |
|---|
| 140 | 140 | b 1b |
|---|
| 141 | 141 | EXPORT_SYMBOL(memmove) |
|---|
| 142 | +EXPORT_SYMBOL_KASAN(memmove) |
|---|