1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-11 07:22:22 +00:00

Four more bsd-user fixes, poudriere now builds more armv6 packages

and sparc64 dynamic exectuables get a little further:

- Fix crashes with long argv invocations. [1]
- Fix ARMv6 stack alignment in a new thread. [1]
- sparc64: sync ccr before changing carry flag.
- Writing to readonly page can cause trap 0xc on FreeBSD too.
- Bump PORTREVISION.

Submitted by:	sson [1]
This commit is contained in:
Juergen Lock 2014-07-06 16:11:28 +00:00
parent c962d2a962
commit b3f3b52f4a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=360935
5 changed files with 112 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= qemu
PORTVERSION= 2.0.0
PORTREVISION= 7
PORTREVISION= 8
CATEGORIES= emulators
MASTER_SITES= http://wiki.qemu.org/download/:release \
LOCAL/nox:snapshot
@ -72,6 +72,10 @@ EXTRA_PATCHES+= ${FILESDIR}/extra-patch-target_siginfo
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-arm-signal
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-getvfsbyname
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-kernproc
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-freebsd-target_os_stack.h
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-arm-target_arch_thread.h
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-sparc64-target_arch_cpu.h
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-trapsig
.endif
CONFIGURE_ARGS+= --extra-ldflags=-L${LOCALBASE}/lib

View File

@ -0,0 +1,15 @@
diff --git a/bsd-user/arm/target_arch_thread.h b/bsd-user/arm/target_arch_thread.h
index e69f612..ee4d67d 100644
--- a/bsd-user/arm/target_arch_thread.h
+++ b/bsd-user/arm/target_arch_thread.h
@@ -29,8 +29,8 @@ static inline void target_thread_set_upcall(CPUARMState *regs, abi_ulong entry,
* Make sure the stack is properly aligned.
* arm/include/param.h (STACKLIGN() macro)
*/
- sp = ((u_int)(stack_base + stack_size) & ~(8-1)) -
- sizeof(struct target_trapframe);
+ sp = (u_int)((stack_base + stack_size) -
+ sizeof(struct target_trapframe)) & ~0x7;
/* sp = stack base */
regs->regs[13] = sp;

View File

@ -0,0 +1,50 @@
diff --git a/bsd-user/freebsd/target_os_stack.h b/bsd-user/freebsd/target_os_stack.h
index c84b69e..73aea8f 100644
--- a/bsd-user/freebsd/target_os_stack.h
+++ b/bsd-user/freebsd/target_os_stack.h
@@ -1,3 +1,22 @@
+/*
+ * FreeBSD setup_initial_stack() implementation.
+ *
+ * Copyright (c) 2013-14 Stacey D. Son
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
#ifndef _TARGET_OS_STACK_H_
#define _TARGET_OS_STACK_H_
@@ -64,9 +83,7 @@ static inline int setup_initial_stack(struct bsd_binprm *bprm,
return -1;
}
/* Add page sizes array. */
- /* p -= sizeof(int); */
p -= sizeof(abi_ulong);
- /* if (put_user_u32(TARGET_PAGE_SIZE, p)) { */
if (put_user_ual(TARGET_PAGE_SIZE, p)) {
errno = EFAULT;
return -1;
@@ -85,9 +102,9 @@ static inline int setup_initial_stack(struct bsd_binprm *bprm,
}
/* Make room for the argv and envp strings */
- /* p = destp = roundup(p - TARGET_SPACE_USRSPACE - (TARGET_ARG_MAX - stringspace), sizeof(abi_ulong)); */
- argvp = p - TARGET_SPACE_USRSPACE;
- p = destp = roundup(p - TARGET_SPACE_USRSPACE - TARGET_ARG_MAX, sizeof(abi_ulong));
+ argvp = roundup(p - TARGET_SPACE_USRSPACE - (TARGET_ARG_MAX - stringspace),
+ sizeof(abi_ulong));
+ p = destp = p - TARGET_SPACE_USRSPACE - TARGET_ARG_MAX;
/*
* Add argv strings. Note that the argv[] vectors are added by

View File

@ -0,0 +1,20 @@
From nox Mon Sep 17 00:00:00 2001
From: Juergen Lock <nox@jelal.kn-bremen.de>
Date: 06 Jul 2014 13:23:00 +0200
Subject: sparc64-bsd-user: sync ccr before changing carry flag
Sync ccr so that changing carry flag manually after syscall works
properly.
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
--- a/bsd-user/sparc64/target_arch_cpu.h
+++ b/bsd-user/sparc64/target_arch_cpu.h
@@ -77,6 +77,7 @@ static inline void target_cpu_loop(CPUSP
env->regwptr[2], env->regwptr[3],
env->regwptr[4], env->regwptr[5]);
}
+ cpu_put_ccr(env, cpu_get_ccr(env));
if ((unsigned int)ret >= (unsigned int)(-515)) {
ret = -ret;
#if !defined(TARGET_ABI32)

View File

@ -0,0 +1,22 @@
From nox Mon Sep 17 00:00:00 2001
From: Juergen Lock <nox@jelal.kn-bremen.de>
Date: 06 Jul 2014 16:37:00 +0200
Subject: bsd-user: writing to readonly page can cause trap 0xc on FreeBSD too
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
--- a/user-exec.c
+++ b/user-exec.c
@@ -230,7 +230,12 @@ int cpu_signal_handler(int host_signum,
pc = PC_sig(uc);
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+ (TRAP_sig(uc) == 0xe ||
+ TRAP_sig(uc) == 0xc) ?
+#else
TRAP_sig(uc) == 0xe ?
+#endif
(ERROR_sig(uc) >> 1) & 1 : 0,
&MASK_sig(uc), puc);
}