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
This commit is contained in:
skrll 2014-03-06 19:02:58 +00:00
parent af22d9d39f
commit 1b5cff8f1d
12 changed files with 65 additions and 47 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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) !\

View File

@ -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)

View File

@ -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

View File

@ -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_package *pack, vaddr_t stack)
{
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_package *pack, vaddr_t stack)
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);

View File

@ -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 *);

View File

@ -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 *args)
* run reads as:
*
* ldil L%SYSCALLGATE, r1
* ble 4(sr7, r1)
* ble 4(srX, r1)
* ldi __CONCAT(SYS_,x), t1
* comb,<> %r0, %t1, __cerror
*

View File

@ -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>
@ -77,6 +77,13 @@ cpu_activate_pcb(struct lwp *l)
#endif
}
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 *l2, void *stack, size_t stacksize,
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);

View File

@ -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

View File

@ -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 */

View File

@ -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__)