Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6-0]: src/sys/arch/sparc64/sparc64 Pull up following revision(s) ...
details: https://anonhg.NetBSD.org/src/rev/16b20c5219b0
branches: netbsd-6-0
changeset: 775101:16b20c5219b0
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sun Nov 15 21:01:52 2015 +0000
description:
Pull up following revision(s) (requested by martin in ticket #1343):
sys/arch/sparc64/sparc64/locore.s: revision 1.386
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106
Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c:
Remove special case handling for userland lwps from cpu_lwp_fork,
instead do it in lwp_trampoline when we first return to userland.
which was a stupid idea - since we did now set all fork child's %tstate
(and thus %pstate when back in userland) to the current kernel's userland
default. This meant we lost the address mask bit for 32bit processes and
all memory model details for 64bit ones.
Move it back to cpu_lwp_fork and fix the condition to only do it once when
forking init.
Fix kmem_free() size mismatch
Convert siginfo to 32bit version before copying it out to 32bit userland.
diffstat:
sys/arch/sparc64/sparc64/locore.s | 8 +-------
sys/arch/sparc64/sparc64/netbsd32_machdep.c | 14 +++++++++-----
sys/arch/sparc64/sparc64/vm_machdep.c | 12 ++++++++++--
3 files changed, 20 insertions(+), 14 deletions(-)
diffs (121 lines):
diff -r ce6560bd302c -r 16b20c5219b0 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Sun Nov 15 20:57:08 2015 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Sun Nov 15 21:01:52 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.338.8.2.4.1 2013/12/14 19:33:45 bouyer Exp $ */
+/* $NetBSD: locore.s,v 1.338.8.2.4.2 2015/11/15 21:01:52 bouyer Exp $ */
/*
* Copyright (c) 2006-2010 Matthew R. Green
@@ -5369,12 +5369,6 @@
mov %l1, %o0
/*
- * Going to userland - set proper tstate in trap frame
- */
- set (ASI_PRIMARY_NO_FAULT<<TSTATE_ASI_SHIFT)|((PSTATE_USER)<<TSTATE_PSTATE_SHIFT), %g1
- stx %g1, [%sp + CC64FSZ + STKB + TF_TSTATE]
-
- /*
* Here we finish up as in syscall, but simplified.
*/
ba,a,pt %icc, return_from_trap
diff -r ce6560bd302c -r 16b20c5219b0 sys/arch/sparc64/sparc64/netbsd32_machdep.c
--- a/sys/arch/sparc64/sparc64/netbsd32_machdep.c Sun Nov 15 20:57:08 2015 +0000
+++ b/sys/arch/sparc64/sparc64/netbsd32_machdep.c Sun Nov 15 21:01:52 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.96.2.1 2012/05/21 15:25:56 riz Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.96.2.1.4.1 2015/11/15 21:01:52 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.96.2.1 2012/05/21 15:25:56 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.96.2.1.4.1 2015/11/15 21:01:52 bouyer Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -322,6 +322,7 @@
int sig = ksi->ksi_signo;
ucontext32_t uc;
struct sparc32_sigframe_siginfo *fp;
+ siginfo32_t si32;
netbsd32_intptr_t catcher;
struct trapframe64 *tf = l->l_md.md_tf;
struct rwindow32 *oldsp, *newsp;
@@ -342,15 +343,16 @@
else
fp = (struct sparc32_sigframe_siginfo *)oldsp;
fp = (struct sparc32_sigframe_siginfo*)((u_long)(fp - 1) & ~7);
+
/*
* Build the signal context to be used by sigreturn.
*/
+ memset(&uc, 0, sizeof uc);
uc.uc_flags = _UC_SIGMASK |
((l->l_sigstk.ss_flags & SS_ONSTACK)
? _UC_SETSTACK : _UC_CLRSTACK);
uc.uc_sigmask = *mask;
uc.uc_link = (uint32_t)(uintptr_t)l->l_ctxlink;
- memset(&uc.uc_stack, 0, sizeof(uc.uc_stack));
sendsig_reset(l, sig);
@@ -365,9 +367,10 @@
*/
mutex_exit(p->p_lock);
cpu_getmcontext32(l, &uc.uc_mcontext, &uc.uc_flags);
+ netbsd32_si_to_si32(&si32, (const siginfo_t *)&ksi->ksi_info);
ucsz = (int)(intptr_t)&uc.__uc_pad - (int)(intptr_t)&uc;
newsp = (struct rwindow32*)((intptr_t)fp - sizeof(struct frame32));
- error = (copyout(&ksi->ksi_info, &fp->sf_si, sizeof ksi->ksi_info) ||
+ error = (copyout(&si32, &fp->sf_si, sizeof si32) ||
copyout(&uc, &fp->sf_uc, ucsz) ||
suword(&newsp->rw_in[6], (intptr_t)oldsp));
mutex_enter(p->p_lock);
@@ -1367,7 +1370,8 @@
error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
KASSERT(error == 0);
- kmem_free(uc, sizeof(ucontext32_t));
+ /* Note: we are freeing ucontext_t, not ucontext32_t. */
+ kmem_free(arg, sizeof(ucontext_t));
userret(l, 0, 0);
}
diff -r ce6560bd302c -r 16b20c5219b0 sys/arch/sparc64/sparc64/vm_machdep.c
--- a/sys/arch/sparc64/sparc64/vm_machdep.c Sun Nov 15 20:57:08 2015 +0000
+++ b/sys/arch/sparc64/sparc64/vm_machdep.c Sun Nov 15 21:01:52 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.98 2011/10/08 08:49:07 nakayama Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.98.12.1 2015/11/15 21:01:52 bouyer Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.98 2011/10/08 08:49:07 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.98.12.1 2015/11/15 21:01:52 bouyer Exp $");
#include "opt_multiprocessor.h"
@@ -263,6 +263,14 @@
tf2->tf_out[6] = (uint64_t)(u_long)stack + stacksize;
/*
+ * Need to create a %tstate if we are forking our first userland
+ * process - in all other cases we inherit from the parent.
+ */
+ if (l2->l_proc->p_pid == 1)
+ tf2->tf_tstate = (ASI_PRIMARY_NO_FAULT<<TSTATE_ASI_SHIFT) |
+ ((PSTATE_USER)<<TSTATE_PSTATE_SHIFT);
+
+ /*
* Set return values in child mode and clear condition code,
* in case we end up running a signal handler before returning
* to userland.
Home |
Main Index |
Thread Index |
Old Index