[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/1] util/getauxval: Porting to FreeBSD getauxval feature
From: |
David CARLIER |
Subject: |
[PATCH 1/1] util/getauxval: Porting to FreeBSD getauxval feature |
Date: |
Sun, 24 May 2020 13:09:53 +0100 |
Hi here porting qemu_getauxval to FreeBSD. Thanks. Regards.
>From 5be5e56a59631b28ed7b738d251dda252ba9b03e Mon Sep 17 00:00:00 2001
From: David Carlier <address@hidden>
Date: Sun, 24 May 2020 13:03:32 +0100
Subject: [PATCH] util/getauxval: FreeBSD has a similar auxilary vector API
Signed-off-by: David Carlier <address@hidden>
---
configure | 6 ++++++
util/getauxval.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/configure b/configure
index 2fc05c4465..545fd2364f 100755
--- a/configure
+++ b/configure
@@ -5824,7 +5824,13 @@ getauxval=no
cat > $TMPC << EOF
#include <sys/auxv.h>
int main(void) {
+#if defined(__linux__)
return getauxval(AT_HWCAP) == 0;
+#elif defined(__FreeBSD__)
+ unsigned long a = 0;
+ return elf_aux_info(AT_HWCAP, &a, sizeof(a)) == 0;
+#endif
+ return 1;
}
EOF
if compile_prog "" "" ; then
diff --git a/util/getauxval.c b/util/getauxval.c
index 36afdfb9e6..373ed3899f 100644
--- a/util/getauxval.c
+++ b/util/getauxval.c
@@ -33,7 +33,13 @@
unsigned long qemu_getauxval(unsigned long key)
{
+#if defined(__linux__)
return getauxval(key);
+#elif defined(__FreeBSD__)
+ unsigned long aux = 0;
+ elf_aux_info(key, &aux, sizeof(aux));
+ return aux;
+#endif
}
#elif defined(__linux__)
#include "elf.h"
--
2.26.2
- [PATCH 1/1] util/getauxval: Porting to FreeBSD getauxval feature,
David CARLIER <=