diff options
author | Brandon Bergren <bdragon@FreeBSD.org> | 2020-06-04 17:27:43 +0000 |
---|---|---|
committer | Brandon Bergren <bdragon@FreeBSD.org> | 2020-06-04 17:27:43 +0000 |
commit | 7af2c5b97574b5d71e03244fb81e546461838c71 (patch) | |
tree | c7c68aec88edbe3056ff7b0df3f28a34b3b294c0 /emulators | |
parent | 4689b10a13e641a6133ed4fd9b4aa3624c40e05e (diff) | |
download | ports-7af2c5b97574b5d71e03244fb81e546461838c71.tar.gz ports-7af2c5b97574b5d71e03244fb81e546461838c71.zip |
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
MFH: 2020Q2 (blanket: runtime fix)
Differential Revision: https://reviews.freebsd.org/D23246
Notes
Notes:
svn path=/head/; revision=537912
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/qemu40/Makefile | 2 | ||||
-rw-r--r-- | emulators/qemu40/files/patch-util-cacheinfo.c | 41 |
2 files changed, 42 insertions, 1 deletions
diff --git a/emulators/qemu40/Makefile b/emulators/qemu40/Makefile index d6d45cc0979f..c499070189a8 100644 --- a/emulators/qemu40/Makefile +++ b/emulators/qemu40/Makefile @@ -3,7 +3,7 @@ PORTNAME= qemu PORTVERSION= 4.0.1 -PORTREVISION= 1 +PORTREVISION= 2 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 */ + |