aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emulators/qemu-devel/Makefile5
-rw-r--r--emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c11
-rw-r--r--emulators/qemu-devel/files/extra-patch-sysctl-0oldlen24
-rw-r--r--emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages53
4 files changed, 92 insertions, 1 deletions
diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile
index 4c7fe8ceda09..2d0cabd26445 100644
--- a/emulators/qemu-devel/Makefile
+++ b/emulators/qemu-devel/Makefile
@@ -3,7 +3,7 @@
PORTNAME= qemu
PORTVERSION= 1.7.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= emulators
MASTER_SITES= http://wiki.qemu.org/download/:release \
LOCAL/nox:snapshot
@@ -71,6 +71,9 @@ EXTRA_PATCHES+= ${FILESDIR}/extra-patch-05ee8495804599b52a88eb36b13ea9c06b3207cd
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-mips-target_arch_vmparam.h
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-inherit-interp_prefix
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-d62553b108aa27c0c020dbb771d29f8673807a3b
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-syscall.c
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-sysctl-hw-availpages
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-sysctl-0oldlen
.endif
CONFIGURE_ARGS+= --extra-ldflags=-L${LOCALBASE}/lib
diff --git a/emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c b/emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c
new file mode 100644
index 000000000000..3570ca234e35
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c
@@ -0,0 +1,11 @@
+--- a/bsd-user/syscall.c
++++ b/bsd-user/syscall.c
+@@ -627,7 +627,7 @@ abi_long do_freebsd_syscall(void *cpu_en
+ break;
+
+ case TARGET_FREEBSD_NR_fchflags: /* fchflags(2) */
+- ret = do_bsd_fchflags(arg2, arg2);
++ ret = do_bsd_fchflags(arg1, arg2);
+ break;
+
+ case TARGET_FREEBSD_NR_chroot: /* chroot(2) */
diff --git a/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen b/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen
new file mode 100644
index 000000000000..72a8d52d92d7
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen
@@ -0,0 +1,24 @@
+--- a/bsd-user/freebsd/os-sys.c
++++ b/bsd-user/freebsd/os-sys.c
+@@ -165,7 +165,9 @@ abi_long do_freebsd_sysctl(CPUArchState
+ switch (snamep[1]) {
+ case KERN_USRSTACK:
+ #if TARGET_USRSTACK != 0
+- (*(abi_ulong *)holdp) = tswapal(TARGET_USRSTACK);
++ if (oldlen) {
++ (*(abi_ulong *)holdp) = tswapal(TARGET_USRSTACK);
++ }
+ holdlen = sizeof(abi_ulong);
+ ret = 0;
+ #else
+@@ -175,7 +177,9 @@ abi_long do_freebsd_sysctl(CPUArchState
+
+ case KERN_PS_STRINGS:
+ #if defined(TARGET_PS_STRINGS)
+- (*(abi_ulong *)holdp) = tswapal(TARGET_PS_STRINGS);
++ if (oldlen) {
++ (*(abi_ulong *)holdp) = tswapal(TARGET_PS_STRINGS);
++ }
+ holdlen = sizeof(abi_ulong);
+ ret = 0;
+ #else
diff --git a/emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages b/emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages
new file mode 100644
index 000000000000..914f146961b4
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages
@@ -0,0 +1,53 @@
+--- a/bsd-user/freebsd/os-sys.c
++++ b/bsd-user/freebsd/os-sys.c
+@@ -219,24 +219,36 @@ abi_long do_freebsd_sysctl(CPUArchState
+ ret = 0;
+ goto out;
+
+- case 851: /* hw.availpages */
++ default:
+ {
+- long lvalue;
+- size_t len = sizeof(lvalue);
++ static int oid_hw_availpages;
++
++ if (!oid_hw_availpages) {
++ int real_oid[CTL_MAXNAME+2];
++ size_t len = sizeof(real_oid) / sizeof(int);
+
+- if (sysctlbyname("hw.availpages", &lvalue, &len, NULL, 0)
+- == -1) {
+- ret = -1;
+- } else {
+- (*(abi_ulong *)holdp) = tswapal((abi_ulong)lvalue);
+- holdlen = sizeof(abi_ulong);
+- ret = 0;
++ if (sysctlnametomib("hw.availpages", real_oid, &len) >= 0)
++ oid_hw_availpages = real_oid[1];
+ }
+- }
+- goto out;
+
+- default:
+- break;
++ if (oid_hw_availpages && snamep[1] == oid_hw_availpages) {
++ long lvalue;
++ size_t len = sizeof(lvalue);
++
++ if (sysctlbyname("hw.availpages", &lvalue, &len, NULL, 0)
++ == -1) {
++ ret = -1;
++ } else {
++ if (oldlen) {
++ (*(abi_ulong *)holdp) = tswapal((abi_ulong)lvalue);
++ }
++ holdlen = sizeof(abi_ulong);
++ ret = 0;
++ }
++ goto out;
++ }
++ break;
++ }
+ }
+ default:
+ break;