Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Move to a flat space register convention. %sr[4-7] are all n...
details: https://anonhg.NetBSD.org/src/rev/4e867881e8cd
branches: trunk
changeset: 327394:4e867881e8cd
user: skrll <skrll%NetBSD.org@localhost>
date: Thu Mar 06 19:02:58 2014 +0000
description:
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
diffstat:
external/gpl3/gcc.old/dist/gcc/config.gcc | 2 +-
external/gpl3/gcc/dist/gcc/config.gcc | 2 +-
lib/libc/arch/hppa/SYS.h | 6 ++--
lib/libc/arch/hppa/sys/__sigtramp2.S | 6 ++--
lib/libc/arch/hppa/sys/__vfork14.S | 4 +-
sys/arch/hppa/hppa/machdep.c | 44 +++++++++++++++++++++---------
sys/arch/hppa/hppa/machdep.h | 5 ++-
sys/arch/hppa/hppa/trap.c | 6 ++--
sys/arch/hppa/hppa/vm_machdep.c | 25 +++++++----------
sys/arch/hppa/include/cpu.h | 4 +-
sys/arch/hppa/include/proc.h | 4 ++-
sys/sys/param.h | 4 +-
12 files changed, 65 insertions(+), 47 deletions(-)
diffs (truncated from 331 to 300 lines):
diff -r 01fc714e8e82 -r 4e867881e8cd external/gpl3/gcc.old/dist/gcc/config.gcc
--- a/external/gpl3/gcc.old/dist/gcc/config.gcc Thu Mar 06 17:48:09 2014 +0000
+++ b/external/gpl3/gcc.old/dist/gcc/config.gcc Thu Mar 06 19:02:58 2014 +0000
@@ -996,7 +996,7 @@
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"
diff -r 01fc714e8e82 -r 4e867881e8cd external/gpl3/gcc/dist/gcc/config.gcc
--- a/external/gpl3/gcc/dist/gcc/config.gcc Thu Mar 06 17:48:09 2014 +0000
+++ b/external/gpl3/gcc/dist/gcc/config.gcc Thu Mar 06 19:02:58 2014 +0000
@@ -1119,7 +1119,7 @@
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"
diff -r 01fc714e8e82 -r 4e867881e8cd lib/libc/arch/hppa/SYS.h
--- a/lib/libc/arch/hppa/SYS.h Thu Mar 06 17:48:09 2014 +0000
+++ b/lib/libc/arch/hppa/SYS.h Thu Mar 06 19:02:58 2014 +0000
@@ -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 @@
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) !\
diff -r 01fc714e8e82 -r 4e867881e8cd lib/libc/arch/hppa/sys/__sigtramp2.S
--- a/lib/libc/arch/hppa/sys/__sigtramp2.S Thu Mar 06 17:48:09 2014 +0000
+++ b/lib/libc/arch/hppa/sys/__sigtramp2.S Thu Mar 06 19:02:58 2014 +0000
@@ -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 @@
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)
diff -r 01fc714e8e82 -r 4e867881e8cd lib/libc/arch/hppa/sys/__vfork14.S
--- a/lib/libc/arch/hppa/sys/__vfork14.S Thu Mar 06 17:48:09 2014 +0000
+++ b/lib/libc/arch/hppa/sys/__vfork14.S Thu Mar 06 19:02:58 2014 +0000
@@ -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 @@
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
diff -r 01fc714e8e82 -r 4e867881e8cd sys/arch/hppa/hppa/machdep.c
--- a/sys/arch/hppa/hppa/machdep.c Thu Mar 06 17:48:09 2014 +0000
+++ b/sys/arch/hppa/hppa/machdep.c Thu Mar 06 19:02:58 2014 +0000
@@ -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 @@
}
}
+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 @@
{
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 @@
tf->tf_arg0 = p->p_psstrp;
tf->tf_arg1 = tf->tf_arg2 = 0; /* XXX dynload stuff */
- tf->tf_sr7 = HPPA_SID_KERNEL;
+ if (pack->ep_osversion < 699003600) {
+ p->p_md.md_flags |= MDP_OLDSPACE;
+ }
- /* 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;
-
- /* 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);
diff -r 01fc714e8e82 -r 4e867881e8cd sys/arch/hppa/hppa/machdep.h
--- a/sys/arch/hppa/hppa/machdep.h Thu Mar 06 17:48:09 2014 +0000
+++ b/sys/arch/hppa/hppa/machdep.h Thu Mar 06 19:02:58 2014 +0000
@@ -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_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 *);
diff -r 01fc714e8e82 -r 4e867881e8cd sys/arch/hppa/hppa/trap.c
--- a/sys/arch/hppa/hppa/trap.c Thu Mar 06 17:48:09 2014 +0000
+++ b/sys/arch/hppa/hppa/trap.c Thu Mar 06 19:02:58 2014 +0000
@@ -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 @@
* run reads as:
*
* ldil L%SYSCALLGATE, r1
- * ble 4(sr7, r1)
+ * ble 4(srX, r1)
* ldi __CONCAT(SYS_,x), t1
* comb,<> %r0, %t1, __cerror
*
diff -r 01fc714e8e82 -r 4e867881e8cd sys/arch/hppa/hppa/vm_machdep.c
--- a/sys/arch/hppa/hppa/vm_machdep.c Thu Mar 06 17:48:09 2014 +0000
+++ b/sys/arch/hppa/hppa/vm_machdep.c Thu Mar 06 19:02:58 2014 +0000
@@ -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 @@
}
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_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);
diff -r 01fc714e8e82 -r 4e867881e8cd sys/arch/hppa/include/cpu.h
--- a/sys/arch/hppa/include/cpu.h Thu Mar 06 17:48:09 2014 +0000
+++ b/sys/arch/hppa/include/cpu.h Thu Mar 06 19:02:58 2014 +0000
@@ -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 @@
* referenced in generic code
*/
-#define cpu_proc_fork(p1, p2)
+void cpu_proc_fork(struct proc *, struct proc *);
#ifdef MULTIPROCESSOR
diff -r 01fc714e8e82 -r 4e867881e8cd sys/arch/hppa/include/proc.h
--- a/sys/arch/hppa/include/proc.h Thu Mar 06 17:48:09 2014 +0000
+++ b/sys/arch/hppa/include/proc.h Thu Mar 06 19:02:58 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.11 2011/01/14 02:06:26 rmind Exp $ */
Home |
Main Index |
Thread Index |
Old Index