qemu-common: set icache/dcache line size to 0

From Bionic's sysconf.cpp:

  // We do not have actual implementations for cache queries.
  // It's valid to return 0 as the result is unknown.
  case _SC_LEVEL1_ICACHE_SIZE:      return 0;
  case _SC_LEVEL1_ICACHE_ASSOC:     return 0;
  case _SC_LEVEL1_ICACHE_LINESIZE:  return 0;
  case _SC_LEVEL1_DCACHE_SIZE:      return 0;
  case _SC_LEVEL1_DCACHE_ASSOC:     return 0;
  case _SC_LEVEL1_DCACHE_LINESIZE:  return 0;

So actually it already should be set to 0, but it appears some devices set it
to -1 which triggers assertion error.
This commit is contained in:
Leonid Pliushch 2019-05-27 19:03:02 +03:00 committed by Yaksh Bariya
parent 4e4bc08cc2
commit 64ee9557fd
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,17 @@
diff -uNr qemu-4.0.0/util/cacheinfo.c qemu-4.0.0.mod/util/cacheinfo.c
--- qemu-4.0.0/util/cacheinfo.c 2019-04-23 21:14:46.000000000 +0300
+++ qemu-4.0.0.mod/util/cacheinfo.c 2019-05-27 18:52:53.357425925 +0300
@@ -172,13 +172,6 @@
{
int isize = 0, dsize = 0;
- sys_cache_info(&isize, &dsize);
- arch_cache_info(&isize, &dsize);
- fallback_cache_info(&isize, &dsize);
-
- assert((isize & (isize - 1)) == 0);
- assert((dsize & (dsize - 1)) == 0);
-
qemu_icache_linesize = isize;
qemu_icache_linesize_log = ctz32(isize);
qemu_dcache_linesize = dsize;

View File

@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="A set common files for the QEMU emulators"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="Leonid Plyushch <leonid.plyushch@gmail.com>"
TERMUX_PKG_VERSION=4.0.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://download.qemu.org/qemu-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=13a93dfe75b86734326f8d5b475fde82ec692d5b5a338b4262aeeb6b0fa4e469
TERMUX_PKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcap, libcurl, libffi, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, openssl, pcre, sdl2, zlib"