We already do this twice and want to add another so add a helper.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <linux/auxvec.h>
#include "trace.h"
#include "reg.h"
{
#ifdef PPC_FEATURE2_EBB
/* EBB requires at least POWER8 */
- return ((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_EBB);
+ return have_hwcap2(PPC_FEATURE2_EBB);
#else
return false;
#endif
#include <sys/syscall.h>
#include <asm/tm.h>
#include <asm/cputable.h>
-#include <linux/auxvec.h>
#include <sys/time.h>
#include <stdlib.h>
static inline bool have_htm_nosc(void)
{
#ifdef PPC_FEATURE2_HTM_NOSC
- return ((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_HTM_NOSC);
+ return have_hwcap2(PPC_FEATURE2_HTM_NOSC);
#else
printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n");
return false;
#include <stdint.h>
#include <stdbool.h>
+#include <linux/auxvec.h>
/* Avoid headaches with PRI?64 - just use %ll? always */
typedef unsigned long long u64;
int test_harness(int (test_function)(void), char *name);
extern void *get_auxv_entry(int type);
+static inline bool have_hwcap2(unsigned long ftr2)
+{
+ return ((unsigned long)get_auxv_entry(AT_HWCAP2) & ftr2) == ftr2;
+}
+
/* Yes, this is evil */
#define FAIL_IF(x) \
do { \