arm64: Provide ifunc HWCAP structure definitions

IFUNC structure is based on Section 9.4.1 "GNU C Library IFUNC interface"
from "System V ABI for the Arm 64-bit Architecture (AArch64)", 2025Q1.
(https://github.com/ARM-software/abi-aa/releases/download/2025Q1/sysvabi64.pdf)

Reviewed by:	andrew
Sponsored by:   Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54598
This commit is contained in:
Sarah Walker
2026-01-13 14:19:56 +00:00
committed by Andrew Turner
parent 591c7a08bf
commit 449339bdba
+23 -5
View File
@@ -29,20 +29,38 @@
#ifndef __ARM64_IFUNC_H
#define __ARM64_IFUNC_H
struct __ifunc_arg_t
{
unsigned long _size; /* Size of the struct, so it can grow. */
unsigned long _hwcap;
unsigned long _hwcap2;
unsigned long _hwcap3;
unsigned long _hwcap4;
};
typedef struct __ifunc_arg_t __ifunc_arg_t;
#define _IFUNC_ARG_HWCAP (1ULL << 62)
#define DEFINE_IFUNC(qual, ret_type, name, args) \
static ret_type (*name##_resolver(void))args __used; \
qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \
static ret_type (*name##_resolver(void))args
#define DEFINE_UIFUNC(qual, ret_type, name, args) \
static ret_type (*name##_resolver(uint64_t, uint64_t, \
static ret_type (*name##_resolver(uint64_t, \
const struct __ifunc_arg_t *ifunc_arg, \
uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, \
uint64_t))args __used; \
qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \
static ret_type (*name##_resolver(uint64_t _arg1 __unused, \
uint64_t _arg2 __unused, uint64_t _arg3 __unused, \
uint64_t _arg4 __unused, uint64_t _arg5 __unused, \
uint64_t _arg6 __unused, uint64_t _arg7 __unused, \
static ret_type (*name##_resolver( \
uint64_t at_hwcap __unused, \
const struct __ifunc_arg_t *ifunc_arg __unused, \
uint64_t _arg3 __unused, \
uint64_t _arg4 __unused, \
uint64_t _arg5 __unused, \
uint64_t _arg6 __unused, \
uint64_t _arg7 __unused, \
uint64_t _arg8 __unused))args
#endif