Module Name:    src
Committed By:   skrll
Date:           Thu Mar  6 19:02:58 UTC 2014

Modified Files:
        src/external/gpl3/gcc.old/dist/gcc: config.gcc
        src/external/gpl3/gcc/dist/gcc: config.gcc
        src/lib/libc/arch/hppa: SYS.h
        src/lib/libc/arch/hppa/sys: __sigtramp2.S __vfork14.S
        src/sys/arch/hppa/hppa: machdep.c machdep.h trap.c vm_machdep.c
        src/sys/arch/hppa/include: cpu.h proc.h
        src/sys/sys: param.h

Log Message:
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process.  gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc.old/dist/gcc/config.gcc
cvs rdiff -u -r1.21 -r1.22 src/external/gpl3/gcc/dist/gcc/config.gcc
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/hppa/SYS.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/hppa/sys/__sigtramp2.S
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/hppa/sys/__vfork14.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/hppa/machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/hppa/machdep.h
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/hppa/hppa/trap.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/hppa/hppa/vm_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/include/cpu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/include/proc.h
cvs rdiff -u -r1.444 -r1.445 src/sys/sys/param.h

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

Modified files:

Index: src/external/gpl3/gcc.old/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc.old/dist/gcc/config.gcc:1.1.1.1 src/external/gpl3/gcc.old/dist/gcc/config.gcc:1.2
--- src/external/gpl3/gcc.old/dist/gcc/config.gcc:1.1.1.1	Tue Feb 25 18:38:35 2014
+++ src/external/gpl3/gcc.old/dist/gcc/config.gcc	Thu Mar  6 19:02:58 2014
@@ -996,7 +996,7 @@ hppa*-*-linux*)
 	fi
 	;;
 hppa*-*-netbsd* | parisc*-*-netbsd*)
-	target_cpu_default="MASK_PA_11"
+	target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h netbsd.h netbsd-elf.h \
 		 pa/pa-netbsd.h pa/pa32-regs.h pa/pa32-netbsd.h"
 	tmake_file="${tmake_file} pa/t-netbsd"

Index: src/external/gpl3/gcc/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc/dist/gcc/config.gcc:1.21 src/external/gpl3/gcc/dist/gcc/config.gcc:1.22
--- src/external/gpl3/gcc/dist/gcc/config.gcc:1.21	Tue Mar  4 08:43:12 2014
+++ src/external/gpl3/gcc/dist/gcc/config.gcc	Thu Mar  6 19:02:58 2014
@@ -1119,7 +1119,7 @@ hppa*-*-openbsd*)
 	gnu_ld=yes
 	;;
 hppa*-*-netbsd* | parisc*-*-netbsd*)
-	target_cpu_default="MASK_PA_11"
+	target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
 	tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} \
 		 pa/pa-netbsd.h pa/pa32-regs.h pa/pa32-netbsd.h"
 	tmake_file="${tmake_file} pa/t-netbsd"

Index: src/lib/libc/arch/hppa/SYS.h
diff -u src/lib/libc/arch/hppa/SYS.h:1.8 src/lib/libc/arch/hppa/SYS.h:1.9
--- src/lib/libc/arch/hppa/SYS.h:1.8	Sat Aug 24 07:12:12 2013
+++ src/lib/libc/arch/hppa/SYS.h	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: SYS.h,v 1.8 2013/08/24 07:12:12 skrll Exp $	*/
+/*	$NetBSD: SYS.h,v 1.9 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*	$OpenBSD: SYS.h,v 1.9 2001/09/20 20:52:09 millert Exp $	*/
 
@@ -40,7 +40,7 @@
 #define	SYSCALL(x)				!\
 	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
 	ldil	L%SYSCALLGATE, %r1		!\
-	ble	4(%sr7, %r1)			!\
+	ble	4(%sr2, %r1)			!\
 	ldi	__CONCAT(SYS_,x), %t1		!\
 	.import __cerror, code			!\
 	comb,<>	%r0, %t1, __cerror		!\
@@ -57,7 +57,7 @@ SYSEXIT(x)
 SYSENTRY(x)					!\
 	stw	%rp, HPPA_FRAME_ERP(%sr0,%sp)	!\
 	ldil	L%SYSCALLGATE, %r1		!\
-	ble	4(%sr7, %r1)			!\
+	ble	4(%sr2, %r1)			!\
 	ldi	__CONCAT(SYS_,y), %t1		!\
 	ldw	HPPA_FRAME_ERP(%sr0,%sp), %rp	!\
 	bv	%r0(%rp)			!\

Index: src/lib/libc/arch/hppa/sys/__sigtramp2.S
diff -u src/lib/libc/arch/hppa/sys/__sigtramp2.S:1.4 src/lib/libc/arch/hppa/sys/__sigtramp2.S:1.5
--- src/lib/libc/arch/hppa/sys/__sigtramp2.S:1.4	Tue Nov  3 05:07:25 2009
+++ src/lib/libc/arch/hppa/sys/__sigtramp2.S	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: __sigtramp2.S,v 1.4 2009/11/03 05:07:25 snj Exp $	*/
+/*	$NetBSD: __sigtramp2.S,v 1.5 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998-2001 Michael Shalayeff
@@ -121,13 +121,13 @@ L$sigcode_bounce:
 	copy	%r3, %arg0
 	ldil	L%SYSCALLGATE, %r1
 	.call
-	ble	4(%sr7, %r1)
+	ble	4(%sr2, %r1)
 	ldi	SYS_setcontext, %t1
 
 	/* Make a SYS_exit system call. */
 	copy	%ret0, %arg0
 	ldil	L%SYSCALLGATE, %r1
 	.call
-	ble	4(%sr7, %r1)
+	ble	4(%sr2, %r1)
 	ldi	SYS_exit, %t1
 EXIT(__sigtramp_siginfo_2)

Index: src/lib/libc/arch/hppa/sys/__vfork14.S
diff -u src/lib/libc/arch/hppa/sys/__vfork14.S:1.5 src/lib/libc/arch/hppa/sys/__vfork14.S:1.6
--- src/lib/libc/arch/hppa/sys/__vfork14.S:1.5	Mon Apr 28 20:22:56 2008
+++ src/lib/libc/arch/hppa/sys/__vfork14.S	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: __vfork14.S,v 1.5 2008/04/28 20:22:56 martin Exp $	*/
+/*	$NetBSD: __vfork14.S,v 1.6 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@ ENTRY(__vfork14, 0)
 
 	copy	%rp, %t4
 	ldil	L%SYSCALLGATE, %r1
-	ble	4(%sr7, %r1)
+	ble	4(%sr2, %r1)
 	ldi	SYS___vfork14, %t1
 	comb,<>	%r0, %t1, __cerror
 	copy	%t4, %rp

Index: src/sys/arch/hppa/hppa/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.1 src/sys/arch/hppa/hppa/machdep.c:1.2
--- src/sys/arch/hppa/hppa/machdep.c:1.1	Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/hppa/machdep.c	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.1 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.2 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2014/02/24 07:23:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2014/03/06 19:02:58 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -1862,6 +1862,31 @@ dumpsys(void)
 	}
 }
 
+void
+hppa_setvmspace(struct lwp *l)
+{
+	struct proc *p = l->l_proc;
+	struct trapframe *tf = l->l_md.md_regs;
+	pmap_t pmap = p->p_vmspace->vm_map.pmap;
+	pa_space_t space = pmap->pm_space;
+
+    	if (p->p_md.md_flags & MDP_OLDSPACE) {
+		tf->tf_sr7 = HPPA_SID_KERNEL;
+	} else {
+		tf->tf_sr7 = space;
+	}
+
+	tf->tf_sr2 = HPPA_SID_KERNEL;
+
+	/* Load all of the user's space registers. */
+	tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr3 =
+	tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 =
+	tf->tf_iisq_head = tf->tf_iisq_tail = space;
+
+	/* Load the protection regsiters. */
+	tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid;
+}
+
 /*
  * Set registers on exec.
  */
@@ -1870,8 +1895,6 @@ setregs(struct lwp *l, struct exec_packa
 {
 	struct proc *p = l->l_proc;
 	struct trapframe *tf = l->l_md.md_regs;
-	pmap_t pmap = p->p_vmspace->vm_map.pmap;
-	pa_space_t space = pmap->pm_space;
 	struct pcb *pcb = lwp_getpcb(l);
 
 	tf->tf_flags = TFF_SYS|TFF_LAST;
@@ -1881,16 +1904,11 @@ setregs(struct lwp *l, struct exec_packa
 	tf->tf_arg0 = p->p_psstrp;
 	tf->tf_arg1 = tf->tf_arg2 = 0; /* XXX dynload stuff */
 
-	tf->tf_sr7 = HPPA_SID_KERNEL;
-
-	/* Load all of the user's space registers. */
-	tf->tf_sr0 = tf->tf_sr1 = tf->tf_sr2 = tf->tf_sr3 =
-	tf->tf_sr4 = tf->tf_sr5 = tf->tf_sr6 = space;
-
-	tf->tf_iisq_head = tf->tf_iisq_tail = space;
+	if (pack->ep_osversion < 699003600) {
+		p->p_md.md_flags |= MDP_OLDSPACE;
+	}
 
-	/* Load the protection regsiters. */
-	tf->tf_pidr1 = tf->tf_pidr2 = pmap->pm_pid;
+	hppa_setvmspace(l);
 
 	/* reset any of the pending FPU exceptions */
 	hppa_fpu_flush(l);

Index: src/sys/arch/hppa/hppa/machdep.h
diff -u src/sys/arch/hppa/hppa/machdep.h:1.16 src/sys/arch/hppa/hppa/machdep.h:1.17
--- src/sys/arch/hppa/hppa/machdep.h:1.16	Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/hppa/machdep.h	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.h,v 1.16 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: machdep.h,v 1.17 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -81,6 +81,9 @@ void hppa_fpu_bootstrap(u_int);
 void hppa_fpu_flush(struct lwp *);
 void hppa_fpu_emulate(struct trapframe *, struct lwp *, u_int);
 
+/* Set up of space registers and protection IDs */
+void hppa_setvmspace(struct lwp *);
+
 /* Interrupt dispatching. */
 void hppa_intr(struct trapframe *);
 

Index: src/sys/arch/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.105 src/sys/arch/hppa/hppa/trap.c:1.106
--- src/sys/arch/hppa/hppa/trap.c:1.105	Thu Feb 13 15:04:18 2014
+++ src/sys/arch/hppa/hppa/trap.c	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.105 2014/02/13 15:04:18 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.106 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.105 2014/02/13 15:04:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.106 2014/03/06 19:02:58 skrll Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -1236,7 +1236,7 @@ syscall(struct trapframe *frame, int *ar
 		 * run reads as:
 		 *
 		 *	ldil	L%SYSCALLGATE, r1
-		 *	ble	4(sr7, r1)
+		 *	ble	4(srX, r1)
 		 *	ldi	__CONCAT(SYS_,x), t1
 		 *	comb,<>	%r0, %t1, __cerror
 		 *

Index: src/sys/arch/hppa/hppa/vm_machdep.c
diff -u src/sys/arch/hppa/hppa/vm_machdep.c:1.53 src/sys/arch/hppa/hppa/vm_machdep.c:1.54
--- src/sys/arch/hppa/hppa/vm_machdep.c:1.53	Thu Feb 13 11:08:46 2014
+++ src/sys/arch/hppa/hppa/vm_machdep.c	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.53 2014/02/13 11:08:46 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.54 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*	$OpenBSD: vm_machdep.c,v 1.64 2008/09/30 18:54:26 miod Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.53 2014/02/13 11:08:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.54 2014/03/06 19:02:58 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -78,6 +78,13 @@ cpu_activate_pcb(struct lwp *l)
 }
 
 void
+cpu_proc_fork(struct proc *p1, struct proc *p2)
+{
+
+	p2->p_md.md_flags = p1->p_md.md_flags;
+}
+
+void
 cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
     void (*func)(void *), void *arg)
 {
@@ -126,23 +133,11 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	cpu_activate_pcb(l2);
 
 	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;
-
+		hppa_setvmspace(l2);
 		/*
 		 * 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);

Index: src/sys/arch/hppa/include/cpu.h
diff -u src/sys/arch/hppa/include/cpu.h:1.1 src/sys/arch/hppa/include/cpu.h:1.2
--- src/sys/arch/hppa/include/cpu.h:1.1	Mon Feb 24 07:23:43 2014
+++ src/sys/arch/hppa/include/cpu.h	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.1 2014/02/24 07:23:43 skrll Exp $	*/
+/*	$NetBSD: cpu.h,v 1.2 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*	$OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $	*/
 
@@ -313,7 +313,7 @@ struct cpu_info {
  * referenced in generic code
  */
 
-#define	cpu_proc_fork(p1, p2)
+void	cpu_proc_fork(struct proc *, struct proc *);
 
 #ifdef MULTIPROCESSOR
 

Index: src/sys/arch/hppa/include/proc.h
diff -u src/sys/arch/hppa/include/proc.h:1.11 src/sys/arch/hppa/include/proc.h:1.12
--- src/sys/arch/hppa/include/proc.h:1.11	Fri Jan 14 02:06:26 2011
+++ src/sys/arch/hppa/include/proc.h	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.11 2011/01/14 02:06:26 rmind Exp $	*/
+/*	$NetBSD: proc.h,v 1.12 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*	$OpenBSD: proc.h,v 1.4 2009/12/29 13:11:40 jsing Exp $ */
 
@@ -49,6 +49,8 @@ struct mdlwp {
 };
 
 struct mdproc {
+	int		md_flags;		/* machine-dependent flags */
+#define MDP_OLDSPACE	0x0001
 };
 
 /* md_flags */

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.444 src/sys/sys/param.h:1.445
--- src/sys/sys/param.h:1.444	Thu Mar  6 09:31:19 2014
+++ src/sys/sys/param.h	Thu Mar  6 19:02:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.444 2014/03/06 09:31:19 matt Exp $	*/
+/*	$NetBSD: param.h,v 1.445 2014/03/06 19:02:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	699003500	/* NetBSD 6.99.35 */
+#define	__NetBSD_Version__	699003600	/* NetBSD 6.99.36 */
 
 #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
     (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)

Reply via email to