1 /* SPDX-License-Identifier: GPL-2.0 */
3 * memscan.S: Optimized memscan for the Sparc.
5 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
8 #include <asm/export.h>
10 /* In essence, this is just a fancy strlen. */
12 #define LO_MAGIC 0x01010101
13 #define HI_MAGIC 0x80808080
17 .globl __memscan_zero, __memscan_generic
19 EXPORT_SYMBOL(__memscan_zero)
20 EXPORT_SYMBOL(__memscan_generic)
22 /* %o0 = addr, %o1 = size */
32 sethi %hi(HI_MAGIC), %g2
35 mzero_still_not_word_aligned:
52 bne,a mzero_still_not_word_aligned
55 sethi %hi(HI_MAGIC), %g2
57 or %g2, %lo(HI_MAGIC), %o3
58 sethi %hi(LO_MAGIC), %g3
59 or %g3, %lo(LO_MAGIC), %o2
62 mzero_next_word_preloaded:
64 mzero_next_word_preloaded_next:
69 mzero_check_out_of_fuel:
78 b mzero_next_word_preloaded_next
81 /* Check every byte. */
94 bne,a mzero_byte_two_and_three
100 mzero_byte_two_and_three:
110 bne,a mzero_next_word_preloaded
122 /* %o0 = addr, %o1 = c, %o2 = size */