aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--emulators/qemu-devel/Makefile2
-rw-r--r--emulators/qemu-devel/files/extra-patch-sysctl-hw-physmem40
2 files changed, 42 insertions, 0 deletions
diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile
index bb21aa417a38..8f58491ab925 100644
--- a/emulators/qemu-devel/Makefile
+++ b/emulators/qemu-devel/Makefile
@@ -3,6 +3,7 @@
PORTNAME= qemu
PORTVERSION= 2.0.2
+PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= http://wiki.qemu.org/download/:release \
LOCAL/nox:snapshot
@@ -76,6 +77,7 @@ EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-sparc64-target_arch_cpu.h
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-trapsig
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-21927cffcc7bcacbb953155f778200846df9f60e
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-freebsd-os-sys.c
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-sysctl-hw-physmem
.endif
CONFIGURE_ARGS+= --extra-ldflags=-L${LOCALBASE}/lib
diff --git a/emulators/qemu-devel/files/extra-patch-sysctl-hw-physmem b/emulators/qemu-devel/files/extra-patch-sysctl-hw-physmem
new file mode 100644
index 000000000000..ae7ff4bdac85
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-sysctl-hw-physmem
@@ -0,0 +1,40 @@
+From nox Mon Sep 17 00:00:00 2001
+From: Juergen Lock <nox@jelal.kn-bremen.de>
+Date: 23 Aug 2014 00:24:00 +0200
+Subject: Fix FreeBSD sysctl hw.physmem
+
+Fix FreeBSD sysctl hw.physmem if host bitsize != target's.
+
+Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
+
+--- a/bsd-user/freebsd/os-sys.c
++++ b/bsd-user/freebsd/os-sys.c
+@@ -338,6 +338,28 @@ abi_long do_freebsd_sysctl(CPUArchState
+ ret = 0;
+ goto out;
+
++#if TARGET_ABI_BITS != HOST_LONG_BITS
++ case HW_PHYSMEM:
++ holdlen = sizeof(abi_ulong);
++ ret = 0;
++
++ if (oldlen) {
++ unsigned long lvalue;
++ size_t len = sizeof(lvalue);
++
++ if (sysctlbyname("hw.physmem", &lvalue, &len, NULL, 0)
++ == -1) {
++ ret = -1;
++ } else {
++ abi_ulong maxmem = -0x100c000;
++ if (((unsigned long)maxmem) < lvalue)
++ lvalue = maxmem;
++ (*(abi_ulong *)holdp) = lvalue;
++ }
++ }
++ goto out;
++#endif
++
+ default:
+ {
+ static int oid_hw_availpages;