PCB convergence, part the first:

Move the pointer to the current user trapframe from struct mdproc to struct
pcb (as on arm26).  Only tested by compiling kernels on arm32 and
hpcarm (dnard seems to be incomplete anyway).  Someone should try running one.
This commit is contained in:
bjh21 2001-02-28 18:15:42 +00:00
parent 9c42e9ee42
commit c25aec3d9f
20 changed files with 55 additions and 58 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.5 2001/02/27 17:57:55 bjh21 Exp $ */
/* $NetBSD: process_machdep.c,v 1.6 2001/02/28 18:15:42 bjh21 Exp $ */
/*
* Copyright (c) 1995 Frank Lancaster. All rights reserved.
@ -71,7 +71,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.5 2001/02/27 17:57:55 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.6 2001/02/28 18:15:42 bjh21 Exp $");
#include <sys/proc.h>
#include <sys/ptrace.h>
@ -92,11 +92,7 @@ static __inline struct trapframe *
process_frame(struct proc *p)
{
#ifdef arm26
return p->p_addr->u_pcb.pcb_tf;
#else /* arm32 */
return (p->p_md.md_regs);
#endif
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: sig_machdep.c,v 1.3 2001/02/27 17:42:16 bjh21 Exp $ */
/* $NetBSD: sig_machdep.c,v 1.4 2001/02/28 18:15:43 bjh21 Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -45,7 +45,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.3 2001/02/27 17:42:16 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.4 2001/02/28 18:15:43 bjh21 Exp $");
#include <sys/mount.h> /* XXX only needed by syscallargs.h */
#include <sys/proc.h>
@ -67,11 +67,7 @@ static __inline struct trapframe *
process_frame(struct proc *p)
{
#ifdef arm26
return p->p_addr->u_pcb.pcb_tf;
#else /* arm32 */
return (p->p_md.md_regs);
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcb.h,v 1.1 2001/02/23 21:23:49 reinoud Exp $ */
/* $NetBSD: pcb.h,v 1.2 2001/02/28 18:15:43 bjh21 Exp $ */
/*
* Copyright (c) 1994 Mark Brinicombe.
@ -38,6 +38,8 @@
#include <machine/pte.h>
#include <machine/fp.h>
struct trapframe;
struct pcb {
pd_entry_t *pcb_pagedir; /* PT hooks */
u_int pcb_flags; /* Flags */
@ -61,6 +63,7 @@ struct pcb {
u_int pcb_und_sp;
caddr_t pcb_onfault; /* On fault handler */
struct fpe_sp_state pcb_fpstate; /* Floating Point state */
struct trapframe *pcb_tf;
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.8 2001/02/28 00:17:18 bjh21 Exp $ */
/* $NetBSD: cpu.h,v 1.9 2001/02/28 18:15:43 bjh21 Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -104,7 +104,9 @@
#ifndef _LOCORE
#include <sys/user.h>
#include <machine/frame.h>
#include <machine/pcb.h>
#endif /* !_LOCORE */
#ifdef arm26
@ -162,7 +164,7 @@ extern int astpending;
/* Hack to treat FPE time as interrupt time so we can measure it */
#define CLKF_INTR(frame) ((current_intr_depth > 1) || (frame->if_spsr & PSR_MODE) == PSR_UND32_MODE)
#define PROC_PC(p) ((p)->p_md.md_regs->tf_pc)
#define PROC_PC(p) ((p)->p_addr->u_pcb.pcb_tf->tf_pc)
#elif defined(PROG26)

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.1 2001/02/23 21:23:48 reinoud Exp $ */
/* $NetBSD: proc.h,v 1.2 2001/02/28 18:15:43 bjh21 Exp $ */
/*
* Copyright (c) 1994 Mark Brinicombe.
@ -39,7 +39,7 @@
* Machine-dependent part of the proc structure for arm.
*/
struct mdproc {
struct trapframe *md_regs; /* registers on current frame */
int __spare;
struct trapframe *__spare0;
int __spare1;
};
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_13_machdep.c,v 1.2 2000/12/22 22:58:53 jdolecek Exp $ */
/* $NetBSD: compat_13_machdep.c,v 1.3 2001/02/28 18:15:43 bjh21 Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -73,7 +73,7 @@ compat_13_sys_sigreturn(p, v, retval)
return (EINVAL);
/* Restore register context. */
tf = p->p_md.md_regs;
tf = p->p_addr->u_pcb.pcb_tf;
tf->tf_r0 = context.sc_r0;
tf->tf_r1 = context.sc_r1;
tf->tf_r2 = context.sc_r2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fault.c,v 1.49 2001/01/12 13:43:13 bjh21 Exp $ */
/* $NetBSD: fault.c,v 1.50 2001/02/28 18:15:43 bjh21 Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@ -241,7 +241,7 @@ copyfault:
* Note that the fault was from USR mode.
*/
user = 1;
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
} else
user = 0;
@ -538,7 +538,7 @@ prefetch_abort_handler(frame)
/* Was the prefectch abort from USR32 mode ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
} else {
/*
* All the kernel code pages are loaded at boot time

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.6 2001/01/18 10:18:24 jdolecek Exp $
# $NetBSD: genassym.cf,v 1.7 2001/02/28 18:15:43 bjh21 Exp $
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@ -71,7 +71,6 @@ define P_FLAG offsetof(struct proc, p_flag)
define P_SIGLIST offsetof(struct proc, p_sigctx) + offsetof(struct sigctx, ps_siglist)
define P_SIGMASK offsetof(struct proc, p_sigctx) + offsetof(struct sigctx, ps_sigmask)
define P_USRPRI offsetof(struct proc, p_usrpri)
define P_SPARE offsetof(struct proc, p_md.__spare)
define SONPROC SONPROC

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.85 2001/02/13 13:19:53 bjh21 Exp $ */
/* $NetBSD: machdep.c,v 1.86 2001/02/28 18:15:43 bjh21 Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -475,7 +475,7 @@ cpu_startup()
(void) pmap_extract(kernel_pmap, (vaddr_t)(kernel_pmap)->pm_pdir,
(paddr_t *)&curpcb->pcb_pagedir);
proc0.p_md.md_regs = (struct trapframe *)curpcb->pcb_sp - 1;
curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_sp - 1;
}
#ifndef FOOTBRIDGE
@ -514,7 +514,7 @@ setregs(p, pack, stack)
pack->ep_entry, stack, p);
#endif
tf = p->p_md.md_regs;
tf = p->p_addr->u_pcb.pcb_tf;
#ifdef PMAP_DEBUG
if (pmap_debug_level >= -1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.38 2000/12/12 20:49:16 mycroft Exp $ */
/* $NetBSD: syscall.c,v 1.39 2001/02/28 18:15:44 bjh21 Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -85,6 +85,7 @@
#include <sys/systm.h>
#include <sys/reboot.h>
#include <sys/syscall.h>
#include <sys/user.h>
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
@ -94,6 +95,7 @@
#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/katelib.h>
#include <machine/pcb.h>
u_int arm700bugcount = 0;
@ -130,7 +132,7 @@ syscall(frame, code)
uvmexp.syscalls++;
p = curproc;
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
#ifdef CPU_ARM7
/*
@ -278,7 +280,7 @@ child_return(arg)
void *arg;
{
struct proc *p = arg;
struct trapframe *frame = p->p_md.md_regs;
struct trapframe *frame = p->p_addr->u_pcb.pcb_tf;
frame->tf_r0 = 0;
frame->tf_spsr &= ~PSR_C_bit; /* carry bit */

View File

@ -1,4 +1,4 @@
/* $NetBSD: undefined.c,v 1.22 2001/01/12 13:43:13 bjh21 Exp $ */
/* $NetBSD: undefined.c,v 1.23 2001/02/28 18:15:44 bjh21 Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
@ -170,7 +170,7 @@ undefinedinstruction(frame)
/* Modify the fault_code to reflect the USR/SVC state at time of fault */
fault_code = FAULT_USER;
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
} else
fault_code = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.54 2001/02/26 15:59:54 bjh21 Exp $ */
/* $NetBSD: vm_machdep.c,v 1.55 2001/02/28 18:15:44 bjh21 Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -170,8 +170,8 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
arm_fpe_copycontext(FP_CONTEXT(p1), FP_CONTEXT(p2));
#endif /* ARMFPE */
p2->p_md.md_regs = tf = (struct trapframe *)pcb->pcb_sp - 1;
*tf = *p1->p_md.md_regs;
p2->p_addr->u_pcb.pcb_tf = tf = (struct trapframe *)pcb->pcb_sp - 1;
*tf = *p1->p_addr->u_pcb.pcb_tf;
/*
* If specified, give the child a different stack.

View File

@ -1,4 +1,4 @@
/* $NetBSD: armfpe_init.c,v 1.21 2000/12/12 19:45:47 mycroft Exp $ */
/* $NetBSD: armfpe_init.c,v 1.22 2001/02/28 18:15:44 bjh21 Exp $ */
/*
* Copyright (C) 1996 Mark Brinicombe
@ -181,7 +181,7 @@ arm_fpe_postproc(fpframe, frame)
register struct proc *p;
p = curproc;
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
/* take pending signals */

View File

@ -1,4 +1,4 @@
/* $NetBSD: fault.c,v 1.1 2001/02/23 03:48:10 ichiro Exp $ */
/* $NetBSD: fault.c,v 1.2 2001/02/28 18:15:44 bjh21 Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@ -241,7 +241,7 @@ copyfault:
* Note that the fault was from USR mode.
*/
user = 1;
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
} else
user = 0;
@ -538,7 +538,7 @@ prefetch_abort_handler(frame)
/* Was the prefectch abort from USR32 mode ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
} else {
/*
* All the kernel code pages are loaded at boot time

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.1 2001/02/23 03:48:10 ichiro Exp $
# $NetBSD: genassym.cf,v 1.2 2001/02/28 18:15:44 bjh21 Exp $
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@ -71,7 +71,6 @@ define P_FLAG offsetof(struct proc, p_flag)
define P_SIGLIST offsetof(struct proc, p_sigctx) + offsetof(struct sigctx, ps_siglist)
define P_SIGMASK offsetof(struct proc, p_sigctx) + offsetof(struct sigctx, ps_sigmask)
define P_USRPRI offsetof(struct proc, p_usrpri)
define P_SPARE offsetof(struct proc, p_md.__spare)
define SONPROC SONPROC

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.2 2001/02/25 15:45:23 toshii Exp $ */
/* $NetBSD: machdep.c,v 1.3 2001/02/28 18:15:44 bjh21 Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -463,7 +463,7 @@ cpu_startup()
(void) pmap_extract(kernel_pmap, (vaddr_t)(kernel_pmap)->pm_pdir,
(paddr_t *)&curpcb->pcb_pagedir);
proc0.p_md.md_regs = (struct trapframe *)curpcb->pcb_sp - 1;
curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_sp - 1;
}
/*
@ -500,7 +500,7 @@ setregs(p, pack, stack)
pack->ep_entry, stack, p);
#endif
tf = p->p_md.md_regs;
tf = p->p_addr->u_pcb.pcb_tf;
#ifdef PMAP_DEBUG
if (pmap_debug_level >= -1)
@ -588,7 +588,7 @@ sendsig(catcher, sig, mask, code)
struct sigframe *fp, frame;
int onstack;
tf = p->p_md.md_regs;
tf = p->p_addr->u_pcb.pcb_tf;
/* Do we need to jump onto the signal stack? */
onstack =
@ -707,7 +707,7 @@ sys___sigreturn14(p, v, retval)
return (EINVAL);
/* Restore register context. */
tf = p->p_md.md_regs;
tf = p->p_addr->u_pcb.pcb_tf;
tf->tf_r0 = context.sc_r0;
tf->tf_r1 = context.sc_r1;
tf->tf_r2 = context.sc_r2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.1 2001/02/23 03:48:12 ichiro Exp $ */
/* $NetBSD: process_machdep.c,v 1.2 2001/02/28 18:15:44 bjh21 Exp $ */
/*
* Copyright (c) 1995 Frank Lancaster. All rights reserved.
@ -85,7 +85,7 @@ process_frame(p)
struct proc *p;
{
return (p->p_md.md_regs);
return (p->p_addr->u_pcb.pcb_tf);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.c,v 1.1 2001/02/23 03:48:13 ichiro Exp $ */
/* $NetBSD: syscall.c,v 1.2 2001/02/28 18:15:44 bjh21 Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -130,7 +130,7 @@ syscall(frame, code)
uvmexp.syscalls++;
p = curproc;
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
/*
* Support for architecture dependant SWIs
@ -253,7 +253,7 @@ child_return(arg)
void *arg;
{
struct proc *p = arg;
struct trapframe *frame = p->p_md.md_regs;
struct trapframe *frame = p->p_addr->u_pcb.pcb_tf;
frame->tf_r0 = 0;
frame->tf_spsr &= ~PSR_C_bit; /* carry bit */

View File

@ -1,4 +1,4 @@
/* $NetBSD: undefined.c,v 1.1 2001/02/23 03:48:13 ichiro Exp $ */
/* $NetBSD: undefined.c,v 1.2 2001/02/28 18:15:45 bjh21 Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
@ -170,7 +170,7 @@ undefinedinstruction(frame)
/* Modify the fault_code to reflect the USR/SVC state at time of fault */
fault_code = FAULT_USER;
p->p_md.md_regs = frame;
p->p_addr->u_pcb.pcb_tf = frame;
} else
fault_code = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.2 2001/02/26 16:33:10 bjh21 Exp $ */
/* $NetBSD: vm_machdep.c,v 1.3 2001/02/28 18:15:45 bjh21 Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -171,8 +171,8 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
arm_fpe_copycontext(FP_CONTEXT(p1), FP_CONTEXT(p2));
#endif /* ARMFPE */
p2->p_md.md_regs = tf = (struct trapframe *)pcb->pcb_sp - 1;
*tf = *p1->p_md.md_regs;
p2->p_addr->u_pcb.pcb_tf = tf = (struct trapframe *)pcb->pcb_sp - 1;
*tf = *p1->p_addr->u_pcb.pcb_tf;
/*
* If specified, give the child a different stack.