CVS commit: [netbsd-6] src/sys/arch/hppa/hppa

2012-03-02 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Mar  2 16:29:29 UTC 2012

Modified Files:
src/sys/arch/hppa/hppa [netbsd-6]: pmap.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #62):
sys/arch/hppa/hppa/pmap.c: revision 1.98
Fix PMAPDEBUG build


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/hppa/hppa/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hppa/hppa/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.97 src/sys/arch/hppa/hppa/pmap.c:1.97.2.1
--- src/sys/arch/hppa/hppa/pmap.c:1.97	Fri Jan  6 20:55:28 2012
+++ src/sys/arch/hppa/hppa/pmap.c	Fri Mar  2 16:29:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.97 2012/01/06 20:55:28 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.97.2.1 2012/03/02 16:29:29 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.97 2012/01/06 20:55:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.97.2.1 2012/03/02 16:29:29 riz Exp $");
 
 #include "opt_cputype.h"
 
@@ -1792,7 +1792,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 		if (!pve)
 			panic("%s: no pv entries available", __func__);
 		DPRINTF(PDB_FOLLOW|PDB_ENTER, ("%s(%lx, %lx, %x) TLB_KENTER\n",
-		_func__, va, pa, pte));
+		__func__, va, pa, pte));
 
 		if (pmap_check_alias(pg, va, pte))
 			pmap_page_remove(pg);



CVS commit: [netbsd-6] src/sys/arch/hppa/hppa

2012-03-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Mar 17 17:33:08 UTC 2012

Modified Files:
src/sys/arch/hppa/hppa [netbsd-6]: trap.c vm_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #114):
sys/arch/hppa/hppa/trap.c: revision 1.99
sys/arch/hppa/hppa/vm_machdep.c: revision 1.51
sys/arch/hppa/hppa/vm_machdep.c: revision 1.52
Deal with setting of space registers and protection ids for posix_spawn.
Thanks to martin for the help.
Remove WIP code.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.97.2.1 src/sys/arch/hppa/hppa/trap.c
cvs rdiff -u -r1.49 -r1.49.10.1 src/sys/arch/hppa/hppa/vm_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.97 src/sys/arch/hppa/hppa/trap.c:1.97.2.1
--- src/sys/arch/hppa/hppa/trap.c:1.97	Mon Feb 13 01:07:37 2012
+++ src/sys/arch/hppa/hppa/trap.c	Sat Mar 17 17:33:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.97 2012/02/13 01:07:37 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.97.2.1 2012/03/17 17:33:08 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97 2012/02/13 01:07:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97.2.1 2012/03/17 17:33:08 bouyer Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -1009,7 +1009,28 @@ child_return(void *arg)
 void
 cpu_spawn_return(struct lwp *l)
 {
-  	
+	struct proc *p = l->l_proc;
+	pmap_t pmap = p->p_vmspace->vm_map.pmap;
+	pa_space_t space = pmap->pm_space;
+	struct trapframe *tf = l->l_md.md_regs;
+
+	/* Load all of the user's space registers. */
+	tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 = tf->tf_sr2 =
+	tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space;
+	tf->tf_iisq_head = tf->tf_iisq_tail = space;
+
+	/* Load the protection registers */
+	tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid;
+
+	/*
+	 * theoretically these could be inherited from the father,
+	 * but just in case.
+	 */
+	tf->tf_sr7 = HPPA_SID_KERNEL;
+	mfctl(CR_EIEM, tf->tf_eiem);
+	tf->tf_ipsw = PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I /* | PSW_L */ |
+	(curcpu()->ci_psw & PSW_O);
+
 	userret(l, l->l_md.md_regs->tf_iioq_head, 0);
 #ifdef DEBUG
 	frame_sanity_check(__func__, __LINE__, 0, l->l_md.md_regs, l);

Index: src/sys/arch/hppa/hppa/vm_machdep.c
diff -u src/sys/arch/hppa/hppa/vm_machdep.c:1.49 src/sys/arch/hppa/hppa/vm_machdep.c:1.49.10.1
--- src/sys/arch/hppa/hppa/vm_machdep.c:1.49	Thu Feb 24 04:28:45 2011
+++ src/sys/arch/hppa/hppa/vm_machdep.c	Sat Mar 17 17:33:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.49 2011/02/24 04:28:45 joerg Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.49.10.1 2012/03/17 17:33:08 bouyer Exp $	*/
 
 /*	$OpenBSD: vm_machdep.c,v 1.64 2008/09/30 18:54:26 miod Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.49 2011/02/24 04:28:45 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.49.10.1 2012/03/17 17:33:08 bouyer Exp $");
 
 #include 
 #include 
@@ -81,9 +81,6 @@ void
 cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
 void (*func)(void *), void *arg)
 {
-	struct proc *p = l2->l_proc;
-	pmap_t pmap = p->p_vmspace->vm_map.pmap;
-	pa_space_t space = pmap->pm_space;
 	struct pcb *pcb1, *pcb2;
 	struct trapframe *tf;
 	register_t sp, osp;
@@ -128,22 +125,28 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	/* Fill out all the PAs we are going to need in locore. */
 	cpu_activate_pcb(l2);
 
-	/* Load all of the user's space registers. */
-	tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 = tf->tf_sr2 = 
-	tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space;
-	tf->tf_iisq_head = tf->tf_iisq_tail = space;
-
-	/* Load the protection registers */
-	tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid;
-
-	/*
-	 * theoretically these could be inherited from the father,
-	 * but just in case.
-	 */
-	tf->tf_sr7 = HPPA_SID_KERNEL;
-	mfctl(CR_EIEM, tf->tf_eiem);
-	tf->tf_ipsw = PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I /* | PSW_L */ |
-	(curcpu()->ci_psw & PSW_O);
+	if (__predict_true(l2->l_proc->p_vmspace != NULL)) {
+		struct proc *p = l2->l_proc;
+		pmap_t pmap = p->p_vmspace->vm_map.pmap;
+		pa_space_t space = pmap->pm_space;
+
+		/* Load all of the user's space registers. */
+		tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 = tf->tf_sr2 = 
+		tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space;
+		tf->tf_iisq_head = tf->tf_iisq_tail = space;
+
+		/* Load the protection registers */
+		tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid;
+
+		/*
+		 * theoretically these could be inherited from the father,
+		 * but just in case.
+		 */
+		tf->tf_sr7 = HPPA_SID_KERNEL;
+		mfctl(CR_EIEM, tf->tf_eiem);
+		tf->tf_ipsw = PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I /* | PSW_L */ |
+		(curcpu()->ci_psw & PSW_O);
+	}
 
 	/*
 	 * Set up return value registers as libc:

CVS commit: [netbsd-6] src/sys/arch/hppa/hppa

2012-04-23 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Apr 23 16:51:52 UTC 2012

Modified Files:
src/sys/arch/hppa/hppa [netbsd-6]: trap.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #196):
sys/arch/hppa/hppa/trap.c: revision 1.101
Pass the trap address in ksi_addr without privilege bits.
Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


To generate a diff of this commit:
cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/sys/arch/hppa/hppa/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.97.2.1 src/sys/arch/hppa/hppa/trap.c:1.97.2.2
--- src/sys/arch/hppa/hppa/trap.c:1.97.2.1	Sat Mar 17 17:33:08 2012
+++ src/sys/arch/hppa/hppa/trap.c	Mon Apr 23 16:51:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.97.2.1 2012/03/17 17:33:08 bouyer Exp $	*/
+/*	$NetBSD: trap.c,v 1.97.2.2 2012/04/23 16:51:51 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97.2.1 2012/03/17 17:33:08 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97.2.2 2012/04/23 16:51:51 riz Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -702,7 +702,7 @@ do_onfault:
 		ksi.ksi_signo = SIGTRAP;
 		ksi.ksi_code = TRAP_TRACE;
 		ksi.ksi_trap = trapnum;
-		ksi.ksi_addr = (void *)frame->tf_iioq_head;
+		ksi.ksi_addr = (void *)(frame->tf_iioq_head & ~HPPA_PC_PRIV_MASK);
 #ifdef PTRACE
 		ss_clear_breakpoints(l);
 		if (opcode == SSBREAKPOINT)
@@ -710,7 +710,6 @@ do_onfault:
 #endif
 		/* pass to user debugger */
 		trapsignal(l, &ksi);
- 
 		break;
 
 #ifdef PTRACE
@@ -721,7 +720,7 @@ do_onfault:
 		ksi.ksi_signo = SIGTRAP;
 		ksi.ksi_code = TRAP_TRACE;
 		ksi.ksi_trap = trapnum;
-		ksi.ksi_addr = (void *)frame->tf_iioq_head;
+		ksi.ksi_addr = (void *)(frame->tf_iioq_head & ~HPPA_PC_PRIV_MASK);
 
 /* pass to user debugger */
 		trapsignal(l, &ksi);