Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
60 lines
867 B
ArmAsm
60 lines
867 B
ArmAsm
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* $Id: memset.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
|
|
*
|
|
* "memset" implementation of SuperH
|
|
*
|
|
* Copyright (C) 1999 Niibe Yutaka
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* void *memset(void *s, int c, size_t n);
|
|
*/
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
ENTRY(memset)
|
|
tst r6,r6
|
|
bt/s 5f ! if n=0, do nothing
|
|
add r6,r4
|
|
mov #12,r0
|
|
cmp/gt r6,r0
|
|
bt/s 4f ! if it's too small, set a byte at once
|
|
mov r4,r0
|
|
and #3,r0
|
|
cmp/eq #0,r0
|
|
bt/s 2f ! It's aligned
|
|
sub r0,r6
|
|
1:
|
|
dt r0
|
|
bf/s 1b
|
|
mov.b r5,@-r4
|
|
2: ! make VVVV
|
|
extu.b r5,r5
|
|
swap.b r5,r0 ! V0
|
|
or r0,r5 ! VV
|
|
swap.w r5,r0 ! VV00
|
|
or r0,r5 ! VVVV
|
|
!
|
|
mov r6,r0
|
|
shlr2 r0
|
|
shlr r0 ! r0 = r6 >> 3
|
|
3:
|
|
dt r0
|
|
mov.l r5,@-r4 ! set 8-byte at once
|
|
bf/s 3b
|
|
mov.l r5,@-r4
|
|
!
|
|
mov #7,r0
|
|
and r0,r6
|
|
tst r6,r6
|
|
bt 5f
|
|
! fill bytes
|
|
4:
|
|
dt r6
|
|
bf/s 4b
|
|
mov.b r5,@-r4
|
|
5:
|
|
rts
|
|
mov r4,r0
|