1 /* SPDX-License-Identifier: GPL-2.0 */
3 * memscan.S: Optimized memscan for Sparc64.
5 * Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
6 * Copyright (C) 1998 David S. Miller (davem@redhat.com)
9 #include <asm/export.h>
11 #define HI_MAGIC 0x8080808080808080
12 #define LO_MAGIC 0x0101010101010101
17 .globl __memscan_zero, __memscan_generic
18 .type __memscan_zero,#function
19 .type __memscan_generic,#function
21 EXPORT_SYMBOL(__memscan_zero)
22 EXPORT_SYMBOL(__memscan_generic)
25 /* %o0 = bufp, %o1 = size */
28 be,pt %icc, we_are_aligned
29 sethi %hi(HI_MAGIC), %o4
40 ldxa [%o0] ASI_PL, %o5
41 or %o4, %lo(HI_MAGIC), %o3
52 bne,pn %xcc, check_bytes
56 ldxa [%o0] ASI_PL, %o5
84 3: andcc %g7, 0xff, %g0
102 2: brgz,a,pt %o1, msloop
103 ldxa [%o0] ASI_PL, %o5
117 /* %o0 = addr, %o1 = c, %o2 = size */
127 ldub [%o3 + %o4], %o5
129 /* The delay slot is the same as the next insn, this is just to make it look more awful */