Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jun 2020 17:27:43 +0000 (UTC)
From:      Brandon Bergren <bdragon@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r537912 - in head/emulators/qemu40: . files
Message-ID:  <202006041727.054HRhPL051054@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdragon (src committer)
Date: Thu Jun  4 17:27:43 2020
New Revision: 537912
URL: https://svnweb.freebsd.org/changeset/ports/537912

Log:
  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

Added:
  head/emulators/qemu40/files/patch-util-cacheinfo.c   (contents, props changed)
Modified:
  head/emulators/qemu40/Makefile

Modified: head/emulators/qemu40/Makefile
==============================================================================
--- head/emulators/qemu40/Makefile	Thu Jun  4 16:58:25 2020	(r537911)
+++ head/emulators/qemu40/Makefile	Thu Jun  4 17:27:43 2020	(r537912)
@@ -3,7 +3,7 @@
 
 PORTNAME=	qemu
 PORTVERSION=	4.0.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	emulators
 MASTER_SITES=	https://download.qemu.org/
 PKGNAMESUFFIX=	40

Added: head/emulators/qemu40/files/patch-util-cacheinfo.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/qemu40/files/patch-util-cacheinfo.c	Thu Jun  4 17:27:43 2020	(r537912)
@@ -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 */
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006041727.054HRhPL051054>