1*181e3500SLeandro Lupori /*- 2*181e3500SLeandro Lupori * Copyright (c) 2019 Leandro Lupori 3*181e3500SLeandro Lupori * 4*181e3500SLeandro Lupori * Redistribution and use in source and binary forms, with or without 5*181e3500SLeandro Lupori * modification, are permitted provided that the following conditions 6*181e3500SLeandro Lupori * are met: 7*181e3500SLeandro Lupori * 1. Redistributions of source code must retain the above copyright 8*181e3500SLeandro Lupori * notice, this list of conditions and the following disclaimer. 9*181e3500SLeandro Lupori * 2. Redistributions in binary form must reproduce the above copyright 10*181e3500SLeandro Lupori * notice, this list of conditions and the following disclaimer in the 11*181e3500SLeandro Lupori * documentation and/or other materials provided with the distribution. 12*181e3500SLeandro Lupori * 3. Neither the name of the author nor the names of its contributors may 13*181e3500SLeandro Lupori * be used to endorse or promote products derived from this software 14*181e3500SLeandro Lupori * 15*181e3500SLeandro Lupori * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16*181e3500SLeandro Lupori * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*181e3500SLeandro Lupori * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*181e3500SLeandro Lupori * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19*181e3500SLeandro Lupori * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*181e3500SLeandro Lupori * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*181e3500SLeandro Lupori * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*181e3500SLeandro Lupori * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*181e3500SLeandro Lupori * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*181e3500SLeandro Lupori * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*181e3500SLeandro Lupori * SUCH DAMAGE. 26*181e3500SLeandro Lupori */ 27*181e3500SLeandro Lupori 28*181e3500SLeandro Lupori 29*181e3500SLeandro Lupori #include <machine/cpu.h> 30*181e3500SLeandro Lupori #include <machine/ifunc.h> 31*181e3500SLeandro Lupori 32*181e3500SLeandro Lupori char * 33*181e3500SLeandro Lupori __strncpy_arch_2_05(char * restrict dst, const char * restrict src, size_t len); 34*181e3500SLeandro Lupori 35*181e3500SLeandro Lupori char * 36*181e3500SLeandro Lupori __strncpy(char * restrict dst, const char * restrict src, size_t len); 37*181e3500SLeandro Lupori 38*181e3500SLeandro Lupori DEFINE_UIFUNC(, char *, strncpy, 39*181e3500SLeandro Lupori (char * restrict, const char * restrict, size_t)) 40*181e3500SLeandro Lupori { 41*181e3500SLeandro Lupori if (cpu_features & PPC_FEATURE_ARCH_2_05) 42*181e3500SLeandro Lupori return (__strncpy_arch_2_05); 43*181e3500SLeandro Lupori else 44*181e3500SLeandro Lupori return (__strncpy); 45*181e3500SLeandro Lupori } 46