1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-29 01:13:08 +00:00

- 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]
This commit is contained in:
Juergen Lock 2014-04-04 19:06:16 +00:00
parent 56281e8ae0
commit 473ff02652
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=350150
3 changed files with 99 additions and 0 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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;