aboutsummaryrefslogtreecommitdiff
path: root/sys/ia64/ia64
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
committerJulian Elischer <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
commitb40ce4165d5eb3a5de1515245055350ae3dbab8e (patch)
treeb1a19fcdf05759281fab0d89efb13f0fdf42102e /sys/ia64/ia64
parent9b36a30ee46a7766f269fe832ef3a2daa2ec04f0 (diff)
downloadsrc-b40ce4165d5eb3a5de1515245055350ae3dbab8e.tar.gz
src-b40ce4165d5eb3a5de1515245055350ae3dbab8e.zip
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
Notes
Notes: svn path=/head/; revision=83366
Diffstat (limited to 'sys/ia64/ia64')
-rw-r--r--sys/ia64/ia64/exception.S2
-rw-r--r--sys/ia64/ia64/exception.s2
-rw-r--r--sys/ia64/ia64/genassym.c65
-rw-r--r--sys/ia64/ia64/interrupt.c8
-rw-r--r--sys/ia64/ia64/locore.S24
-rw-r--r--sys/ia64/ia64/locore.s24
-rw-r--r--sys/ia64/ia64/machdep.c144
-rw-r--r--sys/ia64/ia64/mem.c12
-rw-r--r--sys/ia64/ia64/pmap.c124
-rw-r--r--sys/ia64/ia64/procfs_machdep.c38
-rw-r--r--sys/ia64/ia64/ssc.c10
-rw-r--r--sys/ia64/ia64/sscdisk.c8
-rw-r--r--sys/ia64/ia64/support.S54
-rw-r--r--sys/ia64/ia64/support.s54
-rw-r--r--sys/ia64/ia64/swtch.s27
-rw-r--r--sys/ia64/ia64/sys_machdep.c4
-rw-r--r--sys/ia64/ia64/trap.c86
-rw-r--r--sys/ia64/ia64/vm_machdep.c107
18 files changed, 420 insertions, 373 deletions
diff --git a/sys/ia64/ia64/exception.S b/sys/ia64/ia64/exception.S
index bec2ae1c192c..60c321ae0553 100644
--- a/sys/ia64/ia64/exception.S
+++ b/sys/ia64/ia64/exception.S
@@ -31,7 +31,7 @@
#include <assym.s>
/*
- * ar.k7 = curproc
+ * ar.k7 = curthread
* ar.k6 = ksp
* ar.k5 = kbsp
* ar.k4 = globalp
diff --git a/sys/ia64/ia64/exception.s b/sys/ia64/ia64/exception.s
index bec2ae1c192c..60c321ae0553 100644
--- a/sys/ia64/ia64/exception.s
+++ b/sys/ia64/ia64/exception.s
@@ -31,7 +31,7 @@
#include <assym.s>
/*
- * ar.k7 = curproc
+ * ar.k7 = curthread
* ar.k6 = ksp
* ar.k5 = kbsp
* ar.k4 = globalp
diff --git a/sys/ia64/ia64/genassym.c b/sys/ia64/ia64/genassym.c
index 7da41b092551..0984c87fe5e6 100644
--- a/sys/ia64/ia64/genassym.c
+++ b/sys/ia64/ia64/genassym.c
@@ -65,11 +65,8 @@
#include <nfs/nfs.h>
#include <nfs/nfsdiskless.h>
-ASSYM(UPAGES, UPAGES);
-ASSYM(PAGE_SIZE, PAGE_SIZE);
-
-ASSYM(GD_CURPROC, offsetof(struct globaldata, gd_curproc));
-ASSYM(GD_FPCURPROC, offsetof(struct globaldata, gd_fpcurproc));
+ASSYM(GD_CURTHREAD, offsetof(struct globaldata, gd_curthread));
+ASSYM(GD_FPCURTHREAD, offsetof(struct globaldata, gd_fpcurthread));
ASSYM(GD_CURPCB, offsetof(struct globaldata, gd_curpcb));
ASSYM(GD_SWITCHTIME, offsetof(struct globaldata, gd_switchtime));
ASSYM(GD_CPUID, offsetof(struct globaldata, gd_cpuid));
@@ -79,13 +76,13 @@ ASSYM(MTX_RECURSE, offsetof(struct mtx, mtx_recurse));
ASSYM(MTX_SAVECRIT, offsetof(struct mtx, mtx_savecrit));
ASSYM(MTX_UNOWNED, MTX_UNOWNED);
-ASSYM(P_ADDR, offsetof(struct proc, p_addr));
-ASSYM(P_MD_FLAGS, offsetof(struct proc, p_md.md_flags));
+ASSYM(TD_PROC, offsetof(struct thread, td_proc));
+ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
+ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack));
+ASSYM(TD_MD_FLAGS, offsetof(struct thread, td_md.md_flags));
ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
-ASSYM(SIZEOF_USER, sizeof(struct user));
-
ASSYM(FRAME_SYSCALL, FRAME_SYSCALL);
ASSYM(TF_CR_IPSR, offsetof(struct trapframe, tf_cr_ipsr));
@@ -101,35 +98,35 @@ ASSYM(FRAME_R6, FRAME_R6);
ASSYM(FRAME_R7, FRAME_R7);
ASSYM(FRAME_SP, FRAME_SP);
-ASSYM(U_PCB_R4, offsetof(struct user, u_pcb.pcb_r4));
-ASSYM(U_PCB_R5, offsetof(struct user, u_pcb.pcb_r5));
-ASSYM(U_PCB_R6, offsetof(struct user, u_pcb.pcb_r6));
-ASSYM(U_PCB_R7, offsetof(struct user, u_pcb.pcb_r7));
+ASSYM(PCB_R4, offsetof(struct pcb, pcb_r4));
+ASSYM(PCB_R5, offsetof(struct pcb, pcb_r5));
+ASSYM(PCB_R6, offsetof(struct pcb, pcb_r6));
+ASSYM(PCB_R7, offsetof(struct pcb, pcb_r7));
-ASSYM(U_PCB_F2, offsetof(struct user, u_pcb.pcb_f2));
-ASSYM(U_PCB_F3, offsetof(struct user, u_pcb.pcb_f3));
-ASSYM(U_PCB_F4, offsetof(struct user, u_pcb.pcb_f4));
-ASSYM(U_PCB_F5, offsetof(struct user, u_pcb.pcb_f5));
+ASSYM(PCB_F2, offsetof(struct pcb, pcb_f2));
+ASSYM(PCB_F3, offsetof(struct pcb, pcb_f3));
+ASSYM(PCB_F4, offsetof(struct pcb, pcb_f4));
+ASSYM(PCB_F5, offsetof(struct pcb, pcb_f5));
-ASSYM(U_PCB_B0, offsetof(struct user, u_pcb.pcb_b0));
-ASSYM(U_PCB_B1, offsetof(struct user, u_pcb.pcb_b1));
-ASSYM(U_PCB_B2, offsetof(struct user, u_pcb.pcb_b2));
-ASSYM(U_PCB_B3, offsetof(struct user, u_pcb.pcb_b3));
-ASSYM(U_PCB_B4, offsetof(struct user, u_pcb.pcb_b4));
-ASSYM(U_PCB_B5, offsetof(struct user, u_pcb.pcb_b5));
+ASSYM(PCB_B0, offsetof(struct pcb, pcb_b0));
+ASSYM(PCB_B1, offsetof(struct pcb, pcb_b1));
+ASSYM(PCB_B2, offsetof(struct pcb, pcb_b2));
+ASSYM(PCB_B3, offsetof(struct pcb, pcb_b3));
+ASSYM(PCB_B4, offsetof(struct pcb, pcb_b4));
+ASSYM(PCB_B5, offsetof(struct pcb, pcb_b5));
-ASSYM(U_PCB_OLD_UNAT, offsetof(struct user, u_pcb.pcb_old_unat));
-ASSYM(U_PCB_SP, offsetof(struct user, u_pcb.pcb_sp));
-ASSYM(U_PCB_PFS, offsetof(struct user, u_pcb.pcb_pfs));
-ASSYM(U_PCB_BSPSTORE, offsetof(struct user, u_pcb.pcb_bspstore));
+ASSYM(PCB_OLD_UNAT, offsetof(struct pcb, pcb_old_unat));
+ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
+ASSYM(PCB_PFS, offsetof(struct pcb, pcb_pfs));
+ASSYM(PCB_BSPSTORE, offsetof(struct pcb, pcb_bspstore));
-ASSYM(U_PCB_UNAT, offsetof(struct user, u_pcb.pcb_unat));
-ASSYM(U_PCB_RNAT, offsetof(struct user, u_pcb.pcb_rnat));
-ASSYM(U_PCB_PR, offsetof(struct user, u_pcb.pcb_pr));
+ASSYM(PCB_UNAT, offsetof(struct pcb, pcb_unat));
+ASSYM(PCB_RNAT, offsetof(struct pcb, pcb_rnat));
+ASSYM(PCB_PR, offsetof(struct pcb, pcb_pr));
-ASSYM(U_PCB_ONFAULT, offsetof(struct user, u_pcb.pcb_onfault));
+ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
-ASSYM(U_PCB_HIGHFP, offsetof(struct user, u_pcb.pcb_highfp));
+ASSYM(PCB_HIGHFP, offsetof(struct pcb, pcb_highfp));
ASSYM(UC_MCONTEXT_MC_AR_BSP, offsetof(ucontext_t, uc_mcontext.mc_ar_bsp));
ASSYM(UC_MCONTEXT_MC_AR_RNAT, offsetof(ucontext_t, uc_mcontext.mc_ar_rnat));
@@ -137,4 +134,8 @@ ASSYM(UC_MCONTEXT_MC_AR_RNAT, offsetof(ucontext_t, uc_mcontext.mc_ar_rnat));
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
+ASSYM(PAGE_SIZE, PAGE_SIZE);
+ASSYM(KSTACK_PAGES, KSTACK_PAGES);
+
ASSYM(SIZEOF_TRAPFRAME, sizeof(struct trapframe));
+ASSYM(SIZEOF_PCB, sizeof(struct pcb));
diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c
index b4b51a8fc141..8661fcd3fcb7 100644
--- a/sys/ia64/ia64/interrupt.c
+++ b/sys/ia64/ia64/interrupt.c
@@ -81,10 +81,10 @@ static u_int schedclk2;
void
interrupt(u_int64_t vector, struct trapframe *framep)
{
- struct proc *p;
+ struct thread *td;
- p = curproc;
- atomic_add_int(&p->p_intr_nesting_level, 1);
+ td = curthread;
+ atomic_add_int(&td->td_intr_nesting_level, 1);
switch (vector) {
case 240: /* clock interrupt */
CTR0(KTR_INTR, "clock interrupt");
@@ -107,7 +107,7 @@ interrupt(u_int64_t vector, struct trapframe *framep)
panic("unexpected interrupt: vec %ld\n", vector);
/* NOTREACHED */
}
- atomic_subtract_int(&p->p_intr_nesting_level, 1);
+ atomic_subtract_int(&td->td_intr_nesting_level, 1);
}
diff --git a/sys/ia64/ia64/locore.S b/sys/ia64/ia64/locore.S
index 6aed337e277c..55c081625d05 100644
--- a/sys/ia64/ia64/locore.S
+++ b/sys/ia64/ia64/locore.S
@@ -64,9 +64,9 @@
#endif
.section .data.proc0,"aw"
- .global proc0paddr
+ .global kstack
.align PAGE_SIZE
-proc0paddr: .space UPAGES * PAGE_SIZE
+kstack: .space KSTACK_PAGES * PAGE_SIZE
.text
@@ -80,23 +80,19 @@ ENTRY(__start, 1)
;;
mov cr.iva=r8
mov cr.pta=r9
- movl r10=proc0
;;
- add r10=P_ADDR,r10
- movl r11=proc0paddr
+ movl r11=kstack
;;
- st8 [r10]=r11
srlz.i
;;
srlz.d
- mov r9=UPAGES*PAGE_SIZE-16
+ mov r9=KSTACK_PAGES*PAGE_SIZE-SIZEOF_PCB-16
;;
movl gp=__gp // find kernel globals
add sp=r9,r11 // proc0's stack
- add r10=SIZEOF_USER,r11 // proc0's backing store
mov ar.rsc=0 // turn off rse
;;
- mov ar.bspstore=r10 // switch backing store
+ mov ar.bspstore=r11 // switch backing store
;;
loadrs // invalidate regs
;;
@@ -105,17 +101,19 @@ ENTRY(__start, 1)
br.call.sptk.many rp=ia64_init
/*
- * switch to proc0 and then initialise the rest of the kernel.
+ * switch to thread0 and then initialise the rest of the kernel.
*/
alloc r16=ar.pfs,0,0,1,0
;;
- movl out0=proc0
+ movl out0=thread0
;;
- add out0=P_ADDR,out0
+ ld8 out0=[out0]
+ ;;
+ add out0=TD_PCB,out0
;;
ld8 out0=[out0]
;;
- add r16=U_PCB_B0,out0 // return to mi_startup
+ add r16=PCB_B0,out0 // return to mi_startup
movl r17=mi_startup
;;
st8 [r16]=r17
diff --git a/sys/ia64/ia64/locore.s b/sys/ia64/ia64/locore.s
index 6aed337e277c..55c081625d05 100644
--- a/sys/ia64/ia64/locore.s
+++ b/sys/ia64/ia64/locore.s
@@ -64,9 +64,9 @@
#endif
.section .data.proc0,"aw"
- .global proc0paddr
+ .global kstack
.align PAGE_SIZE
-proc0paddr: .space UPAGES * PAGE_SIZE
+kstack: .space KSTACK_PAGES * PAGE_SIZE
.text
@@ -80,23 +80,19 @@ ENTRY(__start, 1)
;;
mov cr.iva=r8
mov cr.pta=r9
- movl r10=proc0
;;
- add r10=P_ADDR,r10
- movl r11=proc0paddr
+ movl r11=kstack
;;
- st8 [r10]=r11
srlz.i
;;
srlz.d
- mov r9=UPAGES*PAGE_SIZE-16
+ mov r9=KSTACK_PAGES*PAGE_SIZE-SIZEOF_PCB-16
;;
movl gp=__gp // find kernel globals
add sp=r9,r11 // proc0's stack
- add r10=SIZEOF_USER,r11 // proc0's backing store
mov ar.rsc=0 // turn off rse
;;
- mov ar.bspstore=r10 // switch backing store
+ mov ar.bspstore=r11 // switch backing store
;;
loadrs // invalidate regs
;;
@@ -105,17 +101,19 @@ ENTRY(__start, 1)
br.call.sptk.many rp=ia64_init
/*
- * switch to proc0 and then initialise the rest of the kernel.
+ * switch to thread0 and then initialise the rest of the kernel.
*/
alloc r16=ar.pfs,0,0,1,0
;;
- movl out0=proc0
+ movl out0=thread0
;;
- add out0=P_ADDR,out0
+ ld8 out0=[out0]
+ ;;
+ add out0=TD_PCB,out0
;;
ld8 out0=[out0]
;;
- add r16=U_PCB_B0,out0 // return to mi_startup
+ add r16=PCB_B0,out0 // return to mi_startup
movl r17=mi_startup
;;
st8 [r16]=r17
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index eb6a997664e6..e5af47609be0 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -86,7 +86,9 @@ struct bootinfo bootinfo;
struct mtx sched_lock;
struct mtx Giant;
-char proc0paddr[UPAGES * PAGE_SIZE];
+extern char kstack[];
+struct user *proc0uarea;
+vm_offset_t proc0kstack;
char machine[] = "ia64";
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
@@ -546,11 +548,23 @@ ia64_init()
}
+ proc_linkup(&proc0);
+ /*
+ * Init mapping for u page(s) for proc 0
+ */
+ proc0uarea = (struct user *)pmap_steal_memory(UAREA_PAGES * PAGE_SIZE);
+ proc0kstack = (vm_offset_t)kstack;
+ proc0.p_uarea = proc0uarea;
+ thread0 = &proc0.p_thread;
+ thread0->td_kstack = proc0kstack;
+ thread0->td_pcb = (struct pcb *)
+ (thread0->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
/*
* Setup the global data for the bootstrap cpu.
*/
{
- size_t sz = round_page(UPAGES * PAGE_SIZE);
+ /* This is not a 'struct user' */
+ size_t sz = round_page(KSTACK_PAGES * PAGE_SIZE);
globalp = (struct globaldata *) pmap_steal_memory(sz);
globaldata_init(globalp, 0, sz);
ia64_set_k4((u_int64_t) globalp);
@@ -568,18 +582,18 @@ ia64_init()
* Set the kernel sp, reserving space for an (empty) trapframe,
* and make proc0's trapframe pointer point to it for sanity.
* Initialise proc0's backing store to start after u area.
+ *
+ * XXX what is all this +/- 16 stuff?
*/
- proc0.p_addr->u_pcb.pcb_sp =
- (u_int64_t)proc0.p_addr + USPACE - sizeof(struct trapframe) - 16;
- proc0.p_addr->u_pcb.pcb_bspstore = (u_int64_t) (proc0.p_addr + 1);
- proc0.p_frame =
- (struct trapframe *)(proc0.p_addr->u_pcb.pcb_sp + 16);
+ thread0->td_frame = (struct trapframe *)thread0->td_pcb - 1;
+ thread0->td_pcb->pcb_sp = (u_int64_t)thread0->td_frame - 16;
+ thread0->td_pcb->pcb_bspstore = (u_int64_t)proc0kstack;
/* Setup curproc so that mutexes work */
- PCPU_SET(curproc, &proc0);
+ PCPU_SET(curthread, thread0);
PCPU_SET(spinlocks, NULL);
- LIST_INIT(&proc0.p_contested);
+ LIST_INIT(&thread0->td_contested);
/*
* Initialise mutexes.
@@ -739,16 +753,19 @@ DELAY(int n)
void
sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
- struct proc *p = curproc;
+ struct proc *p;
+ struct thread *td;
struct trapframe *frame;
struct sigacts *psp;
struct sigframe sf, *sfp;
u_int64_t sbs = 0;
int oonstack, rndfsize;
+ td = curthread;
+ p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
- frame = p->p_frame;
+ frame = td->td_frame;
oonstack = sigonstack(frame->tf_r[FRAME_SP]);
rndfsize = ((sizeof(sf) + 15) / 16) * 16;
@@ -843,12 +860,12 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
#if 0
/* save the floating-point state, if necessary, then copy it. */
- ia64_fpstate_save(p, 1);
- sf.sf_uc.uc_mcontext.mc_ownedfp = p->p_md.md_flags & MDP_FPUSED;
- bcopy(&p->p_addr->u_pcb.pcb_fp,
+ ia64_fpstate_save(td, 1);
+ sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDP_FPUSED;
+ bcopy(&td->td_pcb->pcb_fp,
(struct fpreg *)sf.sf_uc.uc_mcontext.mc_fpregs,
sizeof(struct fpreg));
- sf.sf_uc.uc_mcontext.mc_fp_control = p->p_addr->u_pcb.pcb_fp_control;
+ sf.sf_uc.uc_mcontext.mc_fp_control = td->td_pcb.pcb_fp_control;
#endif
/*
@@ -907,7 +924,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
*/
#ifdef COMPAT_43
int
-osigreturn(struct proc *p,
+osigreturn(struct thread *td,
struct osigreturn_args /* {
struct osigcontext *sigcntxp;
} */ *uap)
@@ -927,18 +944,20 @@ osigreturn(struct proc *p,
*/
int
-sigreturn(struct proc *p,
+sigreturn(struct thread *td,
struct sigreturn_args /* {
ucontext_t *sigcntxp;
} */ *uap)
{
ucontext_t uc, *ucp;
struct pcb *pcb;
- struct trapframe *frame = p->p_frame;
+ struct trapframe *frame = td->td_frame;
struct __mcontext *mcp;
+ struct proc *p;
ucp = uap->sigcntxp;
- pcb = &p->p_addr->u_pcb;
+ pcb = td->td_pcb;
+ p = td->td_proc;
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
@@ -1000,12 +1019,11 @@ sigreturn(struct proc *p,
PROC_UNLOCK(p);
/* XXX ksc.sc_ownedfp ? */
- ia64_fpstate_drop(p);
+ ia64_fpstate_drop(td);
#if 0
bcopy((struct fpreg *)uc.uc_mcontext.mc_fpregs,
- &p->p_addr->u_pcb.pcb_fp, sizeof(struct fpreg));
- p->p_addr->u_pcb.pcb_fp_control =
- uc.uc_mcontext.mc_fp_control;
+ &td->td_pcb->pcb_fp, sizeof(struct fpreg));
+ td->td_pcb->pcb_fp_control = uc.uc_mcontext.mc_fp_control;
#endif
#ifdef DEBUG
@@ -1039,11 +1057,11 @@ cpu_halt(void)
* Clear registers on exec
*/
void
-setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings)
+setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
{
struct trapframe *frame;
- frame = p->p_frame;
+ frame = td->td_frame;
/*
* Make sure that we restore the entire trapframe after an
@@ -1069,25 +1087,25 @@ setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings)
* Setup the new backing store and make sure the new image
* starts executing with an empty register stack frame.
*/
- frame->tf_ar_bspstore = p->p_md.md_bspstore;
+ frame->tf_ar_bspstore = td->td_md.md_bspstore;
frame->tf_ndirty = 0;
frame->tf_cr_ifs = (1L<<63); /* ifm=0, v=1 */
frame->tf_ar_rsc = 0xf; /* user mode rsc */
frame->tf_ar_fpsr = IA64_FPSR_DEFAULT;
- p->p_md.md_flags &= ~MDP_FPUSED;
- ia64_fpstate_drop(p);
+ td->td_md.md_flags &= ~MDP_FPUSED;
+ ia64_fpstate_drop(td);
}
int
-ptrace_set_pc(struct proc *p, unsigned long addr)
+ptrace_set_pc(struct thread *td, unsigned long addr)
{
/* TODO set pc in trapframe */
return 0;
}
int
-ptrace_single_step(struct proc *p)
+ptrace_single_step(struct thread *td)
{
/* TODO arrange for user process to single step */
return 0;
@@ -1100,8 +1118,8 @@ ia64_pa_access(vm_offset_t pa)
}
int
-fill_regs(p, regs)
- struct proc *p;
+fill_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
/* TODO copy trapframe to regs */
@@ -1109,8 +1127,8 @@ fill_regs(p, regs)
}
int
-set_regs(p, regs)
- struct proc *p;
+set_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
/* TODO copy regs to trapframe */
@@ -1118,29 +1136,29 @@ set_regs(p, regs)
}
int
-fill_fpregs(p, fpregs)
- struct proc *p;
+fill_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
/* TODO copy fpu state to fpregs */
- ia64_fpstate_save(p, 0);
+ ia64_fpstate_save(td, 0);
#if 0
- bcopy(&p->p_addr->u_pcb.pcb_fp, fpregs, sizeof *fpregs);
+ bcopy(&td->td_pcb->pcb_fp, fpregs, sizeof *fpregs);
#endif
return (0);
}
int
-set_fpregs(p, fpregs)
- struct proc *p;
+set_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
/* TODO copy fpregs fpu state */
- ia64_fpstate_drop(p);
+ ia64_fpstate_drop(td);
#if 0
- bcopy(fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof *fpregs);
+ bcopy(fpregs, &td->td_pcb->pcb_fp, sizeof *fpregs);
#endif
return (0);
}
@@ -1236,11 +1254,11 @@ SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
CTLFLAG_RW, &wall_cmos_clock, 0, "");
void
-ia64_fpstate_check(struct proc *p)
+ia64_fpstate_check(struct thread *td)
{
- if ((p->p_frame->tf_cr_ipsr & IA64_PSR_DFH) == 0)
- if (p != PCPU_GET(fpcurproc))
- panic("ia64_check_fpcurproc: bogus");
+ if ((td->td_frame->tf_cr_ipsr & IA64_PSR_DFH) == 0)
+ if (td != PCPU_GET(fpcurthread))
+ panic("ia64_check_fpcurthread: bogus");
}
/*
@@ -1251,17 +1269,17 @@ ia64_fpstate_check(struct proc *p)
* by generating a disabled fp trap.
*/
void
-ia64_fpstate_save(struct proc *p, int write)
+ia64_fpstate_save(struct thread *td, int write)
{
- if (p == PCPU_GET(fpcurproc)) {
+ if (td == PCPU_GET(fpcurthread)) {
/*
* Save the state in the pcb.
*/
- savehighfp(p->p_addr->u_pcb.pcb_highfp);
+ savehighfp(td->td_pcb->pcb_highfp);
if (write) {
- p->p_frame->tf_cr_ipsr |= IA64_PSR_DFH;
- PCPU_SET(fpcurproc, NULL);
+ td->td_frame->tf_cr_ipsr |= IA64_PSR_DFH;
+ PCPU_SET(fpcurthread, NULL);
}
}
}
@@ -1272,11 +1290,11 @@ ia64_fpstate_save(struct proc *p, int write)
* (e.g. on sigreturn).
*/
void
-ia64_fpstate_drop(struct proc *p)
+ia64_fpstate_drop(struct thread *td)
{
- if (p == PCPU_GET(fpcurproc)) {
- p->p_frame->tf_cr_ipsr |= IA64_PSR_DFH;
- PCPU_SET(fpcurproc, NULL);
+ if (td == PCPU_GET(fpcurthread)) {
+ td->td_frame->tf_cr_ipsr |= IA64_PSR_DFH;
+ PCPU_SET(fpcurthread, NULL);
}
}
@@ -1285,24 +1303,24 @@ ia64_fpstate_drop(struct proc *p)
* from the pcb.
*/
void
-ia64_fpstate_switch(struct proc *p)
+ia64_fpstate_switch(struct thread *td)
{
- if (PCPU_GET(fpcurproc)) {
+ if (PCPU_GET(fpcurthread)) {
/*
* Dump the old fp state if its valid.
*/
- savehighfp(PCPU_GET(fpcurproc)->p_addr->u_pcb.pcb_highfp);
- PCPU_GET(fpcurproc)->p_frame->tf_cr_ipsr |= IA64_PSR_DFH;
+ savehighfp(PCPU_GET(fpcurthread)->td_pcb->pcb_highfp);
+ PCPU_GET(fpcurthread)->td_frame->tf_cr_ipsr |= IA64_PSR_DFH;
}
/*
* Remember the new FP owner and reload its state.
*/
- PCPU_SET(fpcurproc, p);
- restorehighfp(p->p_addr->u_pcb.pcb_highfp);
- p->p_frame->tf_cr_ipsr &= ~IA64_PSR_DFH;
+ PCPU_SET(fpcurthread, td);
+ restorehighfp(td->td_pcb->pcb_highfp);
+ td->td_frame->tf_cr_ipsr &= ~IA64_PSR_DFH;
- p->p_md.md_flags |= MDP_FPUSED;
+ td->td_md.md_flags |= MDP_FPUSED;
}
/*
diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c
index a6dd04603d39..0142a4839588 100644
--- a/sys/ia64/ia64/mem.c
+++ b/sys/ia64/ia64/mem.c
@@ -99,12 +99,12 @@ static struct cdevsw mem_cdevsw = {
struct mem_range_softc mem_range_softc;
static int
-mmclose(dev_t dev, int flags, int fmt, struct proc *p)
+mmclose(dev_t dev, int flags, int fmt, struct thread *td)
{
switch (minor(dev)) {
#ifdef PERFMON
case 32:
- return perfmon_close(dev, flags, fmt, p);
+ return perfmon_close(dev, flags, fmt, td);
#endif
default:
break;
@@ -113,7 +113,7 @@ mmclose(dev_t dev, int flags, int fmt, struct proc *p)
}
static int
-mmopen(dev_t dev, int flags, int fmt, struct proc *p)
+mmopen(dev_t dev, int flags, int fmt, struct thread *td)
{
switch (minor(dev)) {
@@ -124,7 +124,7 @@ mmopen(dev_t dev, int flags, int fmt, struct proc *p)
break;
case 32:
#ifdef PERFMON
- return perfmon_open(dev, flags, fmt, p);
+ return perfmon_open(dev, flags, fmt, td);
#else
return ENODEV;
#endif
@@ -236,12 +236,12 @@ memmmap(dev_t dev, vm_offset_t offset, int prot)
}
static int
-mmioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, struct proc *p)
+mmioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, struct thread *td)
{
switch(minor(dev)) {
#ifdef PERFMON
case 32:
- return perfmon_ioctl(dev, cmd, cmdarg, flags, p);
+ return perfmon_ioctl(dev, cmd, cmdarg, flags, td);
#endif
default:
return ENODEV;
diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c
index 5ddba293f540..3f70fb762aec 100644
--- a/sys/ia64/ia64/pmap.c
+++ b/sys/ia64/ia64/pmap.c
@@ -222,7 +222,7 @@ static int pmap_ridbits = 18;
static vm_zone_t pvzone;
static struct vm_zone pvzone_store;
static struct vm_object pvzone_obj;
-static int pv_entry_count=0, pv_entry_max=0, pv_entry_high_water=0;
+static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
static int pmap_pagedaemon_waken = 0;
static struct pv_entry *pvinit;
@@ -320,7 +320,7 @@ pmap_bootstrap()
* Set up proc0's PCB.
*/
#if 0
- proc0.p_addr->u_pcb.pcb_hw.apcb_asn = 0;
+ thread0->td_pcb->pcb_hw.apcb_asn = 0;
#endif
}
@@ -505,7 +505,7 @@ pmap_track_modified(vm_offset_t va)
}
/*
- * Create the UPAGES for a new process.
+ * Create the U area for a new process.
* This routine directly affects the fork perf for a process.
*/
void
@@ -518,7 +518,7 @@ pmap_new_proc(struct proc *p)
* 7 address for it which makes it impossible to accidentally
* lose when recording a trapframe.
*/
- up = contigmalloc(UPAGES * PAGE_SIZE, M_PMAP,
+ up = contigmalloc(UAREA_PAGES * PAGE_SIZE, M_PMAP,
M_WAITOK,
0ul,
256*1024*1024 - 1,
@@ -526,86 +526,96 @@ pmap_new_proc(struct proc *p)
256*1024*1024);
p->p_md.md_uservirt = up;
- p->p_addr = (struct user *)
+ p->p_uarea = (struct user *)
IA64_PHYS_TO_RR7(ia64_tpa((u_int64_t) up));
}
/*
- * Dispose the UPAGES for a process that has exited.
+ * Dispose the U area for a process that has exited.
* This routine directly impacts the exit perf of a process.
*/
void
pmap_dispose_proc(p)
struct proc *p;
{
- contigfree(p->p_md.md_uservirt, UPAGES * PAGE_SIZE, M_PMAP);
+ contigfree(p->p_md.md_uservirt, UAREA_PAGES * PAGE_SIZE, M_PMAP);
p->p_md.md_uservirt = 0;
- p->p_addr = 0;
+ p->p_uarea = 0;
}
/*
- * Allow the UPAGES for a process to be prejudicially paged out.
+ * Allow the U area for a process to be prejudicially paged out.
*/
void
pmap_swapout_proc(p)
struct proc *p;
{
-#if 0
- int i;
- vm_object_t upobj;
- vm_offset_t up;
- vm_page_t m;
+}
+
+/*
+ * Bring the U area for a specified process back in.
+ */
+void
+pmap_swapin_proc(p)
+ struct proc *p;
+{
+}
+
+/*
+ * Create the KSTACK for a new thread.
+ * This routine directly affects the fork perf for a process/thread.
+ */
+void
+pmap_new_thread(struct thread *td)
+{
+ vm_offset_t *ks;
/*
- * Make sure we aren't fpcurproc.
+ * Use contigmalloc for user area so that we can use a region
+ * 7 address for it which makes it impossible to accidentally
+ * lose when recording a trapframe.
*/
- ia64_fpstate_save(p, 1);
+ ks = contigmalloc(KSTACK_PAGES * PAGE_SIZE, M_PMAP,
+ M_WAITOK,
+ 0ul,
+ 256*1024*1024 - 1,
+ PAGE_SIZE,
+ 256*1024*1024);
- upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
- for (i = 0; i < UPAGES; i++) {
- m = vm_page_lookup(upobj, i);
- if (m == NULL)
- panic("pmap_swapout_proc: upage already missing?");
- vm_page_dirty(m);
- vm_page_unwire(m, 0);
- pmap_kremove(up + i * PAGE_SIZE);
- }
-#endif
+ td->td_md.md_kstackvirt = ks;
+ td->td_kstack = IA64_PHYS_TO_RR7(ia64_tpa((u_int64_t)ks));
}
/*
- * Bring the UPAGES for a specified process back in.
+ * Dispose the KSTACK for a thread that has exited.
+ * This routine directly impacts the exit perf of a process/thread.
*/
void
-pmap_swapin_proc(p)
- struct proc *p;
+pmap_dispose_thread(td)
+ struct thread *td;
{
-#if 0
- int i, rv;
- vm_object_t upobj;
- vm_offset_t up;
- vm_page_t m;
+ contigfree(td->td_md.md_kstackvirt, KSTACK_PAGES * PAGE_SIZE, M_PMAP);
+ td->td_md.md_kstackvirt = 0;
+ td->td_kstack = 0;
+}
- upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
- for (i = 0; i < UPAGES; i++) {
- m = vm_page_grab(upobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
- pmap_kenter(up + i * PAGE_SIZE, VM_PAGE_TO_PHYS(m));
- if (m->valid != VM_PAGE_BITS_ALL) {
- rv = vm_pager_get_pages(upobj, &m, 1, 0);
- if (rv != VM_PAGER_OK)
- panic("pmap_swapin_proc: cannot get upages for proc: %d\n", p->p_pid);
- m = vm_page_lookup(upobj, i);
- m->valid = VM_PAGE_BITS_ALL;
- }
- vm_page_wire(m);
- vm_page_wakeup(m);
- vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE);
- }
-#endif
+/*
+ * Allow the KSTACK for a thread to be prejudicially paged out.
+ */
+void
+pmap_swapout_thread(td)
+ struct thread *td;
+{
}
+/*
+ * Bring the KSTACK for a specified thread back in.
+ */
+void
+pmap_swapin_thread(td)
+ struct thread *td;
+{
+}
/***************************************************
* Page table page management routines.....
***************************************************/
@@ -1149,7 +1159,7 @@ pmap_collect()
{
int i;
vm_page_t m;
- static int warningdone=0;
+ static int warningdone = 0;
if (pmap_pagedaemon_waken == 0)
return;
@@ -2199,9 +2209,9 @@ pmap_mincore(pmap, addr)
}
void
-pmap_activate(struct proc *p)
+pmap_activate(struct thread *td)
{
- pmap_install(vmspace_pmap(p->p_vmspace));
+ pmap_install(vmspace_pmap(td->td_proc->p_vmspace));
}
pmap_t
@@ -2281,14 +2291,14 @@ pmap_pid_dump(int pid)
int i,j;
index = 0;
pmap = vmspace_pmap(p->p_vmspace);
- for(i=0;i<1024;i++) {
+ for(i = 0; i < 1024; i++) {
pd_entry_t *pde;
pt_entry_t *pte;
unsigned base = i << PDRSHIFT;
pde = &pmap->pm_pdir[i];
if (pde && pmap_pde_v(pde)) {
- for(j=0;j<1024;j++) {
+ for(j = 0; j < 1024; j++) {
unsigned va = base + (j << PAGE_SHIFT);
if (va >= (vm_offset_t) VM_MIN_KERNEL_ADDRESS) {
if (index) {
diff --git a/sys/ia64/ia64/procfs_machdep.c b/sys/ia64/ia64/procfs_machdep.c
index e623e49a3a27..08582fba6b85 100644
--- a/sys/ia64/ia64/procfs_machdep.c
+++ b/sys/ia64/ia64/procfs_machdep.c
@@ -85,7 +85,7 @@
int error; \
\
mtx_lock_spin(&sched_lock); \
- if ((p->p_sflag & PS_INMEM) == 0) \
+ if ((td->td_proc->p_sflag & PS_INMEM) == 0) \
error = EIO; \
else \
error = (action); \
@@ -94,21 +94,21 @@
} while(0)
int
-procfs_read_regs(p, regs)
- struct proc *p;
+procfs_read_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
- PROCFS_ACTION(fill_regs(p, regs));
+ PROCFS_ACTION(fill_regs(td, regs));
}
int
-procfs_write_regs(p, regs)
- struct proc *p;
+procfs_write_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
- PROCFS_ACTION(set_regs(p, regs));
+ PROCFS_ACTION(set_regs(td, regs));
}
/*
@@ -117,26 +117,26 @@ procfs_write_regs(p, regs)
*/
int
-procfs_read_fpregs(p, fpregs)
- struct proc *p;
+procfs_read_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
- PROCFS_ACTION(fill_fpregs(p, fpregs));
+ PROCFS_ACTION(fill_fpregs(td, fpregs));
}
int
-procfs_write_fpregs(p, fpregs)
- struct proc *p;
+procfs_write_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
- PROCFS_ACTION(set_fpregs(p, fpregs));
+ PROCFS_ACTION(set_fpregs(td, fpregs));
}
int
-procfs_sstep(p)
- struct proc *p;
+procfs_sstep(td)
+ struct thread *td;
{
return (EINVAL);
}
@@ -145,16 +145,16 @@ procfs_sstep(p)
* Placeholders
*/
int
-procfs_read_dbregs(p, dbregs)
- struct proc *p;
+procfs_read_dbregs(td, dbregs)
+ struct thread *td;
struct dbreg *dbregs;
{
return (EIO);
}
int
-procfs_write_dbregs(p, dbregs)
- struct proc *p;
+procfs_write_dbregs(td, dbregs)
+ struct thread *td;
struct dbreg *dbregs;
{
return (EIO);
diff --git a/sys/ia64/ia64/ssc.c b/sys/ia64/ia64/ssc.c
index ecc593e3590b..52eb48f5cad2 100644
--- a/sys/ia64/ia64/ssc.c
+++ b/sys/ia64/ia64/ssc.c
@@ -124,7 +124,7 @@ ssccncheckc(dev_t dev)
}
static int
-sscopen(dev_t dev, int flag, int mode, struct proc *p)
+sscopen(dev_t dev, int flag, int mode, struct thread *td)
{
struct tty *tp;
int s;
@@ -148,7 +148,7 @@ sscopen(dev_t dev, int flag, int mode, struct proc *p)
ttsetwater(tp);
setuptimeout = 1;
- } else if ((tp->t_state & TS_XCLUDE) && suser(p)) {
+ } else if ((tp->t_state & TS_XCLUDE) && suser(td->td_proc)) {
splx(s);
return EBUSY;
}
@@ -167,7 +167,7 @@ sscopen(dev_t dev, int flag, int mode, struct proc *p)
}
static int
-sscclose(dev_t dev, int flag, int mode, struct proc *p)
+sscclose(dev_t dev, int flag, int mode, struct thread *td)
{
int unit = minor(dev);
struct tty *tp = ssc_tp;
@@ -182,7 +182,7 @@ sscclose(dev_t dev, int flag, int mode, struct proc *p)
}
static int
-sscioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+sscioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
int unit = minor(dev);
struct tty *tp = ssc_tp;
@@ -191,7 +191,7 @@ sscioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if (unit != 0)
return ENXIO;
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
return error;
error = ttioctl(tp, cmd, data, flag);
diff --git a/sys/ia64/ia64/sscdisk.c b/sys/ia64/ia64/sscdisk.c
index 5b7bd09cf975..8e473ad9cc4c 100644
--- a/sys/ia64/ia64/sscdisk.c
+++ b/sys/ia64/ia64/sscdisk.c
@@ -121,14 +121,14 @@ struct ssc_s {
static int sscunits;
static int
-sscopen(dev_t dev, int flag, int fmt, struct proc *p)
+sscopen(dev_t dev, int flag, int fmt, struct thread *td)
{
struct ssc_s *sc;
struct disklabel *dl;
if (ssc_debug)
printf("sscopen(%s %x %x %p)\n",
- devtoname(dev), flag, fmt, p);
+ devtoname(dev), flag, fmt, td);
sc = dev->si_drv1;
@@ -144,12 +144,12 @@ sscopen(dev_t dev, int flag, int fmt, struct proc *p)
}
static int
-sscioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
+sscioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
{
if (ssc_debug)
printf("sscioctl(%s %lx %p %x %p)\n",
- devtoname(dev), cmd, addr, flags, p);
+ devtoname(dev), cmd, addr, flags, td);
return (ENOIOCTL);
}
diff --git a/sys/ia64/ia64/support.S b/sys/ia64/ia64/support.S
index 2e18b9c7bf5e..d6c71d5077a5 100644
--- a/sys/ia64/ia64/support.S
+++ b/sys/ia64/ia64/support.S
@@ -70,15 +70,15 @@ ENTRY(suword, 2)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -98,15 +98,15 @@ ENTRY(subyte, 2)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -126,15 +126,15 @@ ENTRY(fuword, 1)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -153,15 +153,15 @@ ENTRY(fubyte, 1)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -242,15 +242,15 @@ ENTRY(copyinstr, 4)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -277,15 +277,15 @@ ENTRY(copyoutstr, 4)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -392,15 +392,15 @@ ENTRY(copyin, 3)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -427,15 +427,15 @@ ENTRY(copyout, 3)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -453,11 +453,11 @@ END(copyout)
ENTRY(copyerr, 0)
- add r14=GD_CURPROC,r13 ;; // find curproc
+ add r14=GD_CURTHREAD,r13 ;; // find curthread
ld8 r14=[r14] ;;
- add r14=P_ADDR,r14 ;; // curproc->p_addr
+ add r14=TD_PCB,r14 ;; // curthread->td_addr
ld8 r14=[r14] ;;
- add r14=U_PCB_ONFAULT,r14 ;; // &curproc->p_addr->u_pcb.pcb_onfault
+ add r14=PCB_ONFAULT,r14 ;; // &curthread->td_pcb->pcb_onfault
st8 [r14]=r0 // reset fault handler
mov ret0=EFAULT // return EFAULT
diff --git a/sys/ia64/ia64/support.s b/sys/ia64/ia64/support.s
index 2e18b9c7bf5e..d6c71d5077a5 100644
--- a/sys/ia64/ia64/support.s
+++ b/sys/ia64/ia64/support.s
@@ -70,15 +70,15 @@ ENTRY(suword, 2)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -98,15 +98,15 @@ ENTRY(subyte, 2)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -126,15 +126,15 @@ ENTRY(fuword, 1)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -153,15 +153,15 @@ ENTRY(fubyte, 1)
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add r15=U_PCB_ONFAULT,r15
+ add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
@@ -242,15 +242,15 @@ ENTRY(copyinstr, 4)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -277,15 +277,15 @@ ENTRY(copyoutstr, 4)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -392,15 +392,15 @@ ENTRY(copyin, 3)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -427,15 +427,15 @@ ENTRY(copyout, 3)
;;
(p6) br.cond.spnt.few copyerr // if it's not, error out.
movl r14=copyerr // set up fault handler.
- add r15=GD_CURPROC,r13 // find curproc
+ add r15=GD_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
- add r15=P_ADDR,r15 // find pcb
+ add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
- add loc2=U_PCB_ONFAULT,r15
+ add loc2=PCB_ONFAULT,r15
;;
st8 [loc2]=r14
;;
@@ -453,11 +453,11 @@ END(copyout)
ENTRY(copyerr, 0)
- add r14=GD_CURPROC,r13 ;; // find curproc
+ add r14=GD_CURTHREAD,r13 ;; // find curthread
ld8 r14=[r14] ;;
- add r14=P_ADDR,r14 ;; // curproc->p_addr
+ add r14=TD_PCB,r14 ;; // curthread->td_addr
ld8 r14=[r14] ;;
- add r14=U_PCB_ONFAULT,r14 ;; // &curproc->p_addr->u_pcb.pcb_onfault
+ add r14=PCB_ONFAULT,r14 ;; // &curthread->td_pcb->pcb_onfault
st8 [r14]=r0 // reset fault handler
mov ret0=EFAULT // return EFAULT
diff --git a/sys/ia64/ia64/swtch.s b/sys/ia64/ia64/swtch.s
index 10f568e3db6b..e26cdb27c2d1 100644
--- a/sys/ia64/ia64/swtch.s
+++ b/sys/ia64/ia64/swtch.s
@@ -105,7 +105,7 @@ ENTRY(savectx, 1)
ENTRY(restorectx, 1)
- add r3=U_PCB_UNAT,in0 // point at NaT for r4..r7
+ add r3=PCB_UNAT,in0 // point at NaT for r4..r7
mov ar.rsc=0 ;; // switch off the RSE
ld8 r16=[r3] // load NaT for r4..r7
;;
@@ -158,9 +158,9 @@ ENTRY(restorectx, 1)
ENTRY(cpu_switch, 0)
- add r16=GD_CURPROC,r13 ;;
+ add r16=GD_CURTHREAD,r13 ;;
ld8 r17=[r16] ;;
- add r17=P_ADDR,r17 ;;
+ add r17=TD_PCB,r17 ;;
ld8 r17=[r17]
flushrs // push out caller's dirty regs
@@ -209,18 +209,18 @@ ENTRY(cpu_switch, 0)
mov ar.rsc=3 // turn RSE back on
- br.call.sptk.few rp=chooseproc
+ br.call.sptk.few rp=choosethread
- add r14=GD_CURPROC,r13 ;;
+ add r14=GD_CURTHREAD,r13 ;;
ld8 r15=[r14] ;;
#if 0
- cmp.ne p6,p0=r15,ret0 // chooseproc() == curproc ?
+ cmp.ne p6,p0=r15,ret0 // chooseproc() == curthread ?
(p6) br.dptk.few 1f
;;
- add r17=P_ADDR,r15 ;; // restore b0
+ add r17=TD_PCB,r15 ;; // restore b0
ld8 r17=[r17] ;;
- add r17=U_PCB_B0,r17 ;;
+ add r17=PCB_B0,r17 ;;
ld8 r17=[r17] ;;
mov b0=r17
@@ -228,7 +228,7 @@ ENTRY(cpu_switch, 0)
#endif
1:
- st8 [r14]=ret0 // set r13->gd_curproc
+ st8 [r14]=ret0 // set r13->gd_curthread
mov ar.k7=ret0
mov r4=ret0 // save from call
;;
@@ -237,12 +237,13 @@ ENTRY(cpu_switch, 0)
mov out0=r4
br.call.sptk.few rp=pmap_activate // install RIDs etc.
- add r15=P_ADDR,r4 ;;
- ld8 r15=[r15] ;;
- add r16=SIZEOF_USER,r15 ;;
+ add r15=TD_PCB,r4
+ add r16=TD_KSTACK,r4 ;;
+ ld8 r15=[r15]
+ ld8 r16=[r16] ;;
mov ar.k5=r16
- add r3=U_PCB_UNAT,r15 // point at NaT for r4..r7
+ add r3=PCB_UNAT,r15 // point at NaT for r4..r7
mov ar.rsc=0 ;; // switch off the RSE
ld8 r16=[r3] // load NaT for r4..r7
;;
diff --git a/sys/ia64/ia64/sys_machdep.c b/sys/ia64/ia64/sys_machdep.c
index 84e7620c8fc5..097dc02501f6 100644
--- a/sys/ia64/ia64/sys_machdep.c
+++ b/sys/ia64/ia64/sys_machdep.c
@@ -64,8 +64,8 @@ struct sysarch_args {
#endif
int
-sysarch(p, uap)
- struct proc *p;
+sysarch(td, uap)
+ struct thread *td;
register struct sysarch_args *uap;
{
int error = 0;
diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c
index 9baf9e17602a..c21cdf4bb1dd 100644
--- a/sys/ia64/ia64/trap.c
+++ b/sys/ia64/ia64/trap.c
@@ -69,7 +69,7 @@
#include <ddb/ddb.h>
#endif
-static int unaligned_fixup(struct trapframe *framep, struct proc *p);
+static int unaligned_fixup(struct trapframe *framep, struct thread *td);
#ifdef WITNESS
extern char *syscallnames[];
@@ -160,10 +160,10 @@ printtrap(int vector, int imm, struct trapframe *framep, int isfatal, int user)
printf(" cr.isr = 0x%lx\n", framep->tf_cr_isr);
printf(" cr.ifa = 0x%lx\n", framep->tf_cr_ifa);
printf(" cr.iim = 0x%x\n", imm);
- printf(" curproc = %p\n", curproc);
- if (curproc != NULL)
- printf(" pid = %d, comm = %s\n", curproc->p_pid,
- curproc->p_comm);
+ printf(" curthread = %p\n", curthread);
+ if (curthread != NULL)
+ printf(" pid = %d, comm = %s\n",
+ curthread->td_proc->p_pid, curthread->td_proc->p_comm);
printf("\n");
}
@@ -177,6 +177,7 @@ printtrap(int vector, int imm, struct trapframe *framep, int isfatal, int user)
void
trap(int vector, int imm, struct trapframe *framep)
{
+ struct thread *td;
struct proc *p;
int i;
u_int64_t ucode;
@@ -184,13 +185,14 @@ trap(int vector, int imm, struct trapframe *framep)
int user;
cnt.v_trap++;
- p = curproc;
+ td = curthread;
+ p = td->td_proc;
ucode = 0;
user = ((framep->tf_cr_ipsr & IA64_PSR_CPL) == IA64_PSR_CPL_USER);
if (user) {
- sticks = p->p_sticks;
- p->p_frame = framep;
+ sticks = td->td_kse->ke_sticks;
+ td->td_frame = framep;
} else {
sticks = 0; /* XXX bogus -Wuninitialized warning */
}
@@ -204,7 +206,7 @@ trap(int vector, int imm, struct trapframe *framep)
*/
if (user) {
mtx_lock(&Giant);
- if ((i = unaligned_fixup(framep, p)) == 0) {
+ if ((i = unaligned_fixup(framep, td)) == 0) {
mtx_unlock(&Giant);
goto out;
}
@@ -246,15 +248,15 @@ trap(int vector, int imm, struct trapframe *framep)
case IA64_VEC_DISABLED_FP:
/*
- * on exit from the kernel, if proc == fpcurproc,
+ * on exit from the kernel, if thread == fpcurthread,
* FP is enabled.
*/
- if (PCPU_GET(fpcurproc) == p) {
- printf("trap: fp disabled for fpcurproc == %p", p);
+ if (PCPU_GET(fpcurthread) == td) {
+ printf("trap: fp disabled for fpcurthread == %p", td);
goto dopanic;
}
- ia64_fpstate_switch(p);
+ ia64_fpstate_switch(td);
goto out;
break;
@@ -276,12 +278,11 @@ trap(int vector, int imm, struct trapframe *framep)
* when they are running.
*/
if (!user &&
- p != NULL &&
- p->p_addr->u_pcb.pcb_onfault ==
- (unsigned long)fswintrberr &&
- p->p_addr->u_pcb.pcb_accessaddr == va) {
- framep->tf_cr_iip = p->p_addr->u_pcb.pcb_onfault;
- p->p_addr->u_pcb.pcb_onfault = 0;
+ td != NULL &&
+ td->td_pcb->pcb_onfault == (unsigned long)fswintrberr &&
+ td->td_pcb->pcb_accessaddr == va) {
+ framep->tf_cr_iip = td->td_pcb->pcb_onfault;
+ td->td_pcb->pcb_onfault = 0;
goto out;
}
mtx_lock(&Giant);
@@ -301,8 +302,8 @@ trap(int vector, int imm, struct trapframe *framep)
*/
if (!user
&& ((va >= VM_MIN_KERNEL_ADDRESS)
- || (p == NULL)
- || (p->p_addr->u_pcb.pcb_onfault == 0))) {
+ || (td == NULL)
+ || (td->td_pcb->pcb_onfault == 0))) {
if (va >= trunc_page(PS_STRINGS
- szsigcode
- SPARE_USRSPACE)
@@ -405,7 +406,7 @@ trap(int vector, int imm, struct trapframe *framep)
trapsignal(p, i, ucode);
out:
if (user)
- userret(p, framep, sticks);
+ userret(td, framep, sticks);
if (mtx_owned(&Giant))
mtx_unlock(&Giant);
return;
@@ -439,15 +440,18 @@ void
syscall(int code, u_int64_t *args, struct trapframe *framep)
{
struct sysent *callp;
+ struct thread *td;
struct proc *p;
int error = 0;
u_int64_t oldip, oldri;
u_int sticks;
cnt.v_syscall++;
- p = curproc;
- p->p_frame = framep;
- sticks = p->p_sticks;
+ td = curthread;
+ p = td->td_proc;
+
+ td->td_frame = framep;
+ sticks = td->td_kse->ke_sticks;
mtx_lock(&Giant);
/*
@@ -463,7 +467,7 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
}
#ifdef DIAGNOSTIC
- ia64_fpstate_check(p);
+ ia64_fpstate_check(td);
#endif
if (p->p_sysent->sv_prepsyscall) {
@@ -496,19 +500,19 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
ktrsyscall(p->p_tracep, code, (callp->sy_narg & SYF_ARGMASK), args);
#endif
if (error == 0) {
- p->p_retval[0] = 0;
- p->p_retval[1] = 0;
+ td->td_retval[0] = 0;
+ td->td_retval[1] = 0;
STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK));
- error = (*callp->sy_call)(p, args);
+ error = (*callp->sy_call)(td, args);
}
switch (error) {
case 0:
- framep->tf_r[FRAME_R8] = p->p_retval[0];
- framep->tf_r[FRAME_R9] = p->p_retval[1];
+ framep->tf_r[FRAME_R8] = td->td_retval[0];
+ framep->tf_r[FRAME_R9] = td->td_retval[1];
framep->tf_r[FRAME_R10] = 0;
break;
case ERESTART:
@@ -530,10 +534,10 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
break;
}
- userret(p, framep, sticks);
+ userret(td, framep, sticks);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p->p_tracep, code, error, p->p_retval[0]);
+ ktrsysret(p->p_tracep, code, error, td->td_retval[0]);
#endif
mtx_unlock(&Giant);
@@ -545,7 +549,7 @@ syscall(int code, u_int64_t *args, struct trapframe *framep)
STOPEVENT(p, S_SCX, code);
#ifdef WITNESS
- if (witness_list(p)) {
+ if (witness_list(td)) {
panic("system call %s returning with mutex(s) held\n",
syscallnames[code]);
}
@@ -558,21 +562,25 @@ extern int ia64_unaligned_print, ia64_unaligned_fix;
extern int ia64_unaligned_sigbus;
static int
-unaligned_fixup(struct trapframe *framep, struct proc *p)
+unaligned_fixup(struct trapframe *framep, struct thread *td)
{
vm_offset_t va = framep->tf_cr_ifa;
int doprint, dofix, dosigbus;
int signal, size = 0;
unsigned long uac;
+ struct proc *p;
/*
* Figure out what actions to take.
*/
- if (p)
- uac = p->p_md.md_flags & MDP_UAC_MASK;
- else
+ if (td) {
+ uac = td->td_md.md_flags & MDP_UAC_MASK;
+ p = td->td_proc;
+ } else {
uac = 0;
+ p = NULL;
+ }
doprint = ia64_unaligned_print && !(uac & MDP_UAC_NOPRINT);
dofix = ia64_unaligned_fix && !(uac & MDP_UAC_NOFIX);
@@ -593,7 +601,7 @@ unaligned_fixup(struct trapframe *framep, struct proc *p)
*/
if (doprint) {
uprintf("pid %d (%s): unaligned access: va=0x%lx pc=0x%lx\n",
- p->p_pid, p->p_comm, va, p->p_frame->tf_cr_iip);
+ p->p_pid, p->p_comm, va, td->td_frame->tf_cr_iip);
}
/*
diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c
index 3774212e68b6..492b8ec7c75a 100644
--- a/sys/ia64/ia64/vm_machdep.c
+++ b/sys/ia64/ia64/vm_machdep.c
@@ -124,25 +124,30 @@ struct ia64_fdesc {
* ready to run and return to user mode.
*/
void
-cpu_fork(p1, p2, flags)
- register struct proc *p1, *p2;
+cpu_fork(td1, p2, flags)
+ register struct thread *td1;
+ register struct proc *p2;
int flags;
{
- struct user *up;
+ struct proc *p1;
+ struct thread *td2;
struct trapframe *p2tf;
u_int64_t bspstore, *p1bs, *p2bs, rnatloc, rnat;
if ((flags & RFPROC) == 0)
return;
- p2->p_frame = p1->p_frame;
- p2->p_md.md_flags = p1->p_md.md_flags & (MDP_FPUSED | MDP_UAC_MASK);
+ p1 = td1->td_proc;
+ td2 = &p2->p_thread;
+ td2->td_pcb = (struct pcb *)
+ (td2->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
+ td2->td_md.md_flags = td1->td_md.md_flags & (MDP_FPUSED | MDP_UAC_MASK);
/*
* Copy floating point state from the FP chip to the PCB
* if this process has state stored there.
*/
- ia64_fpstate_save(p1, 0);
+ ia64_fpstate_save(td1, 0);
/*
* Copy pcb and stack from proc p1 to p2. We do this as
@@ -150,15 +155,15 @@ cpu_fork(p1, p2, flags)
* stack. The stack and pcb need to agree. Make sure that the
* new process has FEN disabled.
*/
- p2->p_addr->u_pcb = p1->p_addr->u_pcb;
+ bcopy(td1->td_pcb, td2->td_pcb, sizeof(struct pcb));
/*
* Set the floating point state.
*/
#if 0
- if ((p2->p_addr->u_pcb.pcb_fp_control & IEEE_INHERIT) == 0) {
- p2->p_addr->u_pcb.pcb_fp_control = 0;
- p2->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL
+ if ((td2->td_pcb->pcb_fp_control & IEEE_INHERIT) == 0) {
+ td2->td_pcb->pcb_fp_control = 0;
+ td2->td_pcb->pcb_fp.fpr_cr = (FPCR_DYN_NORMAL
| FPCR_INVD | FPCR_DZED
| FPCR_OVFD | FPCR_INED
| FPCR_UNFD);
@@ -170,9 +175,9 @@ cpu_fork(p1, p2, flags)
* is started, to resume here, returning nonzero from setjmp.
*/
#ifdef DIAGNOSTIC
- if (p1 != curproc)
+ if (td1 != curthread)
panic("cpu_fork: curproc");
- ia64_fpstate_check(p1);
+ ia64_fpstate_check(td1);
#endif
/*
@@ -182,25 +187,24 @@ cpu_fork(p1, p2, flags)
* copy trapframe from parent so return to user mode
* will be to right address, with correct registers.
*/
- p2->p_frame = (struct trapframe *)
- ((char *)p2->p_addr + USPACE - sizeof(struct trapframe));
- bcopy(p1->p_frame, p2->p_frame, sizeof(struct trapframe));
+ td2->td_frame = (struct trapframe *)td2->td_pcb - 1;
+ bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe));
/*
* Set up return-value registers as fork() libc stub expects.
*/
- p2tf = p2->p_frame;
+ p2tf = td2->td_frame;
p2tf->tf_r[FRAME_R8] = 0; /* child's pid (linux) */
p2tf->tf_r[FRAME_R9] = 1; /* is child (FreeBSD) */
p2tf->tf_r[FRAME_R10] = 0; /* no error */
/*
* Turn off RSE for a moment and work out our current
- * ar.bspstore. This assumes that p1==curproc. Also
+ * ar.bspstore. This assumes that td1==curthread. Also
* flush dirty regs to ensure that the user's stacked
* regs are written out to backing store.
*
- * We could cope with p1!=curproc by digging values
+ * We could cope with td1!=curthread by digging values
* out of its PCB but I don't see the point since
* current usage never allows it.
*/
@@ -208,23 +212,23 @@ cpu_fork(p1, p2, flags)
__asm __volatile("flushrs;;" ::: "memory");
__asm __volatile("mov %0=ar.bspstore" : "=r"(bspstore));
- p1bs = (u_int64_t *) (p1->p_addr + 1);
- p2bs = (u_int64_t *) (p2->p_addr + 1);
+ p1bs = (u_int64_t *)td1->td_kstack;
+ p2bs = (u_int64_t *)td2->td_kstack;
/*
- * Copy enough of p1's backing store to include all
+ * Copy enough of td1's backing store to include all
* the user's stacked regs.
*/
- bcopy(p1bs, p2bs, p1->p_frame->tf_ndirty);
+ bcopy(p1bs, p2bs, td1->td_frame->tf_ndirty);
/*
- * To calculate the ar.rnat for p2, we need to decide
- * if p1's ar.bspstore has advanced past the place
+ * To calculate the ar.rnat for td2, we need to decide
+ * if td1's ar.bspstore has advanced past the place
* where the last ar.rnat which covers the user's
* saved registers would be placed. If so, we read
- * that one from memory, otherwise we take p1's
+ * that one from memory, otherwise we take td1's
* current ar.rnat.
*/
- rnatloc = (u_int64_t)p1bs + p1->p_frame->tf_ndirty;
+ rnatloc = (u_int64_t)p1bs + td1->td_frame->tf_ndirty;
rnatloc |= 0x1f8;
if (bspstore > rnatloc)
rnat = *(u_int64_t *) rnatloc;
@@ -242,21 +246,22 @@ cpu_fork(p1, p2, flags)
* should work since the child will normally return
* straight into exception_restore.
*/
- up = p2->p_addr;
- up->u_pcb.pcb_bspstore = (u_int64_t)p2bs + p1->p_frame->tf_ndirty;
- up->u_pcb.pcb_rnat = rnat;
- up->u_pcb.pcb_pfs = 0;
+ td2->td_pcb->pcb_bspstore = (u_int64_t)p2bs + td1->td_frame->tf_ndirty;
+ td2->td_pcb->pcb_rnat = rnat;
+ td2->td_pcb->pcb_pfs = 0;
/*
* Arrange for continuation at fork_return(), which
* will return to exception_restore(). Note that the
* child process doesn't stay in the kernel for long!
+ *
+ * XXX what is this +/- 16 stuff here?
*/
- up->u_pcb.pcb_sp = (u_int64_t)p2tf - 16;
- up->u_pcb.pcb_r4 = (u_int64_t)fork_return;
- up->u_pcb.pcb_r5 = FDESC_FUNC(exception_restore);
- up->u_pcb.pcb_r6 = (u_int64_t)p2;
- up->u_pcb.pcb_b0 = FDESC_FUNC(fork_trampoline);
+ td2->td_pcb->pcb_sp = (u_int64_t)p2tf - 16;
+ td2->td_pcb->pcb_r4 = (u_int64_t)fork_return;
+ td2->td_pcb->pcb_r5 = FDESC_FUNC(exception_restore);
+ td2->td_pcb->pcb_r6 = (u_int64_t)td2;
+ td2->td_pcb->pcb_b0 = FDESC_FUNC(fork_trampoline);
}
/*
@@ -266,13 +271,13 @@ cpu_fork(p1, p2, flags)
* This is needed to make kernel threads stay in kernel mode.
*/
void
-cpu_set_fork_handler(p, func, arg)
- struct proc *p;
+cpu_set_fork_handler(td, func, arg)
+ struct thread *td;
void (*func) __P((void *));
void *arg;
{
- p->p_addr->u_pcb.pcb_r4 = (u_int64_t) func;
- p->p_addr->u_pcb.pcb_r6 = (u_int64_t) arg;
+ td->td_pcb->pcb_r4 = (u_int64_t) func;
+ td->td_pcb->pcb_r6 = (u_int64_t) arg;
}
/*
@@ -281,11 +286,11 @@ cpu_set_fork_handler(p, func, arg)
* When the proc is reaped, cpu_wait() will gc the VM state.
*/
void
-cpu_exit(p)
- register struct proc *p;
+cpu_exit(td)
+ register struct thread *td;
{
- ia64_fpstate_drop(p);
+ ia64_fpstate_drop(td);
}
void
@@ -307,14 +312,22 @@ cpu_throw(void)
* Dump the machine specific header information at the start of a core dump.
*/
int
-cpu_coredump(p, vp, cred)
- struct proc *p;
+cpu_coredump(td, vp, cred)
+ struct thread *td;
struct vnode *vp;
struct ucred *cred;
{
-
- return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, ctob(UPAGES),
- (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, p));
+ int error;
+
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t) td->td_proc->p_uarea,
+ ctob(UAREA_PAGES), (off_t)0,
+ UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, td);
+ if (error)
+ return error;
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t) td->td_kstack,
+ ctob(KSTACK_PAGES), (off_t)0,
+ UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, td);
+ return error;
}
/*