aboutsummaryrefslogtreecommitdiffstats
path: root/emulators
diff options
context:
space:
mode:
authornox <nox@FreeBSD.org>2014-04-05 03:06:16 +0800
committernox <nox@FreeBSD.org>2014-04-05 03:06:16 +0800
commit9bb326f3e03a3ff8315e88d9b531dc5d4ffbcb1d (patch)
tree81cacda76c631dc3f3ed81e9ccb155f0d9df5616 /emulators
parentaff54e7ba53a58f12cd978dc9689b51ff8ccdc9f (diff)
downloadfreebsd-ports-gnome-9bb326f3e03a3ff8315e88d9b531dc5d4ffbcb1d.tar.gz
freebsd-ports-gnome-9bb326f3e03a3ff8315e88d9b531dc5d4ffbcb1d.tar.zst
freebsd-ports-gnome-9bb326f3e03a3ff8315e88d9b531dc5d4ffbcb1d.zip
- Add two bvd-user fixes:
- Lower 32bit mips TARGET_USRSTACK to fix an assert starting mips processes on 64bit hosts. (like amd64) [1] - Pass down interp_prefix (-L arg) to target subprocesses so running shared target binaries as subprocesses works. - Bump PORTREVISION. Reported by: sbruno [1]
Diffstat (limited to 'emulators')
-rw-r--r--emulators/qemu-devel/Makefile3
-rw-r--r--emulators/qemu-devel/files/extra-patch-bsd-user-mips-target_arch_vmparam.h12
-rw-r--r--emulators/qemu-devel/files/extra-patch-inherit-interp_prefix84
3 files changed, 99 insertions, 0 deletions
diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile
index 1cdb17d51648..2b256079b6ce 100644
--- a/emulators/qemu-devel/Makefile
+++ b/emulators/qemu-devel/Makefile
@@ -3,6 +3,7 @@
PORTNAME= qemu
PORTVERSION= 1.7.1
+PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= http://wiki.qemu.org/download/:release \
LOCAL/nox:snapshot
@@ -67,6 +68,8 @@ PATCHFILES= \
PATCH_DIST_STRIP= -p1
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-freebsd-os-proc.c
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
.endif
CONFIGURE_ARGS+= --extra-ldflags=-L${LOCALBASE}/lib
diff --git a/emulators/qemu-devel/files/extra-patch-bsd-user-mips-target_arch_vmparam.h b/emulators/qemu-devel/files/extra-patch-bsd-user-mips-target_arch_vmparam.h
new file mode 100644
index 000000000000..f022cbb696c2
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-bsd-user-mips-target_arch_vmparam.h
@@ -0,0 +1,12 @@
+--- a/bsd-user/mips/target_arch_vmparam.h
++++ b/bsd-user/mips/target_arch_vmparam.h
+@@ -35,7 +35,8 @@
+ #define TARGET_VM_MINUSER_ADDRESS (0x00000000)
+ #define TARGET_VM_MAXUSER_ADDRESS (0x80000000)
+
+-#define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE)
++// #define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE)
++#define TARGET_USRSTACK (TARGET_RESERVED_VA - TARGET_PAGE_SIZE * 0x10)
+
+ static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
+ {
diff --git a/emulators/qemu-devel/files/extra-patch-inherit-interp_prefix b/emulators/qemu-devel/files/extra-patch-inherit-interp_prefix
new file mode 100644
index 000000000000..6cfb157353a1
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-inherit-interp_prefix
@@ -0,0 +1,84 @@
+--- a/bsd-user/main.c
++++ b/bsd-user/main.c
+@@ -58,7 +58,7 @@ unsigned long reserved_va;
+ #endif
+ #endif /* CONFIG_USE_GUEST_BASE */
+
+-static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX;
++const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX;
+ const char *qemu_uname_release = CONFIG_UNAME_RELEASE;
+ extern char **environ;
+ enum BSDType bsd_type;
+--- a/bsd-user/qemu.h
++++ b/bsd-user/qemu.h
+@@ -110,6 +110,7 @@ typedef struct TaskState {
+
+ void init_task_state(TaskState *ts);
+ void stop_all_tasks(void);
++extern const char *interp_prefix;
+ extern const char *qemu_uname_release;
+ #if defined(CONFIG_USE_GUEST_BASE)
+ extern unsigned long mmap_min_addr;
+--- a/bsd-user/freebsd/os-proc.c
++++ b/bsd-user/freebsd/os-proc.c
+@@ -180,7 +180,7 @@ abi_long freebsd_exec_common(abi_ulong p
+ envc++;
+ }
+
+- qarg0 = argp = alloca((argc + 5) * sizeof(void *));
++ qarg0 = argp = alloca((argc + 7) * sizeof(void *));
+ /* save the first agrument for the emulator */
+ *argp++ = (char *)getprogname();
+ qargp = argp;
+@@ -246,6 +246,11 @@ abi_long freebsd_exec_common(abi_ulong p
+ if (get_filename_from_fd(getpid(), (int)path_or_fd, execpath,
+ sizeof(execpath)) != NULL) {
+ *qarg1 = execpath;
++#ifndef DONT_INHERIT_INTERP_PREFIX
++ memmove(qarg1 + 2, qarg1, (qargend-qarg1) * sizeof(*qarg1));
++ *qarg1++ = (char *)"-L";
++ *qarg1++ = (char *)interp_prefix;
++#endif
+ ret = get_errno(execve(qemu_proc_pathname, qargp, envp));
+ } else {
+ /* Getting the filename path failed. */
+@@ -261,6 +266,13 @@ abi_long freebsd_exec_common(abi_ulong p
+ sizeof(scriptpath)) != NULL) {
+ *qargp = execpath;
+ *qarg1 = scriptpath;
++#ifndef DONT_INHERIT_INTERP_PREFIX
++ memmove(qargp + 2, qargp, (qargend-qargp) * sizeof(*qargp));
++ qargp[0] = (char *)"-L";
++ qargp[1] = (char *)interp_prefix;
++ qarg1 += 2;
++ qargend += 2;
++#endif
+ if (scriptargs) {
+ memmove(qarg1 + 1, qarg1, (qargend-qarg1) * sizeof(*qarg1));
+ *qarg1 = scriptargs;
+@@ -292,6 +304,11 @@ abi_long freebsd_exec_common(abi_ulong p
+ close(fd);
+ /* execve() as a target binary using emulator. */
+ *qarg1 = (char *)p;
++#ifndef DONT_INHERIT_INTERP_PREFIX
++ memmove(qarg1 + 2, qarg1, (qargend-qarg1) * sizeof(*qarg1));
++ *qarg1++ = (char *)"-L";
++ *qarg1++ = (char *)interp_prefix;
++#endif
+ ret = get_errno(execve(qemu_proc_pathname, qargp, envp));
+ } else if (is_target_shell_script(fd, execpath,
+ sizeof(execpath), &scriptargs) != 0) {
+@@ -299,6 +316,13 @@ abi_long freebsd_exec_common(abi_ulong p
+ /* execve() as a target script using emulator. */
+ *qargp = execpath;
+ *qarg1 = (char *)p;
++#ifndef DONT_INHERIT_INTERP_PREFIX
++ memmove(qargp + 2, qargp, (qargend-qargp) * sizeof(*qargp));
++ qargp[0] = (char *)"-L";
++ qargp[1] = (char *)interp_prefix;
++ qarg1 += 2;
++ qargend += 2;
++#endif
+ if (scriptargs) {
+ memmove(qarg1 + 1, qarg1, (qargend-qarg1) * sizeof(*qarg1));
+ *qarg1 = scriptargs;