/*-1* Copyright (c) 2015-2018 The FreeBSD Foundation2* Copyright (c) 2024 Jessica Clarke <[email protected]>3*4* Part of this software was developed by Konstantin Belousov <[email protected]>5* under sponsorship from the FreeBSD Foundation.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef __RISCV_IFUNC_H30#define __RISCV_IFUNC_H3132#define DEFINE_IFUNC(qual, ret_type, name, args) \33static ret_type (*name##_resolver(void))args __used; \34qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \35static ret_type (*name##_resolver(void))args3637#define DEFINE_UIFUNC(qual, ret_type, name, args) \38static ret_type (*name##_resolver(unsigned long, unsigned long, \39unsigned long, unsigned long, unsigned long, unsigned long, \40unsigned long, unsigned long))args __used; \41qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \42static ret_type (*name##_resolver(unsigned long elf_hwcap __unused, \43unsigned long _arg2 __unused, unsigned long _arg3 __unused, \44unsigned long _arg4 __unused, unsigned long _arg5 __unused, \45unsigned long _arg6 __unused, unsigned long _arg7 __unused, \46unsigned long _arg8 __unused))args4748#endif495051