1/* Set a block of memory to some byte value. For SUN4V Niagara. 2 Copyright (C) 2006-2021 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, see 17 <https://www.gnu.org/licenses/>. */ 18 19#include <sysdep.h> 20 21#define ASI_BLK_INIT_QUAD_LDD_P 0xe2 22#define ASI_P 0x80 23#define ASI_PNF 0x82 24 25#ifndef XCC 26#define USE_BPR 27#define XCC xcc 28#endif 29 30#if IS_IN (libc) 31 32 .register %g2,#scratch 33 34 .text 35 .align 32 36 37ENTRY(__memset_niagara1) 38 /* %o0=buf, %o1=pat, %o2=len */ 39 and %o1, 0xff, %o3 40 mov %o2, %o1 41 sllx %o3, 8, %g1 42 or %g1, %o3, %o2 43 sllx %o2, 16, %g1 44 or %g1, %o2, %o2 45 sllx %o2, 32, %g1 46 ba,pt %XCC, 1f 47 or %g1, %o2, %o2 48END(__memset_niagara1) 49 50ENTRY(__bzero_niagara1) 51 clr %o2 521: 53# ifndef USE_BRP 54 srl %o1, 0, %o1 55# endif 56 brz,pn %o1, 90f 57 mov %o0, %o3 58 59 wr %g0, ASI_P, %asi 60 61 cmp %o1, 15 62 blu,pn %XCC, 70f 63 andcc %o0, 0x7, %g1 64 be,pt %XCC, 2f 65 mov 8, %g2 66 sub %g2, %g1, %g1 67 sub %o1, %g1, %o1 681: stba %o2, [%o0 + 0x00] %asi 69 subcc %g1, 1, %g1 70 bne,pt %XCC, 1b 71 add %o0, 1, %o0 722: cmp %o1, 128 73 blu,pn %XCC, 60f 74 andcc %o0, (64 - 1), %g1 75 be,pt %XCC, 40f 76 mov 64, %g2 77 sub %g2, %g1, %g1 78 sub %o1, %g1, %o1 791: stxa %o2, [%o0 + 0x00] %asi 80 subcc %g1, 8, %g1 81 bne,pt %XCC, 1b 82 add %o0, 8, %o0 83 8440: 85 wr %g0, ASI_BLK_INIT_QUAD_LDD_P, %asi 86 andn %o1, (64 - 1), %g1 87 sub %o1, %g1, %o1 88 89 andn %g1, (256 - 1), %g2 90 brz,pt %g2, 50f 91 and %g1, (256 - 1), %g1 92 9345: 94 stxa %o2, [%o0 + 0x00] %asi 95 stxa %o2, [%o0 + 0x08] %asi 96 stxa %o2, [%o0 + 0x10] %asi 97 stxa %o2, [%o0 + 0x18] %asi 98 stxa %o2, [%o0 + 0x20] %asi 99 stxa %o2, [%o0 + 0x28] %asi 100 stxa %o2, [%o0 + 0x30] %asi 101 stxa %o2, [%o0 + 0x38] %asi 102 stxa %o2, [%o0 + 0x40] %asi 103 stxa %o2, [%o0 + 0x48] %asi 104 stxa %o2, [%o0 + 0x50] %asi 105 stxa %o2, [%o0 + 0x58] %asi 106 stxa %o2, [%o0 + 0x60] %asi 107 stxa %o2, [%o0 + 0x68] %asi 108 stxa %o2, [%o0 + 0x70] %asi 109 stxa %o2, [%o0 + 0x78] %asi 110 stxa %o2, [%o0 + 0x80] %asi 111 stxa %o2, [%o0 + 0x88] %asi 112 stxa %o2, [%o0 + 0x90] %asi 113 stxa %o2, [%o0 + 0x98] %asi 114 stxa %o2, [%o0 + 0xa0] %asi 115 stxa %o2, [%o0 + 0xa8] %asi 116 stxa %o2, [%o0 + 0xb0] %asi 117 stxa %o2, [%o0 + 0xb8] %asi 118 stxa %o2, [%o0 + 0xc0] %asi 119 stxa %o2, [%o0 + 0xc8] %asi 120 stxa %o2, [%o0 + 0xd0] %asi 121 stxa %o2, [%o0 + 0xd8] %asi 122 stxa %o2, [%o0 + 0xe0] %asi 123 stxa %o2, [%o0 + 0xe8] %asi 124 stxa %o2, [%o0 + 0xf0] %asi 125 stxa %o2, [%o0 + 0xf8] %asi 126 subcc %g2, 256, %g2 127 bne,pt %XCC, 45b 128 add %o0, 256, %o0 129 130 brz,pn %g1, 55f 131 nop 132 13350: 134 stxa %o2, [%o0 + 0x00] %asi 135 stxa %o2, [%o0 + 0x08] %asi 136 stxa %o2, [%o0 + 0x10] %asi 137 stxa %o2, [%o0 + 0x18] %asi 138 stxa %o2, [%o0 + 0x20] %asi 139 stxa %o2, [%o0 + 0x28] %asi 140 stxa %o2, [%o0 + 0x30] %asi 141 stxa %o2, [%o0 + 0x38] %asi 142 subcc %g1, 64, %g1 143 bne,pt %XCC, 50b 144 add %o0, 64, %o0 145 14655: 147 wr %g0, ASI_P, %asi 148 brz,pn %o1, 80f 14960: 150 andncc %o1, 0x7, %g1 151 be,pn %XCC, 2f 152 sub %o1, %g1, %o1 1531: stxa %o2, [%o0 + 0x00] %asi 154 subcc %g1, 8, %g1 155 bne,pt %XCC, 1b 156 add %o0, 8, %o0 1572: brz,pt %o1, 80f 158 nop 159 16070: 1611: stba %o2, [%o0 + 0x00] %asi 162 subcc %o1, 1, %o1 163 bne,pt %XCC, 1b 164 add %o0, 1, %o0 165 166 /* fallthrough */ 167 16880: 169 wr %g0, ASI_PNF, %asi 170 17190: 172 retl 173 mov %o3, %o0 174END(__bzero_niagara1) 175 176#endif 177