aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Bergren <bdragon@FreeBSD.org>2020-06-04 23:32:26 +0000
committerBrandon Bergren <bdragon@FreeBSD.org>2020-06-04 23:32:26 +0000
commit4c343de6876a3960751514db6970485214bc58f5 (patch)
treed0277eaa3868f15ee84652daaf0f59186152c0a0
parentc72c89d9f6d9aa766426a43cef510e3eb3e40b4d (diff)
downloadports-4c343de6876a3960751514db6970485214bc58f5.tar.gz
ports-4c343de6876a3960751514db6970485214bc58f5.zip
MFH: r537912
emulators/qemu40: Apply upstream fix for cacheline detection on big endian Backport qemu 5ca156cfde0f3821f15988619e51cf3cda99aaa6, which fixes cacheline detection on big-endian to use the correct sized variable to store the sysctl result. Fixes "Assertion failed: ((isize & (isize - 1)) == 0)" on BE platforms. Reviewed by: bofh, pkubaj Approved by: pkubaj Obtained from: qemu Differential Revision: https://reviews.freebsd.org/D23246 Approved by: ports-secteam (joneum)
Notes
Notes: svn path=/branches/2020Q2/; revision=537979
-rw-r--r--emulators/qemu40/Makefile1
-rw-r--r--emulators/qemu40/files/patch-util-cacheinfo.c41
2 files changed, 42 insertions, 0 deletions
diff --git a/emulators/qemu40/Makefile b/emulators/qemu40/Makefile
index 6b5b07afe827..d6d45cc0979f 100644
--- a/emulators/qemu40/Makefile
+++ b/emulators/qemu40/Makefile
@@ -3,6 +3,7 @@
PORTNAME= qemu
PORTVERSION= 4.0.1
+PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= https://download.qemu.org/
PKGNAMESUFFIX= 40
diff --git a/emulators/qemu40/files/patch-util-cacheinfo.c b/emulators/qemu40/files/patch-util-cacheinfo.c
new file mode 100644
index 000000000000..58f57fbc65a0
--- /dev/null
+++ b/emulators/qemu40/files/patch-util-cacheinfo.c
@@ -0,0 +1,41 @@
+--- util/cacheinfo.c.orig 2019-10-17 15:17:44.000000000 -0500
++++ util/cacheinfo.c 2020-01-17 21:13:29.459470000 -0600
+@@ -65,25 +65,28 @@ static void sys_cache_info(int *isize, int *dsize)
+ g_free(buf);
+ }
+
+-#elif defined(__APPLE__) \
+- || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#elif defined(__APPLE__)
+ # include <sys/sysctl.h>
+-# if defined(__APPLE__)
+-# define SYSCTL_CACHELINE_NAME "hw.cachelinesize"
+-# else
+-# define SYSCTL_CACHELINE_NAME "machdep.cacheline_size"
+-# endif
+-
+ static void sys_cache_info(int *isize, int *dsize)
+ {
+ /* There's only a single sysctl for both I/D cache line sizes. */
+ long size;
+ size_t len = sizeof(size);
+- if (!sysctlbyname(SYSCTL_CACHELINE_NAME, &size, &len, NULL, 0)) {
++ if (!sysctlbyname("hw.cachelinesize", &size, &len, NULL, 0)) {
+ *isize = *dsize = size;
+ }
+ }
+-
++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++# include <sys/sysctl.h>
++static void sys_cache_info(int *isize, int *dsize)
++{
++ /* There's only a single sysctl for both I/D cache line sizes. */
++ int size;
++ size_t len = sizeof(size);
++ if (!sysctlbyname("machdep.cacheline_size", &size, &len, NULL, 0)) {
++ *isize = *dsize = size;
++ }
++}
+ #else
+ /* POSIX */
+