summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/db_interface.c27
-rw-r--r--sys/alpha/alpha/db_trace.c11
-rw-r--r--sys/alpha/alpha/exception.s18
-rw-r--r--sys/alpha/alpha/fp_emulate.c16
-rw-r--r--sys/alpha/alpha/genassym.c24
-rw-r--r--sys/alpha/alpha/interrupt.c16
-rw-r--r--sys/alpha/alpha/locore.s12
-rw-r--r--sys/alpha/alpha/machdep.c303
-rw-r--r--sys/alpha/alpha/mem.c12
-rw-r--r--sys/alpha/alpha/mp_machdep.c8
-rw-r--r--sys/alpha/alpha/pmap.c235
-rw-r--r--sys/alpha/alpha/procfs_machdep.c38
-rw-r--r--sys/alpha/alpha/prom.c4
-rw-r--r--sys/alpha/alpha/promcons.c16
-rw-r--r--sys/alpha/alpha/support.s92
-rw-r--r--sys/alpha/alpha/swtch.s98
-rw-r--r--sys/alpha/alpha/sys_machdep.c56
-rw-r--r--sys/alpha/alpha/trap.c150
-rw-r--r--sys/alpha/alpha/vm_machdep.c92
-rw-r--r--sys/alpha/include/cpu.h14
-rw-r--r--sys/alpha/include/fpu.h2
-rw-r--r--sys/alpha/include/globaldata.h18
-rw-r--r--sys/alpha/include/globals.h8
-rw-r--r--sys/alpha/include/md_var.h10
-rw-r--r--sys/alpha/include/mutex.h2
-rw-r--r--sys/alpha/include/param.h6
-rw-r--r--sys/alpha/include/pcpu.h18
-rw-r--r--sys/alpha/include/pmap.h6
-rw-r--r--sys/alpha/include/proc.h5
-rw-r--r--sys/alpha/include/ptrace.h2
-rw-r--r--sys/alpha/include/reg.h2
-rw-r--r--sys/alpha/include/vmparam.h2
-rw-r--r--sys/alpha/linux/linux_proto.h278
-rw-r--r--sys/alpha/tlsb/zs_tlsb.c10
34 files changed, 913 insertions, 698 deletions
diff --git a/sys/alpha/alpha/db_interface.c b/sys/alpha/alpha/db_interface.c
index 6a566e3..49463c7 100644
--- a/sys/alpha/alpha/db_interface.c
+++ b/sys/alpha/alpha/db_interface.c
@@ -592,23 +592,26 @@ DB_SHOW_COMMAND(pcpu, db_show_pcpu)
db_printf("cpuid = %d\n", gd->gd_cpuid);
db_printf("ipis = %lx\n", gd->gd_pending_ipis);
db_printf("next ASN = %d\n", gd->gd_next_asn);
- db_printf("curproc = ");
- if (gd->gd_curproc != NULL)
- db_printf("%p: pid %d \"%s\"\n", gd->gd_curproc,
- gd->gd_curproc->p_pid, gd->gd_curproc->p_comm);
+ db_printf("curthread = ");
+ if (gd->gd_curthread != NULL)
+ db_printf("%p: pid %d \"%s\"\n", gd->gd_curthread,
+ gd->gd_curthread->td_proc->p_pid,
+ gd->gd_curthread->td_proc->p_comm);
else
db_printf("none\n");
db_printf("curpcb = %p\n", gd->gd_curpcb);
- db_printf("fpcurproc = ");
- if (gd->gd_fpcurproc != NULL)
- db_printf("%p: pid %d \"%s\"\n", gd->gd_fpcurproc,
- gd->gd_fpcurproc->p_pid, gd->gd_fpcurproc->p_comm);
+ db_printf("fpcurthread = ");
+ if (gd->gd_fpcurthread != NULL)
+ db_printf("%p: pid %d \"%s\"\n", gd->gd_fpcurthread,
+ gd->gd_fpcurthread->td_proc->p_pid,
+ gd->gd_fpcurthread->td_proc->p_comm);
else
db_printf("none\n");
- db_printf("idleproc = ");
- if (gd->gd_idleproc != NULL)
- db_printf("%p: pid %d \"%s\"\n", gd->gd_idleproc,
- gd->gd_idleproc->p_pid, gd->gd_idleproc->p_comm);
+ db_printf("idlethread = ");
+ if (gd->gd_idlethread != NULL)
+ db_printf("%p: pid %d \"%s\"\n", gd->gd_idlethread,
+ gd->gd_idlethread->td_proc->p_pid,
+ gd->gd_idlethread->td_proc->p_comm);
else
db_printf("none\n");
diff --git a/sys/alpha/alpha/db_trace.c b/sys/alpha/alpha/db_trace.c
index c743926..f99e5a0 100644
--- a/sys/alpha/alpha/db_trace.c
+++ b/sys/alpha/alpha/db_trace.c
@@ -212,6 +212,7 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *m
boolean_t ra_from_pcb;
u_long last_ipl = ~0L;
struct proc *p = NULL;
+ struct thread *td = NULL;
boolean_t have_trapframe = FALSE;
pid_t pid;
@@ -219,7 +220,8 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *m
count = 65535;
if (!have_addr) {
- p = curproc;
+ td = curthread;
+ p = td->td_proc;
addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8;
tf = (struct trapframe *)addr;
have_trapframe = 1;
@@ -231,8 +233,9 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *m
* The pcb for curproc is not valid at this point,
* so fall back to the default case.
*/
- if (pid == curproc->p_pid) {
- p = curproc;
+ if (pid == curthread->td_proc->p_pid) {
+ td = curthread;
+ p = td->td_proc;
addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8;
tf = (struct trapframe *)addr;
have_trapframe = 1;
@@ -251,7 +254,7 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *m
db_printf("pid %d swapped out\n", pid);
return;
}
- pcbp = &p->p_addr->u_pcb;
+ pcbp = p->p_thread.td_pcb; /* XXXKSE */
addr = (db_expr_t)pcbp->pcb_hw.apcb_ksp;
callpc = pcbp->pcb_context[7];
frame = addr;
diff --git a/sys/alpha/alpha/exception.s b/sys/alpha/alpha/exception.s
index c7119b0..31637b4 100644
--- a/sys/alpha/alpha/exception.s
+++ b/sys/alpha/alpha/exception.s
@@ -139,17 +139,17 @@
beq t1, exception_return
/* set the hae register if this process has specified a value */
- ldq s0, GD_CURPROC(globalp)
- ldq t1, P_MD_FLAGS(s0)
+ ldq s0, GD_CURTHREAD(globalp)
+ ldq t1, TD_MD_FLAGS(s0)
and t1, MDP_HAEUSED
beq t1, 3f
- ldq a0, P_MD_HAE(s0)
+ ldq a0, TD_MD_HAE(s0)
ldq pv, chipset + CHIPSET_WRITE_HAE
CALL((pv))
3:
#ifdef SMP
/* leave the kernel */
- stl zero, P_MD_KERNNEST(s0)
+ stl zero, TD_MD_KERNNEST(s0)
#endif
/* restore the registers, and return */
@@ -255,9 +255,9 @@ LEAF(exception_return, 1) /* XXX should be NESTED */
br pv, Ler1
Ler1: LDGP(pv)
- ldq s0, GD_CURPROC(globalp) /* save curproc in s0 */
+ ldq s0, GD_CURTHREAD(globalp) /* save curthread in s0 */
#ifdef SMP
- ldl s1, P_MD_KERNNEST(s0)
+ ldl s1, TD_MD_KERNNEST(s0)
subl s1, 1, s1 /* decrement nesting level */
#endif
@@ -280,16 +280,16 @@ Lkernelret:
Lrestoreregs:
/* set the hae register if this process has specified a value */
- ldq t1, P_MD_FLAGS(s0)
+ ldq t1, TD_MD_FLAGS(s0)
and t1, MDP_HAEUSED
beq t1, Lnohae
- ldq a0, P_MD_HAE(t0)
+ ldq a0, TD_MD_HAE(t0)
ldq pv, chipset + CHIPSET_WRITE_HAE
CALL((pv))
Lnohae:
#ifdef SMP
/* leave the kernel */
- stl s1, P_MD_KERNNEST(s0)
+ stl s1, TD_MD_KERNNEST(s0)
#endif
/* restore the registers, and return */
diff --git a/sys/alpha/alpha/fp_emulate.c b/sys/alpha/alpha/fp_emulate.c
index 20f64d6..bf5eef7 100644
--- a/sys/alpha/alpha/fp_emulate.c
+++ b/sys/alpha/alpha/fp_emulate.c
@@ -221,10 +221,10 @@ static fp_register_t fp_cvtql(union alpha_instruction ins,
return ret;
}
-static int fp_emulate(union alpha_instruction ins, struct proc *p)
+static int fp_emulate(union alpha_instruction ins, struct thread *td)
{
- u_int64_t control = p->p_addr->u_pcb.pcb_fp_control;
- struct fpreg *fpregs = &p->p_addr->u_pcb.pcb_fp;
+ u_int64_t control = td->td_pcb->pcb_fp_control;
+ struct fpreg *fpregs = &td->td_pcb->pcb_fp;
static fp_opcode_handler *ops[16] = {
fp_add, /* 0 */
fp_sub, /* 1 */
@@ -261,7 +261,7 @@ static int fp_emulate(union alpha_instruction ins, struct proc *p)
* them. We are potentially going to modify the fp state, so
* cancel fpcurproc too.
*/
- alpha_fpstate_save(p, 1);
+ alpha_fpstate_save(td, 1);
/*
* Decode and execute the instruction.
@@ -288,7 +288,7 @@ static int fp_emulate(union alpha_instruction ins, struct proc *p)
/* Record the exception in the software control word. */
control |= (status >> IEEE_STATUS_TO_FPCR_SHIFT);
- p->p_addr->u_pcb.pcb_fp_control = control;
+ td->td_pcb->pcb_fp_control = control;
/* Regenerate the control register */
fpcr = fpregs->fpr_cr & FPCR_DYN_MASK;
@@ -323,9 +323,9 @@ static int fp_emulate(union alpha_instruction ins, struct proc *p)
* emulating it in software. Return non-zero if the completion was
* successful, otherwise zero.
*/
-int fp_software_completion(u_int64_t regmask, struct proc *p)
+int fp_software_completion(u_int64_t regmask, struct thread *td)
{
- struct trapframe *frame = p->p_frame;
+ struct trapframe *frame = td->td_frame;
u_int64_t pc = frame->tf_regs[FRAME_PC];
int error;
@@ -394,7 +394,7 @@ int fp_software_completion(u_int64_t regmask, struct proc *p)
* instructions in the trap shadow, so this
* must be the one which generated the trap.
*/
- if (fp_emulate(ins, p)) {
+ if (fp_emulate(ins, td)) {
/*
* Restore pc to the first instruction
* in the trap shadow.
diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c
index 03990ea..d520b52 100644
--- a/sys/alpha/alpha/genassym.c
+++ b/sys/alpha/alpha/genassym.c
@@ -68,8 +68,8 @@
#include <nfs/nfs.h>
#include <nfs/nfsdiskless.h>
-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));
@@ -80,12 +80,15 @@ 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(P_MD_PCBPADDR, offsetof(struct proc, p_md.md_pcbpaddr));
-ASSYM(P_MD_HAE, offsetof(struct proc, p_md.md_hae));
+ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
+ASSYM(TD_KSE, offsetof(struct thread, td_kse));
+ASSYM(TD_PROC, offsetof(struct thread, td_proc));
+
+ASSYM(TD_MD_FLAGS, offsetof(struct thread, td_md.md_flags));
+ASSYM(TD_MD_PCBPADDR, offsetof(struct thread, td_md.md_pcbpaddr));
+ASSYM(TD_MD_HAE, offsetof(struct thread, td_md.md_hae));
#ifdef SMP
-ASSYM(P_MD_KERNNEST, offsetof(struct proc, p_md.md_kernnest));
+ASSYM(TD_MD_KERNNEST, offsetof(struct thread, td_md.md_kernnest));
#endif
ASSYM(MDP_HAEUSED, MDP_HAEUSED);
@@ -95,10 +98,9 @@ ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
ASSYM(PTLEV1I, PTLEV1I);
ASSYM(PTESIZE, PTESIZE);
-ASSYM(U_PCB_ONFAULT, offsetof(struct user, u_pcb.pcb_onfault));
-ASSYM(U_PCB_HWPCB_KSP, offsetof(struct user, u_pcb.pcb_hw.apcb_ksp));
-ASSYM(U_PCB_CONTEXT, offsetof(struct user, u_pcb.pcb_context));
-
+ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
+ASSYM(PCB_HWPCB_KSP, offsetof(struct pcb, pcb_hw.apcb_ksp));
+ASSYM(PCB_CONTEXT, offsetof(struct pcb, pcb_context));
ASSYM(PCB_HW, offsetof(struct pcb, pcb_hw));
ASSYM(FPREG_FPR_REGS, offsetof(struct fpreg, fpr_regs));
diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c
index 489c948..0bdd6c5 100644
--- a/sys/alpha/alpha/interrupt.c
+++ b/sys/alpha/alpha/interrupt.c
@@ -90,7 +90,7 @@ interrupt(a0, a1, a2, framep)
unsigned long a0, a1, a2;
struct trapframe *framep;
{
- struct proc *p;
+ struct thread *td;
#ifdef SMP
critical_t s;
#endif
@@ -102,19 +102,21 @@ interrupt(a0, a1, a2, framep)
s = critical_enter();
#endif
globalp = (struct globaldata *) alpha_pal_rdval();
- p = curproc;
+ td = curthread;
#ifdef SMP
- p->p_md.md_kernnest++;
+ td->td_md.md_kernnest++;
critical_exit(s);
#endif
- atomic_add_int(&p->p_intr_nesting_level, 1);
+ atomic_add_int(&td->td_intr_nesting_level, 1);
+#ifndef KSTACK_GUARD
#ifndef SMP
{
- if ((caddr_t) framep < (caddr_t) p->p_addr + 1024) {
+ if ((caddr_t) framep < (caddr_t) td->td_pcb + 1024) {
panic("possible stack overflow\n");
}
}
#endif
+#endif
framep->tf_regs[FRAME_TRAPARG_A0] = a0;
framep->tf_regs[FRAME_TRAPARG_A1] = a1;
@@ -161,7 +163,7 @@ interrupt(a0, a1, a2, framep)
a0, a1, a2);
/* NOTREACHED */
}
- atomic_subtract_int(&p->p_intr_nesting_level, 1);
+ atomic_subtract_int(&td->td_intr_nesting_level, 1);
}
void
@@ -472,7 +474,7 @@ alpha_clock_interrupt(struct trapframe *framep)
#ifdef SMP
} else {
mtx_lock_spin(&sched_lock);
- hardclock_process(curproc, TRAPF_USERMODE(framep));
+ hardclock_process(curthread, TRAPF_USERMODE(framep));
if ((schedclk2 & 0x7) == 0)
statclock_process(curproc, TRAPF_PC(framep),
TRAPF_USERMODE(framep));
diff --git a/sys/alpha/alpha/locore.s b/sys/alpha/alpha/locore.s
index f054408..adb481f 100644
--- a/sys/alpha/alpha/locore.s
+++ b/sys/alpha/alpha/locore.s
@@ -114,10 +114,10 @@
mov v0, globalp
/*
- * Switch to proc0's PCB, which is at U_PCB off of proc0paddr.
+ * Switch to proc0's PCB.
*/
- lda t0,proc0 /* get phys addr of pcb */
- ldq a0,P_MD_PCBPADDR(t0)
+ ldq t0,thread0 /* get phys addr of pcb */
+ ldq a0,TD_MD_PCBPADDR(t0)
SWITCH_CONTEXT
/*
@@ -308,12 +308,6 @@ LEAF(restorefpstate, 1)
RET
END(restorefpstate)
- .data
- EXPORT(proc0paddr)
- .quad 0
-
- .text
-
/* XXX: make systat/vmstat happy */
.data
EXPORT(intrnames)
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 04aa677..10754d3 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -156,7 +156,8 @@ struct bootinfo_kernel bootinfo;
struct mtx sched_lock;
struct mtx Giant;
-struct user *proc0paddr;
+struct user *proc0uarea;
+vm_offset_t proc0kstack;
char machine[] = "alpha";
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
@@ -887,23 +888,30 @@ alpha_init(pfn, ptb, bim, bip, biv)
}
+ proc_linkup(&proc0);
/*
* Init mapping for u page(s) for proc 0
*/
- proc0.p_addr = proc0paddr =
- (struct user *)pmap_steal_memory(UPAGES * PAGE_SIZE);
+ proc0uarea = (struct user *)pmap_steal_memory(UAREA_PAGES * PAGE_SIZE);
+ proc0kstack = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE);
+ 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, alpha_pal_whami(), sz);
alpha_pal_wrval((u_int64_t) globalp);
PCPU_GET(next_asn) = 1; /* 0 used for proc0 pmap */
#ifdef SMP
- proc0.p_md.md_kernnest = 1;
+ thread0->td_md.md_kernnest = 1;
#endif
}
@@ -921,28 +929,26 @@ alpha_init(pfn, ptb, bim, bip, biv)
* Initialize the rest of proc 0's PCB, and cache its physical
* address.
*/
- proc0.p_md.md_pcbpaddr =
- (struct pcb *)ALPHA_K0SEG_TO_PHYS((vm_offset_t)&proc0paddr->u_pcb);
+ thread0->td_md.md_pcbpaddr =
+ (struct pcb *)ALPHA_K0SEG_TO_PHYS((vm_offset_t)thread0->td_pcb);
/*
* Set the kernel sp, reserving space for an (empty) trapframe,
* and make proc0's trapframe pointer point to it for sanity.
*/
- proc0paddr->u_pcb.pcb_hw.apcb_ksp =
- (u_int64_t)proc0paddr + USPACE - sizeof(struct trapframe);
- proc0.p_frame =
- (struct trapframe *)proc0paddr->u_pcb.pcb_hw.apcb_ksp;
+ thread0->td_frame = (struct trapframe *)thread0->td_pcb - 1;
+ thread0->td_pcb->pcb_hw.apcb_ksp = (u_int64_t)thread0->td_frame;
/*
* Get the right value for the boot cpu's idle ptbr.
*/
- globalp->gd_idlepcb.apcb_ptbr = proc0.p_addr->u_pcb.pcb_hw.apcb_ptbr;
+ globalp->gd_idlepcb.apcb_ptbr = thread0->td_pcb->pcb_hw.apcb_ptbr;
- /* Setup curproc so that mutexes work */
- PCPU_SET(curproc, &proc0);
+ /* Setup curthread so that mutexes work */
+ PCPU_SET(curthread, thread0);
PCPU_SET(spinlocks, NULL);
- LIST_INIT(&proc0.p_contested);
+ LIST_INIT(&thread0->td_contested);
/*
* Initialise mutexes.
@@ -1175,13 +1181,16 @@ DELAY(int n)
void
osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
- struct proc *p = curproc;
+ struct proc *p;
+ struct thread *td;
osiginfo_t *sip, ksi;
struct trapframe *frame;
struct sigacts *psp;
int oonstack, fsize, rndfsize;
- frame = p->p_frame;
+ td = curthread;
+ p = td->td_proc;
+ frame = td->td_frame;
oonstack = sigonstack(alpha_pal_rdusp());
fsize = sizeof ksi;
rndfsize = ((fsize + 15) / 16) * 16;
@@ -1230,16 +1239,16 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
ksi.si_sc.sc_ps = frame->tf_regs[FRAME_PS];
/* copy the registers. */
- fill_regs(p, (struct reg *)ksi.si_sc.sc_regs);
+ fill_regs(td, (struct reg *)ksi.si_sc.sc_regs);
ksi.si_sc.sc_regs[R_ZERO] = 0xACEDBADE; /* magic number */
ksi.si_sc.sc_regs[R_SP] = alpha_pal_rdusp();
/* save the floating-point state, if necessary, then copy it. */
- alpha_fpstate_save(p, 1); /* XXX maybe write=0 */
- ksi.si_sc.sc_ownedfp = p->p_md.md_flags & MDP_FPUSED;
- bcopy(&p->p_addr->u_pcb.pcb_fp, (struct fpreg *)ksi.si_sc.sc_fpregs,
+ alpha_fpstate_save(td, 1); /* XXX maybe write=0 */
+ ksi.si_sc.sc_ownedfp = td->td_md.md_flags & MDP_FPUSED;
+ bcopy(&td->td_pcb->pcb_fp, (struct fpreg *)ksi.si_sc.sc_fpregs,
sizeof(struct fpreg));
- ksi.si_sc.sc_fp_control = p->p_addr->u_pcb.pcb_fp_control;
+ ksi.si_sc.sc_fp_control = td->td_pcb->pcb_fp_control;
bzero(ksi.si_sc.sc_reserved, sizeof ksi.si_sc.sc_reserved); /* XXX */
ksi.si_sc.sc_xxx1[0] = 0; /* XXX */
ksi.si_sc.sc_xxx1[1] = 0; /* XXX */
@@ -1279,12 +1288,15 @@ osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
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;
int oonstack, rndfsize;
+ td = curthread;
+ p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
#ifdef COMPAT_43
@@ -1294,7 +1306,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
}
#endif
- frame = p->p_frame;
+ frame = td->td_frame;
oonstack = sigonstack(alpha_pal_rdusp());
rndfsize = ((sizeof(sf) + 15) / 16) * 16;
@@ -1306,7 +1318,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
- fill_regs(p, (struct reg *)sf.sf_uc.uc_mcontext.mc_regs);
+ fill_regs(td, (struct reg *)sf.sf_uc.uc_mcontext.mc_regs);
sf.sf_uc.uc_mcontext.mc_regs[R_SP] = alpha_pal_rdusp();
sf.sf_uc.uc_mcontext.mc_regs[R_ZERO] = 0xACEDBADE; /* magic number */
sf.sf_uc.uc_mcontext.mc_regs[R_PS] = frame->tf_regs[FRAME_PS];
@@ -1362,12 +1374,12 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
}
/* save the floating-point state, if necessary, then copy it. */
- alpha_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,
+ alpha_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;
#ifdef COMPAT_OSF1
/*
@@ -1428,12 +1440,13 @@ 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)
{
struct osigcontext *scp, ksc;
+ struct proc *p = td->td_proc;
scp = uap->sigcntxp;
@@ -1470,25 +1483,25 @@ osigreturn(struct proc *p,
SIG_CANTMASK(p->p_sigmask);
PROC_UNLOCK(p);
- set_regs(p, (struct reg *)ksc.sc_regs);
- p->p_frame->tf_regs[FRAME_PC] = ksc.sc_pc;
- p->p_frame->tf_regs[FRAME_PS] =
+ set_regs(td, (struct reg *)ksc.sc_regs);
+ td->td_frame->tf_regs[FRAME_PC] = ksc.sc_pc;
+ td->td_frame->tf_regs[FRAME_PS] =
(ksc.sc_ps | ALPHA_PSL_USERSET) & ~ALPHA_PSL_USERCLR;
- p->p_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
+ td->td_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
alpha_pal_wrusp(ksc.sc_regs[R_SP]);
/* XXX ksc.sc_ownedfp ? */
- alpha_fpstate_drop(p);
- bcopy((struct fpreg *)ksc.sc_fpregs, &p->p_addr->u_pcb.pcb_fp,
+ alpha_fpstate_drop(td);
+ bcopy((struct fpreg *)ksc.sc_fpregs, &td->td_pcb->pcb_fp,
sizeof(struct fpreg));
- p->p_addr->u_pcb.pcb_fp_control = ksc.sc_fp_control;
+ td->td_pcb->pcb_fp_control = ksc.sc_fp_control;
return (EJUSTRETURN);
}
#endif
int
-sigreturn(struct proc *p,
+sigreturn(struct thread *td,
struct sigreturn_args /* {
ucontext_t *sigcntxp;
} */ *uap)
@@ -1496,14 +1509,16 @@ sigreturn(struct proc *p,
ucontext_t uc, *ucp;
struct pcb *pcb;
unsigned long val;
+ struct proc *p;
#ifdef COMPAT_43
if (((struct osigcontext*)uap->sigcntxp)->sc_regs[R_ZERO] == 0xACEDBADE)
- return osigreturn(p, (struct osigreturn_args *)uap);
+ return osigreturn(td, (struct osigreturn_args *)uap);
#endif
ucp = uap->sigcntxp;
- pcb = &p->p_addr->u_pcb;
+ pcb = td->td_pcb;
+ p = td->td_proc;
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
@@ -1519,12 +1534,12 @@ sigreturn(struct proc *p,
/*
* Restore the user-supplied information
*/
- set_regs(p, (struct reg *)uc.uc_mcontext.mc_regs);
+ set_regs(td, (struct reg *)uc.uc_mcontext.mc_regs);
val = (uc.uc_mcontext.mc_regs[R_PS] | ALPHA_PSL_USERSET) &
~ALPHA_PSL_USERCLR;
- p->p_frame->tf_regs[FRAME_PS] = val;
- p->p_frame->tf_regs[FRAME_PC] = uc.uc_mcontext.mc_regs[R_PC];
- p->p_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
+ td->td_frame->tf_regs[FRAME_PS] = val;
+ td->td_frame->tf_regs[FRAME_PC] = uc.uc_mcontext.mc_regs[R_PC];
+ td->td_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */
alpha_pal_wrusp(uc.uc_mcontext.mc_regs[R_SP]);
PROC_LOCK(p);
@@ -1540,10 +1555,10 @@ sigreturn(struct proc *p,
PROC_UNLOCK(p);
/* XXX ksc.sc_ownedfp ? */
- alpha_fpstate_drop(p);
+ alpha_fpstate_drop(td);
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;
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
@@ -1576,14 +1591,14 @@ 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 *tfp = p->p_frame;
+ struct trapframe *tfp = td->td_frame;
bzero(tfp->tf_regs, FRAME_SIZE * sizeof tfp->tf_regs[0]);
- bzero(&p->p_addr->u_pcb.pcb_fp, sizeof p->p_addr->u_pcb.pcb_fp);
- p->p_addr->u_pcb.pcb_fp_control = 0;
- p->p_addr->u_pcb.pcb_fp.fpr_cr = (FPCR_DYN_NORMAL
+ bzero(&td->td_pcb->pcb_fp, sizeof td->td_pcb->pcb_fp);
+ td->td_pcb->pcb_fp_control = 0;
+ td->td_pcb->pcb_fp.fpr_cr = (FPCR_DYN_NORMAL
| FPCR_INVD | FPCR_DZED
| FPCR_OVFD | FPCR_INED
| FPCR_UNFD);
@@ -1599,20 +1614,20 @@ setregs(struct proc *p, u_long entry, u_long stack, u_long ps_strings)
tfp->tf_regs[FRAME_T12] = tfp->tf_regs[FRAME_PC]; /* a.k.a. PV */
tfp->tf_regs[FRAME_FLAGS] = 0; /* full restore */
- p->p_md.md_flags &= ~MDP_FPUSED;
- alpha_fpstate_drop(p);
+ td->td_md.md_flags &= ~MDP_FPUSED;
+ alpha_fpstate_drop(td);
}
int
-ptrace_set_pc(struct proc *p, unsigned long addr)
+ptrace_set_pc(struct thread *td, unsigned long addr)
{
- struct trapframe *tp = p->p_frame;
+ struct trapframe *tp = td->td_frame;
tp->tf_regs[FRAME_PC] = addr;
return 0;
}
static int
-ptrace_read_int(struct proc *p, vm_offset_t addr, u_int32_t *v)
+ptrace_read_int(struct thread *td, vm_offset_t addr, u_int32_t *v)
{
struct iovec iov;
struct uio uio;
@@ -1624,12 +1639,12 @@ ptrace_read_int(struct proc *p, vm_offset_t addr, u_int32_t *v)
uio.uio_resid = sizeof(u_int32_t);
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
- uio.uio_procp = p;
- return procfs_domem(curproc, p, NULL, &uio);
+ uio.uio_td = td;
+ return procfs_domem(curproc, td->td_proc, NULL, &uio);
}
static int
-ptrace_write_int(struct proc *p, vm_offset_t addr, u_int32_t v)
+ptrace_write_int(struct thread *td, vm_offset_t addr, u_int32_t v)
{
struct iovec iov;
struct uio uio;
@@ -1641,12 +1656,12 @@ ptrace_write_int(struct proc *p, vm_offset_t addr, u_int32_t v)
uio.uio_resid = sizeof(u_int32_t);
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_WRITE;
- uio.uio_procp = p;
- return procfs_domem(curproc, p, NULL, &uio);
+ uio.uio_td = td;
+ return procfs_domem(curproc, td->td_proc, NULL, &uio);
}
static u_int64_t
-ptrace_read_register(struct proc *p, int regno)
+ptrace_read_register(struct thread *td, int regno)
{
static int reg_to_frame[32] = {
FRAME_V0,
@@ -1689,54 +1704,54 @@ ptrace_read_register(struct proc *p, int regno)
if (regno == R_ZERO)
return 0;
- return p->p_frame->tf_regs[reg_to_frame[regno]];
+ return td->td_frame->tf_regs[reg_to_frame[regno]];
}
static int
-ptrace_clear_bpt(struct proc *p, struct mdbpt *bpt)
+ptrace_clear_bpt(struct thread *td, struct mdbpt *bpt)
{
- return ptrace_write_int(p, bpt->addr, bpt->contents);
+ return ptrace_write_int(td, bpt->addr, bpt->contents);
}
static int
-ptrace_set_bpt(struct proc *p, struct mdbpt *bpt)
+ptrace_set_bpt(struct thread *td, struct mdbpt *bpt)
{
int error;
u_int32_t bpins = 0x00000080;
- error = ptrace_read_int(p, bpt->addr, &bpt->contents);
+ error = ptrace_read_int(td, bpt->addr, &bpt->contents);
if (error)
return error;
- return ptrace_write_int(p, bpt->addr, bpins);
+ return ptrace_write_int(td, bpt->addr, bpins);
}
int
-ptrace_clear_single_step(struct proc *p)
+ptrace_clear_single_step(struct thread *td)
{
- if (p->p_md.md_flags & MDP_STEP2) {
- ptrace_clear_bpt(p, &p->p_md.md_sstep[1]);
- ptrace_clear_bpt(p, &p->p_md.md_sstep[0]);
- p->p_md.md_flags &= ~MDP_STEP2;
- } else if (p->p_md.md_flags & MDP_STEP1) {
- ptrace_clear_bpt(p, &p->p_md.md_sstep[0]);
- p->p_md.md_flags &= ~MDP_STEP1;
+ if (td->td_md.md_flags & MDP_STEP2) {
+ ptrace_clear_bpt(td, &td->td_md.md_sstep[1]);
+ ptrace_clear_bpt(td, &td->td_md.md_sstep[0]);
+ td->td_md.md_flags &= ~MDP_STEP2;
+ } else if (td->td_md.md_flags & MDP_STEP1) {
+ ptrace_clear_bpt(td, &td->td_md.md_sstep[0]);
+ td->td_md.md_flags &= ~MDP_STEP1;
}
return 0;
}
int
-ptrace_single_step(struct proc *p)
+ptrace_single_step(struct thread *td)
{
int error;
- vm_offset_t pc = p->p_frame->tf_regs[FRAME_PC];
+ vm_offset_t pc = td->td_frame->tf_regs[FRAME_PC];
alpha_instruction ins;
vm_offset_t addr[2]; /* places to set breakpoints */
int count = 0; /* count of breakpoints */
- if (p->p_md.md_flags & (MDP_STEP1|MDP_STEP2))
+ if (td->td_md.md_flags & (MDP_STEP1|MDP_STEP2))
panic("ptrace_single_step: step breakpoints not removed");
- error = ptrace_read_int(p, pc, &ins.bits);
+ error = ptrace_read_int(td, pc, &ins.bits);
if (error)
return error;
@@ -1744,7 +1759,7 @@ ptrace_single_step(struct proc *p)
case op_j:
/* Jump: target is register value */
- addr[0] = ptrace_read_register(p, ins.jump_format.rs) & ~3;
+ addr[0] = ptrace_read_register(td, ins.jump_format.rs) & ~3;
count = 1;
break;
@@ -1775,20 +1790,20 @@ ptrace_single_step(struct proc *p)
count = 1;
}
- p->p_md.md_sstep[0].addr = addr[0];
- error = ptrace_set_bpt(p, &p->p_md.md_sstep[0]);
+ td->td_md.md_sstep[0].addr = addr[0];
+ error = ptrace_set_bpt(td, &td->td_md.md_sstep[0]);
if (error)
return error;
if (count == 2) {
- p->p_md.md_sstep[1].addr = addr[1];
- error = ptrace_set_bpt(p, &p->p_md.md_sstep[1]);
+ td->td_md.md_sstep[1].addr = addr[1];
+ error = ptrace_set_bpt(td, &td->td_md.md_sstep[1]);
if (error) {
- ptrace_clear_bpt(p, &p->p_md.md_sstep[0]);
+ ptrace_clear_bpt(td, &td->td_md.md_sstep[0]);
return error;
}
- p->p_md.md_flags |= MDP_STEP2;
+ td->td_md.md_flags |= MDP_STEP2;
} else
- p->p_md.md_flags |= MDP_STEP1;
+ td->td_md.md_flags |= MDP_STEP1;
return 0;
}
@@ -1812,15 +1827,13 @@ alpha_pa_access(vm_offset_t pa)
}
int
-fill_regs(p, regs)
- struct proc *p;
+fill_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
- struct pcb *pcb = &p->p_addr->u_pcb;
- struct trapframe *tp = p->p_frame;
+ struct pcb *pcb = td->td_pcb;
+ struct trapframe *tp = td->td_frame;
- tp = p->p_frame;
-
#define C(r) regs->r_regs[R_ ## r] = tp->tf_regs[FRAME_ ## r]
C(V0);
@@ -1839,14 +1852,12 @@ fill_regs(p, regs)
}
int
-set_regs(p, regs)
- struct proc *p;
+set_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
- struct pcb *pcb = &p->p_addr->u_pcb;
- struct trapframe *tp = p->p_frame;
-
- tp = p->p_frame;
+ struct pcb *pcb = td->td_pcb;
+ struct trapframe *tp = td->td_frame;
#define C(r) tp->tf_regs[FRAME_ ## r] = regs->r_regs[R_ ## r]
@@ -1866,24 +1877,24 @@ set_regs(p, regs)
}
int
-fill_fpregs(p, fpregs)
- struct proc *p;
+fill_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
- alpha_fpstate_save(p, 0);
+ alpha_fpstate_save(td, 0);
- bcopy(&p->p_addr->u_pcb.pcb_fp, fpregs, sizeof *fpregs);
+ bcopy(&td->td_pcb->pcb_fp, fpregs, sizeof *fpregs);
return (0);
}
int
-set_fpregs(p, fpregs)
- struct proc *p;
+set_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
- alpha_fpstate_drop(p);
+ alpha_fpstate_drop(td);
- bcopy(fpregs, &p->p_addr->u_pcb.pcb_fp, sizeof *fpregs);
+ bcopy(fpregs, &td->td_pcb->pcb_fp, sizeof *fpregs);
return (0);
}
@@ -1976,27 +1987,27 @@ SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
CTLFLAG_RW, &wall_cmos_clock, 0, "");
void
-alpha_fpstate_check(struct proc *p)
+alpha_fpstate_check(struct thread *td)
{
/*
- * For SMP, we should check the fpcurproc of each cpu.
+ * For SMP, we should check the fpcurthread of each cpu.
*/
#ifndef SMP
critical_t s;
s = critical_enter();
- if (p->p_addr->u_pcb.pcb_hw.apcb_flags & ALPHA_PCB_FLAGS_FEN)
- if (p != PCPU_GET(fpcurproc))
- panic("alpha_check_fpcurproc: bogus");
+ if (td->td_pcb->pcb_hw.apcb_flags & ALPHA_PCB_FLAGS_FEN)
+ if (td != PCPU_GET(fpcurthread))
+ panic("alpha_check_fpcurthread: bogus");
critical_exit(s);
#endif
}
-#define SET_FEN(p) \
- (p)->p_addr->u_pcb.pcb_hw.apcb_flags |= ALPHA_PCB_FLAGS_FEN
+#define SET_FEN(td) \
+ (td)->td_pcb->pcb_hw.apcb_flags |= ALPHA_PCB_FLAGS_FEN
-#define CLEAR_FEN(p) \
- (p)->p_addr->u_pcb.pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN
+#define CLEAR_FEN(td) \
+ (td)->td_pcb->pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN
/*
* Save the floating point state in the pcb. Use this to get read-only
@@ -2006,14 +2017,14 @@ alpha_fpstate_check(struct proc *p)
* FEN trap.
*/
void
-alpha_fpstate_save(struct proc *p, int write)
+alpha_fpstate_save(struct thread *td, int write)
{
critical_t s;
s = critical_enter();
- if (p != NULL && p == PCPU_GET(fpcurproc)) {
+ if (td != NULL && td == PCPU_GET(fpcurthread)) {
/*
- * If curproc != fpcurproc, then we need to enable FEN
+ * If curthread != fpcurthread, then we need to enable FEN
* so that we can dump the fp state.
*/
alpha_pal_wrfen(1);
@@ -2021,27 +2032,27 @@ alpha_fpstate_save(struct proc *p, int write)
/*
* Save the state in the pcb.
*/
- savefpstate(&p->p_addr->u_pcb.pcb_fp);
+ savefpstate(&td->td_pcb->pcb_fp);
if (write) {
/*
- * If fpcurproc == curproc, just ask the
+ * If fpcurthread == curthread, just ask the
* PALcode to disable FEN, otherwise we must
- * clear the FEN bit in fpcurproc's pcb.
+ * clear the FEN bit in fpcurthread's pcb.
*/
- if (PCPU_GET(fpcurproc) == curproc)
+ if (PCPU_GET(fpcurthread) == curthread)
alpha_pal_wrfen(0);
else
- CLEAR_FEN(PCPU_GET(fpcurproc));
- PCPU_SET(fpcurproc, NULL);
+ CLEAR_FEN(PCPU_GET(fpcurthread));
+ PCPU_SET(fpcurthread, NULL);
} else {
/*
* Make sure that we leave FEN enabled if
- * curproc == fpcurproc. We must have at most
+ * curthread == fpcurthread. We must have at most
* one process with FEN enabled. Note that FEN
- * must already be set in fpcurproc's pcb.
+ * must already be set in fpcurthread's pcb.
*/
- if (curproc != PCPU_GET(fpcurproc))
+ if (curthread != PCPU_GET(fpcurthread))
alpha_pal_wrfen(0);
}
}
@@ -2054,13 +2065,13 @@ alpha_fpstate_save(struct proc *p, int write)
* (e.g. on sigreturn).
*/
void
-alpha_fpstate_drop(struct proc *p)
+alpha_fpstate_drop(struct thread *td)
{
critical_t s;
s = critical_enter();
- if (p == PCPU_GET(fpcurproc)) {
- if (p == curproc) {
+ if (td == PCPU_GET(fpcurthread)) {
+ if (td == curthread) {
/*
* Disable FEN via the PALcode. This will
* clear the bit in the pcb as well.
@@ -2070,9 +2081,9 @@ alpha_fpstate_drop(struct proc *p)
/*
* Clear the FEN bit of the pcb.
*/
- CLEAR_FEN(p);
+ CLEAR_FEN(td);
}
- PCPU_SET(fpcurproc, NULL);
+ PCPU_SET(fpcurthread, NULL);
}
critical_exit(s);
}
@@ -2082,7 +2093,7 @@ alpha_fpstate_drop(struct proc *p)
* from the pcb.
*/
void
-alpha_fpstate_switch(struct proc *p)
+alpha_fpstate_switch(struct thread *td)
{
critical_t s;
@@ -2091,31 +2102,31 @@ alpha_fpstate_switch(struct proc *p)
*/
s = critical_enter();
alpha_pal_wrfen(1);
- if (PCPU_GET(fpcurproc)) {
+ if (PCPU_GET(fpcurthread)) {
/*
* Dump the old fp state if its valid.
*/
- savefpstate(&PCPU_GET(fpcurproc)->p_addr->u_pcb.pcb_fp);
- CLEAR_FEN(PCPU_GET(fpcurproc));
+ savefpstate(&PCPU_GET(fpcurthread)->td_pcb->pcb_fp);
+ CLEAR_FEN(PCPU_GET(fpcurthread));
}
/*
* Remember the new FP owner and reload its state.
*/
- PCPU_SET(fpcurproc, p);
- restorefpstate(&PCPU_GET(fpcurproc)->p_addr->u_pcb.pcb_fp);
+ PCPU_SET(fpcurthread, td);
+ restorefpstate(&PCPU_GET(fpcurthread)->td_pcb->pcb_fp);
/*
- * If the new owner is curproc, leave FEN enabled, otherwise
+ * If the new owner is curthread, leave FEN enabled, otherwise
* mark its PCB so that it gets FEN when we context switch to
* it later.
*/
- if (p != curproc) {
+ if (td != curthread) {
alpha_pal_wrfen(0);
- SET_FEN(p);
+ SET_FEN(td);
}
- p->p_md.md_flags |= MDP_FPUSED;
+ td->td_md.md_flags |= MDP_FPUSED;
critical_exit(s);
}
@@ -2129,7 +2140,7 @@ globaldata_init(struct globaldata *globaldata, int cpuid, size_t sz)
globaldata->gd_idlepcbphys = vtophys((vm_offset_t) &globaldata->gd_idlepcb);
globaldata->gd_idlepcb.apcb_ksp = (u_int64_t)
((caddr_t) globaldata + sz - sizeof(struct trapframe));
- globaldata->gd_idlepcb.apcb_ptbr = proc0.p_addr->u_pcb.pcb_hw.apcb_ptbr;
+ globaldata->gd_idlepcb.apcb_ptbr = thread0->td_pcb->pcb_hw.apcb_ptbr;
globaldata->gd_cpuid = cpuid;
globaldata->gd_next_asn = 0;
globaldata->gd_current_asngen = 1;
diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c
index 6af53c4..13bbeb1 100644
--- a/sys/alpha/alpha/mem.c
+++ b/sys/alpha/alpha/mem.c
@@ -100,12 +100,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;
@@ -114,7 +114,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)) {
@@ -125,7 +125,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
@@ -240,12 +240,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/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c
index 7ae77d5..d1324e7 100644
--- a/sys/alpha/alpha/mp_machdep.c
+++ b/sys/alpha/alpha/mp_machdep.c
@@ -158,7 +158,7 @@ smp_init_secondary(void)
* Set curproc to our per-cpu idleproc so that mutexes have
* something unique to lock with.
*/
- PCPU_SET(curproc, PCPU_GET(idleproc));
+ PCPU_SET(curthread, PCPU_GET(idlethread));
PCPU_SET(spinlocks, NULL);
/*
@@ -175,12 +175,12 @@ smp_init_secondary(void)
*
* cache idleproc's physical address.
*/
- curproc->p_md.md_pcbpaddr = (struct pcb *)PCPU_GET(idlepcbphys);
+ curthread->td_md.md_pcbpaddr = (struct pcb *)PCPU_GET(idlepcbphys);
/*
* and make idleproc's trapframe pointer point to its
* stack pointer for sanity.
*/
- curproc->p_frame =
+ curthread->td_frame =
(struct trapframe *)globalp->gd_idlepcb.apcb_ksp;
mtx_lock_spin(&ap_boot_mtx);
@@ -232,7 +232,7 @@ smp_start_secondary(int cpuid)
if (bootverbose)
printf("smp_start_secondary: starting cpu %d\n", cpuid);
- sz = round_page(UPAGES * PAGE_SIZE);
+ sz = round_page((UAREA_PAGES + KSTACK_PAGES) * PAGE_SIZE);
globaldata = malloc(sz, M_TEMP, M_NOWAIT);
if (!globaldata) {
printf("smp_start_secondary: can't allocate memory\n");
diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c
index eed5e5e..c03d3dd 100644
--- a/sys/alpha/alpha/pmap.c
+++ b/sys/alpha/alpha/pmap.c
@@ -337,7 +337,7 @@ static pmap_t pmap_active[MAXCPU];
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;
@@ -564,9 +564,9 @@ pmap_bootstrap(vm_offset_t ptaddr, u_int maxasn)
* Set up proc0's PCB such that the ptbr points to the right place
* and has the kernel pmap's.
*/
- proc0.p_addr->u_pcb.pcb_hw.apcb_ptbr =
+ thread0->td_pcb->pcb_hw.apcb_ptbr =
ALPHA_K0SEG_TO_PHYS((vm_offset_t)Lev1map) >> PAGE_SHIFT;
- proc0.p_addr->u_pcb.pcb_hw.apcb_asn = 0;
+ thread0->td_pcb->pcb_hw.apcb_asn = 0;
}
int
@@ -934,22 +934,22 @@ pmap_new_proc(struct proc *p)
*/
upobj = p->p_upages_obj;
if (upobj == NULL) {
- upobj = vm_object_allocate(OBJT_DEFAULT, UPAGES);
+ upobj = vm_object_allocate(OBJT_DEFAULT, UAREA_PAGES);
p->p_upages_obj = upobj;
}
/* get a kernel virtual address for the UPAGES for this proc */
- up = (vm_offset_t)p->p_addr;
+ up = (vm_offset_t)p->p_uarea;
if (up == 0) {
- up = kmem_alloc_nofault(kernel_map, UPAGES * PAGE_SIZE);
+ up = kmem_alloc_nofault(kernel_map, UAREA_PAGES * PAGE_SIZE);
if (up == 0)
panic("pmap_new_proc: upage allocation failed");
- p->p_addr = (struct user *)up;
+ p->p_uarea = (struct user *)up;
}
ptek = vtopte(up);
- for (i = 0; i < UPAGES; i++) {
+ for (i = 0; i < UAREA_PAGES; i++) {
/*
* Get a kernel stack page
*/
@@ -992,9 +992,9 @@ pmap_dispose_proc(p)
pt_entry_t *ptek, oldpte;
upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
+ up = (vm_offset_t)p->p_uarea;
ptek = vtopte(up);
- for (i = 0; i < UPAGES; i++) {
+ for (i = 0; i < UAREA_PAGES; i++) {
m = vm_page_lookup(upobj, i);
if (m == NULL)
panic("pmap_dispose_proc: upage already missing?");
@@ -1019,14 +1019,9 @@ pmap_swapout_proc(p)
vm_offset_t up;
vm_page_t m;
- /*
- * Make sure we aren't fpcurproc.
- */
- alpha_fpstate_save(p, 1);
-
upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
- for (i = 0; i < UPAGES; i++) {
+ up = (vm_offset_t)p->p_uarea;
+ for (i = 0; i < UAREA_PAGES; i++) {
m = vm_page_lookup(upobj, i);
if (m == NULL)
panic("pmap_swapout_proc: upage already missing?");
@@ -1049,8 +1044,8 @@ pmap_swapin_proc(p)
vm_page_t m;
upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
- for (i = 0; i < UPAGES; i++) {
+ up = (vm_offset_t)p->p_uarea;
+ for (i = 0; i < UAREA_PAGES; 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) {
@@ -1064,12 +1059,180 @@ pmap_swapin_proc(p)
vm_page_wakeup(m);
vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE);
}
+}
+
+/*
+ * Create the kernel stack for a new thread.
+ * This routine directly affects the fork perf for a process and thread.
+ */
+void
+pmap_new_thread(struct thread *td)
+{
+ int i;
+ vm_object_t ksobj;
+ vm_offset_t ks;
+ vm_page_t m;
+ pt_entry_t *ptek, oldpte;
+
+ /*
+ * allocate object for the upages
+ */
+ ksobj = td->td_kstack_obj;
+ if (ksobj == NULL) {
+ ksobj = vm_object_allocate(OBJT_DEFAULT, KSTACK_PAGES);
+ td->td_kstack_obj = ksobj;
+ }
+
+#ifdef KSTACK_GUARD
+ /* get a kernel virtual address for the kstack for this thread */
+ ks = td->td_kstack;
+ if (ks == 0) {
+ ks = kmem_alloc_nofault(kernel_map,
+ (KSTACK_PAGES + 1) * PAGE_SIZE);
+ if (ks == NULL)
+ panic("pmap_new_thread: kstack allocation failed");
+ ks += PAGE_SIZE;
+ td->td_kstack = ks;
+ }
+
+ ptek = vtopte(ks - PAGE_SIZE);
+ oldpte = *ptek;
+ *ptek = 0;
+ if (oldpte)
+ pmap_invalidate_page(kernel_pmap, ks - PAGE_SIZE);
+ ptek++;
+#else
+ /* get a kernel virtual address for the kstack for this thread */
+ ks = td->td_kstack;
+ if (ks == 0) {
+ ks = kmem_alloc_nofault(kernel_map, KSTACK_PAGES * PAGE_SIZE);
+ if (ks == NULL)
+ panic("pmap_new_thread: kstack allocation failed");
+ td->td_kstack = ks;
+ }
+ ptek = vtopte(ks);
+#endif
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ /*
+ * Get a kernel stack page
+ */
+ m = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
+
+ /*
+ * Wire the page
+ */
+ m->wire_count++;
+ cnt.v_wire_count++;
+
+ oldpte = *(ptek + i);
+ /*
+ * Enter the page into the kernel address space.
+ */
+ *(ptek + i) = pmap_phys_to_pte(VM_PAGE_TO_PHYS(m))
+ | PG_ASM | PG_KRE | PG_KWE | PG_V;
+ if (oldpte)
+ pmap_invalidate_page(kernel_pmap, ks + i * PAGE_SIZE);
+
+ vm_page_wakeup(m);
+ vm_page_flag_clear(m, PG_ZERO);
+ vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE);
+ m->valid = VM_PAGE_BITS_ALL;
+ }
+}
+
+/*
+ * Dispose the kernel stack for a thread that has exited.
+ * This routine directly impacts the exit perf of a thread.
+ */
+void
+pmap_dispose_thread(td)
+ struct thread *td;
+{
+ int i;
+ vm_object_t ksobj;
+ vm_offset_t ks;
+ vm_page_t m;
+ pt_entry_t *ptek, oldpte;
+
+ ksobj = td->td_kstack_obj;
+ ks = td->td_kstack;
+ ptek = vtopte(ks);
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ m = vm_page_lookup(ksobj, i);
+ if (m == NULL)
+ panic("pmap_dispose_thread: kstack already missing?");
+ vm_page_busy(m);
+ oldpte = *(ptek + i);
+ *(ptek + i) = 0;
+ pmap_invalidate_page(kernel_pmap, ks + i * PAGE_SIZE);
+ vm_page_unwire(m, 0);
+ vm_page_free(m);
+ }
+}
+
+/*
+ * Allow the kernel stack for a thread to be prejudicially paged out.
+ */
+void
+pmap_swapout_thread(td)
+ struct thread *td;
+{
+ int i;
+ vm_object_t ksobj;
+ vm_offset_t ks;
+ vm_page_t m;
+
+ /*
+ * Make sure we aren't fpcurthread.
+ */
+ alpha_fpstate_save(td, 1);
+
+ ksobj = td->td_kstack_obj;
+ ks = td->td_kstack;
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ m = vm_page_lookup(ksobj, i);
+ if (m == NULL)
+ panic("pmap_swapout_thread: kstack already missing?");
+ vm_page_dirty(m);
+ vm_page_unwire(m, 0);
+ pmap_kremove(ks + i * PAGE_SIZE);
+ }
+}
+
+/*
+ * Bring the kernel stack for a specified thread back in.
+ */
+void
+pmap_swapin_thread(td)
+ struct thread *td;
+{
+ int i, rv;
+ vm_object_t ksobj;
+ vm_offset_t ks;
+ vm_page_t m;
+
+ ksobj = td->td_kstack_obj;
+ ks = td->td_kstack;
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ m = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
+ pmap_kenter(ks + i * PAGE_SIZE, VM_PAGE_TO_PHYS(m));
+ if (m->valid != VM_PAGE_BITS_ALL) {
+ rv = vm_pager_get_pages(ksobj, &m, 1, 0);
+ if (rv != VM_PAGER_OK)
+ panic("pmap_swapin_thread: cannot get kstack for proc: %d\n", td->td_proc->p_pid);
+ m = vm_page_lookup(ksobj, i);
+ m->valid = VM_PAGE_BITS_ALL;
+ }
+ vm_page_wire(m);
+ vm_page_wakeup(m);
+ vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE);
+ }
/*
* The pcb may be at a different physical address now so cache the
* new address.
*/
- p->p_md.md_pcbpaddr = (void*)vtophys((vm_offset_t)&p->p_addr->u_pcb);
+ td->td_md.md_pcbpaddr = (void *)vtophys((vm_offset_t)td->td_pcb);
}
/***************************************************
@@ -1677,7 +1840,7 @@ pmap_collect()
{
int i;
vm_page_t m;
- static int warningdone=0;
+ static int warningdone = 0;
if (pmap_pagedaemon_waken == 0)
return;
@@ -2917,7 +3080,7 @@ pmap_clear_reference(vm_page_t m)
* From NetBSD
*/
void
-pmap_emulate_reference(struct proc *p, vm_offset_t v, int user, int write)
+pmap_emulate_reference(struct vmspace *vm, vm_offset_t v, int user, int write)
{
pt_entry_t faultoff, *pte;
vm_offset_t pa;
@@ -2932,9 +3095,8 @@ pmap_emulate_reference(struct proc *p, vm_offset_t v, int user, int write)
pte = vtopte(v);
user_addr = 0;
} else {
- KASSERT(p != NULL, ("pmap_emulate_reference: bad proc"));
- KASSERT(p->p_vmspace != NULL, ("pmap_emulate_reference: bad p_vmspace"));
- pte = pmap_lev3pte(p->p_vmspace->vm_map.pmap, v);
+ KASSERT(vm != NULL, ("pmap_emulate_reference: bad vmspace"));
+ pte = pmap_lev3pte(vm->vm_map.pmap, v);
user_addr = 1;
}
#ifdef DEBUG /* These checks are more expensive */
@@ -2964,7 +3126,7 @@ pmap_emulate_reference(struct proc *p, vm_offset_t v, int user, int write)
KASSERT((*pte & PG_MANAGED) != 0,
("pmap_emulate_reference(%p, 0x%lx, %d, %d): pa 0x%lx not managed",
- p, v, user, write, pa));
+ curthread, v, user, write, pa));
/*
* Twiddle the appropriate bits to reflect the reference
@@ -3092,11 +3254,11 @@ pmap_mincore(pmap, addr)
}
void
-pmap_activate(struct proc *p)
+pmap_activate(struct thread *td)
{
pmap_t pmap;
- pmap = vmspace_pmap(p->p_vmspace);
+ pmap = vmspace_pmap(td->td_proc->p_vmspace);
if (pmap_active[PCPU_GET(cpuid)] && pmap != pmap_active[PCPU_GET(cpuid)]) {
atomic_clear_32(&pmap_active[PCPU_GET(cpuid)]->pm_active,
@@ -3104,7 +3266,7 @@ pmap_activate(struct proc *p)
pmap_active[PCPU_GET(cpuid)] = 0;
}
- p->p_addr->u_pcb.pcb_hw.apcb_ptbr =
+ td->td_pcb->pcb_hw.apcb_ptbr =
ALPHA_K0SEG_TO_PHYS((vm_offset_t) pmap->pm_lev1) >> PAGE_SHIFT;
if (pmap->pm_asn[PCPU_GET(cpuid)].gen != PCPU_GET(current_asngen))
@@ -3113,18 +3275,19 @@ pmap_activate(struct proc *p)
pmap_active[PCPU_GET(cpuid)] = pmap;
atomic_set_32(&pmap->pm_active, 1 << PCPU_GET(cpuid));
- p->p_addr->u_pcb.pcb_hw.apcb_asn = pmap->pm_asn[PCPU_GET(cpuid)].asn;
+ td->td_pcb->pcb_hw.apcb_asn = pmap->pm_asn[PCPU_GET(cpuid)].asn;
- if (p == curproc) {
- alpha_pal_swpctx((u_long)p->p_md.md_pcbpaddr);
+ if (td == curthread) {
+ alpha_pal_swpctx((u_long)td->td_md.md_pcbpaddr);
}
}
void
-pmap_deactivate(struct proc *p)
+pmap_deactivate(struct thread *td)
{
pmap_t pmap;
- pmap = vmspace_pmap(p->p_vmspace);
+
+ pmap = vmspace_pmap(td->td_proc->p_vmspace);
atomic_clear_32(&pmap->pm_active, 1 << PCPU_GET(cpuid));
pmap_active[PCPU_GET(cpuid)] = 0;
}
@@ -3154,14 +3317,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/alpha/alpha/procfs_machdep.c b/sys/alpha/alpha/procfs_machdep.c
index 96fd0e5..ae7fa10 100644
--- a/sys/alpha/alpha/procfs_machdep.c
+++ b/sys/alpha/alpha/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/alpha/alpha/prom.c b/sys/alpha/alpha/prom.c
index 887f991..54d913a 100644
--- a/sys/alpha/alpha/prom.c
+++ b/sys/alpha/alpha/prom.c
@@ -315,8 +315,8 @@ hwrpb_restart_setup()
p = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off);
p->pcs_flags &= ~PCS_BIP;
- bcopy(&proc0.p_addr->u_pcb.pcb_hw, p->pcs_hwpcb,
- sizeof proc0.p_addr->u_pcb.pcb_hw);
+ bcopy(&thread0->td_pcb->pcb_hw, p->pcs_hwpcb,
+ sizeof thread0->td_pcb->pcb_hw);
hwrpb->rpb_vptb = VPTBASE;
/* when 'c'ontinuing from console halt, do a dump */
diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c
index fa0511d..e95d951 100644
--- a/sys/alpha/alpha/promcons.c
+++ b/sys/alpha/alpha/promcons.c
@@ -92,10 +92,10 @@ int promparam __P((struct tty *, struct termios *));
void promstop __P((struct tty *, int));
int
-promopen(dev, flag, mode, p)
+promopen(dev, flag, mode, td)
dev_t dev;
int flag, mode;
- struct proc *p;
+ struct thread *td;
{
struct tty *tp;
int unit = minor(dev);
@@ -124,7 +124,7 @@ promopen(dev, flag, mode, 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;
}
@@ -143,10 +143,10 @@ promopen(dev, flag, mode, p)
}
int
-promclose(dev, flag, mode, p)
+promclose(dev, flag, mode, td)
dev_t dev;
int flag, mode;
- struct proc *p;
+ struct thread *td;
{
int unit = minor(dev);
struct tty *tp = prom_tp;
@@ -161,12 +161,12 @@ promclose(dev, flag, mode, p)
}
int
-promioctl(dev, cmd, data, flag, p)
+promioctl(dev, cmd, data, flag, td)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
- struct proc *p;
+ struct thread *td;
{
int unit = minor(dev);
struct tty *tp = prom_tp;
@@ -175,7 +175,7 @@ promioctl(dev, cmd, data, flag, 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/alpha/alpha/support.s b/sys/alpha/alpha/support.s
index 6c42b81..61c692e 100644
--- a/sys/alpha/alpha/support.s
+++ b/sys/alpha/alpha/support.s
@@ -72,13 +72,13 @@
beq t1, fusufault
lda t0, fusufault /* trap faults */
- ldq t2, GD_CURPROC(globalp)
- ldq t2, P_ADDR(t2)
- stq t0, U_PCB_ONFAULT(t2)
+ ldq t2, GD_CURTHREAD(globalp)
+ ldq t2, TD_PCB(t2)
+ stq t0, PCB_ONFAULT(t2)
stq a1, 0(a0) /* try the store */
- stq zero, U_PCB_ONFAULT(t2) /* clean up */
+ stq zero, PCB_ONFAULT(t2) /* clean up */
mov zero, v0
RET
@@ -92,9 +92,9 @@
beq t1, fusufault
lda t0, fusufault /* trap faults */
- ldq t2, GD_CURPROC(globalp)
- ldq t2, P_ADDR(t2)
- stq t0, U_PCB_ONFAULT(t2)
+ ldq t2, GD_CURTHREAD(globalp)
+ ldq t2, TD_PCB(t2)
+ stq t0, PCB_ONFAULT(t2)
zap a1, 0xfe, a1 /* mask off the byte to store */
insbl a1, a0, a1 /* shift it to the right place */
@@ -103,7 +103,7 @@
or a1, t0, a1 /* move it in */
stq_u a1, 0(a0) /* and put the byte back */
- stq zero, U_PCB_ONFAULT(t2) /* clean up */
+ stq zero, PCB_ONFAULT(t2) /* clean up */
mov zero, v0
RET
@@ -117,13 +117,13 @@
beq t1, fusufault
lda t0, fusufault /* trap faults */
- ldq t2, GD_CURPROC(globalp)
- ldq t2, P_ADDR(t2)
- stq t0, U_PCB_ONFAULT(t2)
+ ldq t2, GD_CURTHREAD(globalp)
+ ldq t2, TD_PCB(t2)
+ stq t0, PCB_ONFAULT(t2)
ldq v0, 0(a0) /* try the fetch */
- stq zero, U_PCB_ONFAULT(t2) /* clean up */
+ stq zero, PCB_ONFAULT(t2) /* clean up */
RET
END(fuword)
@@ -136,14 +136,14 @@
beq t1, fusufault
lda t0, fusufault /* trap faults */
- ldq t2, GD_CURPROC(globalp)
- ldq t2, P_ADDR(t2)
- stq t0, U_PCB_ONFAULT(t2)
+ ldq t2, GD_CURTHREAD(globalp)
+ ldq t2, TD_PCB(t2)
+ stq t0, PCB_ONFAULT(t2)
ldq_u v0, 0(a0) /* get the word containing our byte */
extbl v0, a0, v0 /* extract the byte */
- stq zero, U_PCB_ONFAULT(t2) /* clean up */
+ stq zero, PCB_ONFAULT(t2) /* clean up */
RET
END(fubyte)
@@ -154,9 +154,9 @@
END(suibyte)
LEAF(fusufault, 0)
- ldq t0, GD_CURPROC(globalp)
- ldq t0, P_ADDR(t0)
- stq zero, U_PCB_ONFAULT(t0)
+ ldq t0, GD_CURTHREAD(globalp)
+ ldq t0, TD_PCB(t0)
+ stq zero, PCB_ONFAULT(t0)
ldiq v0, -1
RET
END(fusufault)
@@ -222,15 +222,15 @@ NESTED(copyinstr, 4, 16, ra, 0, 0)
beq t1, copyerr /* if it's not, error out. */
lda v0, copyerr /* set up fault handler. */
.set noat
- ldq at_reg, GD_CURPROC(globalp)
- ldq at_reg, P_ADDR(at_reg)
- stq v0, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp)
+ ldq at_reg, TD_PCB(at_reg)
+ stq v0, PCB_ONFAULT(at_reg)
.set at
CALL(copystr) /* do the copy. */
.set noat
- ldq at_reg, GD_CURPROC(globalp) /* kill the fault handler. */
- ldq at_reg, P_ADDR(at_reg)
- stq zero, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp) /* kill the fault handler. */
+ ldq at_reg, TD_PCB(at_reg)
+ stq zero, PCB_ONFAULT(at_reg)
.set at
ldq ra, (16-8)(sp) /* restore ra. */
lda sp, 16(sp) /* kill stack frame. */
@@ -246,15 +246,15 @@ NESTED(copyoutstr, 4, 16, ra, 0, 0)
beq t1, copyerr /* if it's not, error out. */
lda v0, copyerr /* set up fault handler. */
.set noat
- ldq at_reg, GD_CURPROC(globalp)
- ldq at_reg, P_ADDR(at_reg)
- stq v0, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp)
+ ldq at_reg, TD_PCB(at_reg)
+ stq v0, PCB_ONFAULT(at_reg)
.set at
CALL(copystr) /* do the copy. */
.set noat
- ldq at_reg, GD_CURPROC(globalp) /* kill the fault handler. */
- ldq at_reg, P_ADDR(at_reg)
- stq zero, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp) /* kill the fault handler. */
+ ldq at_reg, TD_PCB(at_reg)
+ stq zero, PCB_ONFAULT(at_reg)
.set at
ldq ra, (16-8)(sp) /* restore ra. */
lda sp, 16(sp) /* kill stack frame. */
@@ -514,15 +514,15 @@ NESTED(copyin, 3, 16, ra, 0, 0)
beq t1, copyerr /* if it's not, error out. */
lda v0, copyerr /* set up fault handler. */
.set noat
- ldq at_reg, GD_CURPROC(globalp)
- ldq at_reg, P_ADDR(at_reg)
- stq v0, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp)
+ ldq at_reg, TD_PCB(at_reg)
+ stq v0, PCB_ONFAULT(at_reg)
.set at
CALL(bcopy) /* do the copy. */
.set noat
- ldq at_reg, GD_CURPROC(globalp) /* kill the fault handler. */
- ldq at_reg, P_ADDR(at_reg)
- stq zero, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp) /* kill the fault handler. */
+ ldq at_reg, TD_PCB(at_reg)
+ stq zero, PCB_ONFAULT(at_reg)
.set at
ldq ra, (16-8)(sp) /* restore ra. */
lda sp, 16(sp) /* kill stack frame. */
@@ -539,15 +539,15 @@ NESTED(copyout, 3, 16, ra, 0, 0)
beq t1, copyerr /* if it's not, error out. */
lda v0, copyerr /* set up fault handler. */
.set noat
- ldq at_reg, GD_CURPROC(globalp)
- ldq at_reg, P_ADDR(at_reg)
- stq v0, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp)
+ ldq at_reg, TD_PCB(at_reg)
+ stq v0, PCB_ONFAULT(at_reg)
.set at
CALL(bcopy) /* do the copy. */
.set noat
- ldq at_reg, GD_CURPROC(globalp) /* kill the fault handler. */
- ldq at_reg, P_ADDR(at_reg)
- stq zero, U_PCB_ONFAULT(at_reg)
+ ldq at_reg, GD_CURTHREAD(globalp) /* kill the fault handler. */
+ ldq at_reg, TD_PCB(at_reg)
+ stq zero, PCB_ONFAULT(at_reg)
.set at
ldq ra, (16-8)(sp) /* restore ra. */
lda sp, 16(sp) /* kill stack frame. */
@@ -556,9 +556,9 @@ NESTED(copyout, 3, 16, ra, 0, 0)
END(copyout)
LEAF(copyerr, 0)
- ldq t0, GD_CURPROC(globalp)
- ldq t0, P_ADDR(t0)
- stq zero, U_PCB_ONFAULT(t0) /* reset fault handler. */
+ ldq t0, GD_CURTHREAD(globalp)
+ ldq t0, TD_PCB(t0)
+ stq zero, PCB_ONFAULT(t0) /* reset fault handler. */
ldq ra, (16-8)(sp) /* restore ra. */
lda sp, 16(sp) /* kill stack frame. */
ldiq v0, EFAULT /* return EFAULT. */
diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s
index 0d244fc..79454c5 100644
--- a/sys/alpha/alpha/swtch.s
+++ b/sys/alpha/alpha/swtch.s
@@ -49,13 +49,13 @@
/*
* savectx: save process context, i.e. callee-saved registers
*
- * Note that savectx() only works for processes other than curproc,
+ * Note that savectx() only works for processes other than curthread,
* since cpu_switch will copy over the info saved here. (It _can_
- * sanely be used for curproc iff cpu_switch won't be called again, e.g.
+ * sanely be used for curthread iff cpu_switch won't be called again, e.g.
* from if called from boot().)
*
* Arguments:
- * a0 'struct user *' of the process that needs its context saved
+ * a0 'struct pcb *' of the process that needs its context saved
*
* Return:
* v0 0. (note that for child processes, it seems
@@ -66,17 +66,17 @@
LEAF(savectx, 1)
br pv, Lsavectx1
Lsavectx1: LDGP(pv)
- stq sp, U_PCB_HWPCB_KSP(a0) /* store sp */
- stq s0, U_PCB_CONTEXT+(0 * 8)(a0) /* store s0 - s6 */
- stq s1, U_PCB_CONTEXT+(1 * 8)(a0)
- stq s2, U_PCB_CONTEXT+(2 * 8)(a0)
- stq s3, U_PCB_CONTEXT+(3 * 8)(a0)
- stq s4, U_PCB_CONTEXT+(4 * 8)(a0)
- stq s5, U_PCB_CONTEXT+(5 * 8)(a0)
- stq s6, U_PCB_CONTEXT+(6 * 8)(a0)
- stq ra, U_PCB_CONTEXT+(7 * 8)(a0) /* store ra */
+ stq sp, PCB_HWPCB_KSP(a0) /* store sp */
+ stq s0, PCB_CONTEXT+(0 * 8)(a0) /* store s0 - s6 */
+ stq s1, PCB_CONTEXT+(1 * 8)(a0)
+ stq s2, PCB_CONTEXT+(2 * 8)(a0)
+ stq s3, PCB_CONTEXT+(3 * 8)(a0)
+ stq s4, PCB_CONTEXT+(4 * 8)(a0)
+ stq s5, PCB_CONTEXT+(5 * 8)(a0)
+ stq s6, PCB_CONTEXT+(6 * 8)(a0)
+ stq ra, PCB_CONTEXT+(7 * 8)(a0) /* store ra */
call_pal PAL_OSF1_rdps /* NOTE: doesn't kill a0 */
- stq v0, U_PCB_CONTEXT+(8 * 8)(a0) /* store ps, for ipl */
+ stq v0, PCB_CONTEXT+(8 * 8)(a0) /* store ps, for ipl */
mov zero, v0
RET
@@ -103,49 +103,49 @@ LEAF(cpu_throw, 0)
LEAF(cpu_switch, 1)
LDGP(pv)
/* do an inline savectx(), to save old context */
- ldq a0, GD_CURPROC(globalp)
- ldq a1, P_ADDR(a0)
+ ldq a0, GD_CURTHREAD(globalp)
+ ldq a1, TD_PCB(a0)
/* NOTE: ksp is stored by the swpctx */
- stq s0, U_PCB_CONTEXT+(0 * 8)(a1) /* store s0 - s6 */
- stq s1, U_PCB_CONTEXT+(1 * 8)(a1)
- stq s2, U_PCB_CONTEXT+(2 * 8)(a1)
- stq s3, U_PCB_CONTEXT+(3 * 8)(a1)
- stq s4, U_PCB_CONTEXT+(4 * 8)(a1)
- stq s5, U_PCB_CONTEXT+(5 * 8)(a1)
- stq s6, U_PCB_CONTEXT+(6 * 8)(a1)
- stq ra, U_PCB_CONTEXT+(7 * 8)(a1) /* store ra */
+ stq s0, PCB_CONTEXT+(0 * 8)(a1) /* store s0 - s6 */
+ stq s1, PCB_CONTEXT+(1 * 8)(a1)
+ stq s2, PCB_CONTEXT+(2 * 8)(a1)
+ stq s3, PCB_CONTEXT+(3 * 8)(a1)
+ stq s4, PCB_CONTEXT+(4 * 8)(a1)
+ stq s5, PCB_CONTEXT+(5 * 8)(a1)
+ stq s6, PCB_CONTEXT+(6 * 8)(a1)
+ stq ra, PCB_CONTEXT+(7 * 8)(a1) /* store ra */
call_pal PAL_OSF1_rdps /* NOTE: doesn't kill a0 */
- stq v0, U_PCB_CONTEXT+(8 * 8)(a1) /* store ps, for ipl */
+ stq v0, PCB_CONTEXT+(8 * 8)(a1) /* store ps, for ipl */
- mov a0, s0 /* save old curproc */
- mov a1, s1 /* save old U-area */
+ mov a0, s0 /* s0 = old curthread */
+ mov a1, s1 /* s1 = old pcb */
sw1:
br pv, Lcs1
Lcs1: LDGP(pv)
- CALL(chooseproc) /* can't return NULL */
- mov v0, s2
- ldq s3, P_MD_PCBPADDR(s2) /* save new pcbpaddr */
+ CALL(choosethread) /* can't return NULL */
+ mov v0, s2 /* s2 = new thread */
+ ldq s3, TD_MD_PCBPADDR(s2) /* s3 = new pcbpaddr */
/*
* Check to see if we're switching to ourself. If we are,
* don't bother loading the new context.
*
* Note that even if we re-enter cpu_switch() from idle(),
- * s0 will still contain the old curproc value because any
+ * s0 will still contain the old curthread value because any
* users of that register between then and now must have
* saved it. Also note that switch_exit() ensures that
* s0 is clear before jumping here to find a new process.
*/
- cmpeq s0, s2, t0 /* oldproc == newproc? */
+ cmpeq s0, s2, t0 /* oldthread == newthread? */
bne t0, Lcs7 /* Yes! Skip! */
#ifdef SMP
/*
* Save fp state if we have some.
*/
- mov s0, a0 /* curproc */
- ldiq a1, 1 /* clear fpcurproc */
+ mov s0, a0 /* curthread */
+ ldiq a1, 1 /* clear fpcurthread */
CALL(alpha_fpstate_save)
#endif
@@ -165,8 +165,8 @@ Lcs1: LDGP(pv)
*/
beq s0, Lcs6
- mov s0, a0 /* pmap_deactivate(oldproc) */
- CALL(pmap_deactivate)
+ mov s0, a0 /* pmap_deactivate(oldthread) */
+ CALL(pmap_deactivate) /* XXXKSE */
Lcs6:
/*
@@ -174,8 +174,8 @@ Lcs6:
* the actual context swap.
*/
- mov s2, a0 /* pmap_activate(p) */
- CALL(pmap_activate)
+ mov s2, a0 /* pmap_activate(newthread) */
+ CALL(pmap_activate) /* XXXKSE */
mov s3, a0 /* swap the context */
SWITCH_CONTEXT
@@ -183,28 +183,28 @@ Lcs6:
Lcs7:
/*
- * Now that the switch is done, update curproc and other
+ * Now that the switch is done, update curthread and other
* globals. We must do this even if switching to ourselves
* because we might have re-entered cpu_switch() from idle(),
- * in which case curproc would be NULL.
+ * in which case curthread would be NULL.
*/
- stq s2, GD_CURPROC(globalp) /* curproc = p */
+ stq s2, GD_CURTHREAD(globalp) /* curthread = p */
/*
* Now running on the new u struct.
* Restore registers and return.
*/
- ldq t0, P_ADDR(s2)
+ ldq t0, TD_PCB(s2)
/* NOTE: ksp is restored by the swpctx */
- ldq s0, U_PCB_CONTEXT+(0 * 8)(t0) /* restore s0 - s6 */
- ldq s1, U_PCB_CONTEXT+(1 * 8)(t0)
- ldq s2, U_PCB_CONTEXT+(2 * 8)(t0)
- ldq s3, U_PCB_CONTEXT+(3 * 8)(t0)
- ldq s4, U_PCB_CONTEXT+(4 * 8)(t0)
- ldq s5, U_PCB_CONTEXT+(5 * 8)(t0)
- ldq s6, U_PCB_CONTEXT+(6 * 8)(t0)
- ldq ra, U_PCB_CONTEXT+(7 * 8)(t0) /* restore ra */
+ ldq s0, PCB_CONTEXT+(0 * 8)(t0) /* restore s0 - s6 */
+ ldq s1, PCB_CONTEXT+(1 * 8)(t0)
+ ldq s2, PCB_CONTEXT+(2 * 8)(t0)
+ ldq s3, PCB_CONTEXT+(3 * 8)(t0)
+ ldq s4, PCB_CONTEXT+(4 * 8)(t0)
+ ldq s5, PCB_CONTEXT+(5 * 8)(t0)
+ ldq s6, PCB_CONTEXT+(6 * 8)(t0)
+ ldq ra, PCB_CONTEXT+(7 * 8)(t0) /* restore ra */
ldiq v0, 1 /* possible ret to savectx() */
RET
diff --git a/sys/alpha/alpha/sys_machdep.c b/sys/alpha/alpha/sys_machdep.c
index ea0f49c..0d304cb 100644
--- a/sys/alpha/alpha/sys_machdep.c
+++ b/sys/alpha/alpha/sys_machdep.c
@@ -63,34 +63,34 @@ struct sysarch_args {
};
#endif
-static int alpha_sethae(struct proc *p, char *args);
-static int alpha_get_fpmask(struct proc *p, char *args);
-static int alpha_set_fpmask(struct proc *p, char *args);
-static int alpha_set_uac(struct proc *p, char *args);
-static int alpha_get_uac(struct proc *p, char *args);
+static int alpha_sethae(struct thread *td, char *args);
+static int alpha_get_fpmask(struct thread *td, char *args);
+static int alpha_set_fpmask(struct thread *td, char *args);
+static int alpha_set_uac(struct thread *td, char *args);
+static int alpha_get_uac(struct thread *td, char *args);
int
-sysarch(p, uap)
- struct proc *p;
+sysarch(td, uap)
+ struct thread *td;
register struct sysarch_args *uap;
{
int error = 0;
switch(SCARG(uap,op)) {
case ALPHA_SETHAE:
- error = alpha_sethae(p, uap->parms);
+ error = alpha_sethae(td, uap->parms);
break;
case ALPHA_GET_FPMASK:
- error = alpha_get_fpmask(p, uap->parms);
+ error = alpha_get_fpmask(td, uap->parms);
break;
case ALPHA_SET_FPMASK:
- error = alpha_set_fpmask(p, uap->parms);
+ error = alpha_set_fpmask(td, uap->parms);
break;
case ALPHA_SET_UAC:
- error = alpha_set_uac(p, uap->parms);
+ error = alpha_set_uac(td, uap->parms);
break;
case ALPHA_GET_UAC:
- error = alpha_get_uac(p, uap->parms);
+ error = alpha_get_uac(td, uap->parms);
break;
default:
@@ -105,7 +105,7 @@ struct alpha_sethae_args {
};
static int
-alpha_sethae(struct proc *p, char *args)
+alpha_sethae(struct thread *td, char *args)
{
int error;
struct alpha_sethae_args ua;
@@ -117,12 +117,12 @@ alpha_sethae(struct proc *p, char *args)
if (securelevel > 0)
return (EPERM);
- error = suser(p);
+ error = suser(td->td_proc);
if (error)
return (error);
- p->p_md.md_flags |= MDP_HAEUSED;
- p->p_md.md_hae = ua.hae;
+ td->td_md.md_flags |= MDP_HAEUSED;
+ td->td_md.md_hae = ua.hae;
return (0);
}
@@ -132,19 +132,19 @@ struct alpha_fpmask_args {
};
static int
-alpha_get_fpmask(struct proc *p, char *args)
+alpha_get_fpmask(struct thread *td, char *args)
{
int error;
struct alpha_fpmask_args ua;
- ua.mask = p->p_addr->u_pcb.pcb_fp_control;
+ ua.mask = td->td_pcb->pcb_fp_control;
error = copyout(&ua, args, sizeof(struct alpha_fpmask_args));
return (error);
}
static int
-alpha_set_fpmask(struct proc *p, char *args)
+alpha_set_fpmask(struct thread *td, char *args)
{
int error;
u_int64_t oldmask, *fp_control;
@@ -154,7 +154,7 @@ alpha_set_fpmask(struct proc *p, char *args)
if (error)
return (error);
- fp_control = &p->p_addr->u_pcb.pcb_fp_control;
+ fp_control = &td->td_pcb->pcb_fp_control;
oldmask = *fp_control;
*fp_control = ua.mask & IEEE_TRAP_ENABLE_MASK;
ua.mask = oldmask;
@@ -164,20 +164,23 @@ alpha_set_fpmask(struct proc *p, char *args)
}
static int
-alpha_set_uac(struct proc *p, char *args)
+alpha_set_uac(struct thread *td, char *args)
{
int error;
unsigned long uac;
+ struct proc *p;
error = copyin(args, &uac, sizeof(uac));
if (error)
return (error);
+ p = td->td_proc;
PROC_LOCK(p);
if (p->p_pptr) {
PROC_LOCK(p->p_pptr);
- p->p_pptr->p_md.md_flags &= ~MDP_UAC_MASK;
- p->p_pptr->p_md.md_flags |= uac & MDP_UAC_MASK;
+ /* XXXKSE which threads? */
+ p->p_pptr->p_thread.td_md.md_flags &= ~MDP_UAC_MASK;
+ p->p_pptr->p_thread.td_md.md_flags |= uac & MDP_UAC_MASK;
PROC_UNLOCK(p->p_pptr);
}
PROC_UNLOCK(p);
@@ -185,16 +188,19 @@ alpha_set_uac(struct proc *p, char *args)
}
static int
-alpha_get_uac(struct proc *p, char *args)
+alpha_get_uac(struct thread *td, char *args)
{
+ struct proc *p;
int error;
unsigned long uac;
+ p = td->td_proc;
error = ESRCH;
PROC_LOCK(p);
if (p->p_pptr) {
PROC_LOCK(p->p_pptr);
- uac = p->p_pptr->p_md.md_flags & MDP_UAC_MASK;
+ /* XXXKSE which threads? */
+ uac = p->p_pptr->p_thread.td_md.md_flags & MDP_UAC_MASK;
PROC_UNLOCK(p->p_pptr);
PROC_UNLOCK(p);
error = copyout(&uac, args, sizeof(uac));
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c
index 9b7d8f4..726615a 100644
--- a/sys/alpha/alpha/trap.c
+++ b/sys/alpha/alpha/trap.c
@@ -81,8 +81,8 @@ unsigned long Gfloat_reg_cvt __P((unsigned long));
#endif
int unaligned_fixup __P((unsigned long, unsigned long,
- unsigned long, struct proc *));
-int handle_opdec(struct proc *p, u_int64_t *ucodep);
+ unsigned long, struct thread *));
+int handle_opdec(struct thread *td, u_int64_t *ucodep);
static void printtrap __P((const unsigned long, const unsigned long,
const unsigned long, const unsigned long, struct trapframe *, int, int));
@@ -256,6 +256,7 @@ trap(a0, a1, a2, entry, framep)
const unsigned long a0, a1, a2, entry;
struct trapframe *framep;
{
+ register struct thread *td;
register struct proc *p;
register int i;
u_int64_t ucode;
@@ -272,11 +273,12 @@ trap(a0, a1, a2, entry, framep)
s = critical_enter();
#endif
globalp = (struct globaldata *) alpha_pal_rdval();
- p = curproc;
+ td = curthread;
#ifdef SMP
- p->p_md.md_kernnest++;
+ td->td_md.md_kernnest++;
critical_exit(s);
#endif
+ p = td->td_proc;
/*
GIANT_REQUIRED;
@@ -289,15 +291,15 @@ trap(a0, a1, a2, entry, framep)
CTR5(KTR_TRAP, "%s trap: pid %d, (%lx, %lx, %lx)",
user ? "user" : "kernel", p->p_pid, a0, a1, a2);
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 */
}
#ifdef DIAGNOSTIC
if (user)
- alpha_fpstate_check(p);
+ alpha_fpstate_check(td);
#endif
switch (entry) {
@@ -309,7 +311,7 @@ trap(a0, a1, a2, entry, framep)
*/
if (user) {
mtx_lock(&Giant);
- if ((i = unaligned_fixup(a0, a1, a2, p)) == 0) {
+ if ((i = unaligned_fixup(a0, a1, a2, td)) == 0) {
mtx_unlock(&Giant);
goto out;
}
@@ -339,7 +341,7 @@ trap(a0, a1, a2, entry, framep)
if (user) {
mtx_lock(&Giant);
if (a0 & EXCSUM_SWC)
- if (fp_software_completion(a1, p)) {
+ if (fp_software_completion(a1, td)) {
mtx_unlock(&Giant);
goto out;
}
@@ -391,10 +393,10 @@ trap(a0, a1, a2, entry, framep)
/* FALLTHROUTH */
case ALPHA_IF_CODE_BPT:
case ALPHA_IF_CODE_BUGCHK:
- if (p->p_md.md_flags & (MDP_STEP1|MDP_STEP2)) {
+ if (td->td_md.md_flags & (MDP_STEP1|MDP_STEP2)) {
mtx_lock(&Giant);
- ptrace_clear_single_step(p);
- p->p_frame->tf_regs[FRAME_PC] -= 4;
+ ptrace_clear_single_step(td);
+ td->td_frame->tf_regs[FRAME_PC] -= 4;
mtx_unlock(&Giant);
}
ucode = a0; /* trap type */
@@ -402,23 +404,23 @@ trap(a0, a1, a2, entry, framep)
break;
case ALPHA_IF_CODE_OPDEC:
- i = handle_opdec(p, &ucode);
+ i = handle_opdec(td, &ucode);
if (i == 0)
goto out;
break;
case ALPHA_IF_CODE_FEN:
/*
- * 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;
}
- alpha_fpstate_switch(p);
+ alpha_fpstate_switch(td);
goto out;
default:
@@ -432,7 +434,7 @@ trap(a0, a1, a2, entry, framep)
case ALPHA_MMCSR_FOR:
case ALPHA_MMCSR_FOE:
case ALPHA_MMCSR_FOW:
- pmap_emulate_reference(p, a0, user,
+ pmap_emulate_reference(p->p_vmspace, a0, user,
a1 == ALPHA_MMCSR_FOW);
goto out;
@@ -453,13 +455,13 @@ trap(a0, a1, a2, entry, framep)
* when they are running.
*/
if (!user &&
- p != NULL &&
- p->p_addr->u_pcb.pcb_onfault ==
+ td != NULL &&
+ td->td_pcb->pcb_onfault ==
(unsigned long)fswintrberr &&
- p->p_addr->u_pcb.pcb_accessaddr == a0) {
+ td->td_pcb->pcb_accessaddr == a0) {
framep->tf_regs[FRAME_PC] =
- p->p_addr->u_pcb.pcb_onfault;
- p->p_addr->u_pcb.pcb_onfault = 0;
+ td->td_pcb->pcb_onfault;
+ td->td_pcb->pcb_onfault = 0;
goto out;
}
@@ -479,8 +481,8 @@ trap(a0, a1, a2, entry, framep)
*/
if (!user
&& ((a0 >= VM_MIN_KERNEL_ADDRESS)
- || (p == NULL)
- || (p->p_addr->u_pcb.pcb_onfault == 0))) {
+ || (td == NULL)
+ || (td->td_pcb->pcb_onfault == 0))) {
if (a0 >= trunc_page(PS_STRINGS
- szsigcode
- SPARE_USRSPACE)
@@ -578,11 +580,11 @@ trap(a0, a1, a2, entry, framep)
mtx_unlock(&Giant);
if (!user) {
/* Check for copyin/copyout fault */
- if (p != NULL &&
- p->p_addr->u_pcb.pcb_onfault != 0) {
+ if (td != NULL &&
+ td->td_pcb->pcb_onfault != 0) {
framep->tf_regs[FRAME_PC] =
- p->p_addr->u_pcb.pcb_onfault;
- p->p_addr->u_pcb.pcb_onfault = 0;
+ td->td_pcb->pcb_onfault;
+ td->td_pcb->pcb_onfault = 0;
goto out;
}
goto dopanic;
@@ -615,7 +617,7 @@ trap(a0, a1, a2, entry, framep)
out:
if (user) {
framep->tf_regs[FRAME_SP] = alpha_pal_rdusp();
- userret(p, framep, sticks);
+ userret(td, framep, sticks);
if (mtx_owned(&Giant))
mtx_unlock(&Giant);
}
@@ -649,6 +651,7 @@ syscall(code, framep)
struct trapframe *framep;
{
struct sysent *callp;
+ struct thread *td;
struct proc *p;
int error = 0;
u_int64_t opc;
@@ -666,11 +669,12 @@ syscall(code, framep)
s = critical_enter();
#endif
globalp = (struct globaldata *) alpha_pal_rdval();
- p = curproc;
+ td = curthread;
#ifdef SMP
- p->p_md.md_kernnest++;
+ td->td_md.md_kernnest++;
critical_exit(s);
#endif
+ p = td->td_proc;
framep->tf_regs[FRAME_TRAPARG_A0] = 0;
framep->tf_regs[FRAME_TRAPARG_A1] = 0;
@@ -681,9 +685,9 @@ syscall(code, framep)
#endif
cnt.v_syscall++;
- p->p_frame = framep;
+ td->td_frame = framep;
opc = framep->tf_regs[FRAME_PC] - 4;
- sticks = p->p_sticks;
+ sticks = td->td_kse->ke_sticks;
#ifdef DIAGNOSTIC
alpha_fpstate_check(p);
@@ -750,19 +754,19 @@ syscall(code, framep)
}
#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 + hidden);
+ error = (*callp->sy_call)(td, args + hidden);
}
switch (error) {
case 0:
- framep->tf_regs[FRAME_V0] = p->p_retval[0];
- framep->tf_regs[FRAME_A4] = p->p_retval[1];
+ framep->tf_regs[FRAME_V0] = td->td_retval[0];
+ framep->tf_regs[FRAME_A4] = td->td_retval[1];
framep->tf_regs[FRAME_A3] = 0;
break;
case ERESTART:
@@ -782,10 +786,10 @@ syscall(code, 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
@@ -805,7 +809,7 @@ syscall(code, 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]);
}
@@ -829,23 +833,23 @@ const static int reg_to_framereg[32] = {
FRAME_AT, FRAME_GP, FRAME_SP, -1,
};
-#define irp(p, reg) \
+#define irp(td, reg) \
((reg_to_framereg[(reg)] == -1) ? NULL : \
- &(p)->p_frame->tf_regs[reg_to_framereg[(reg)]])
+ &(td)->td_frame->tf_regs[reg_to_framereg[(reg)]])
-#define frp(p, reg) \
- (&(p)->p_addr->u_pcb.pcb_fp.fpr_regs[(reg)])
+#define frp(td, reg) \
+ (&(td)->td_pcb->pcb_fp.fpr_regs[(reg)])
#define unaligned_load(storage, ptrf, mod) \
if (copyin((caddr_t)va, &(storage), sizeof (storage)) == 0 && \
- (regptr = ptrf(p, reg)) != NULL) \
+ (regptr = ptrf(td, reg)) != NULL) \
signal = 0; \
else \
break; \
*regptr = mod (storage);
#define unaligned_store(storage, ptrf, mod) \
- if ((regptr = ptrf(p, reg)) == NULL) \
+ if ((regptr = ptrf(td, reg)) == NULL) \
(storage) = 0; \
else \
(storage) = mod (*regptr); \
@@ -861,11 +865,11 @@ const static int reg_to_framereg[32] = {
unaligned_store(storage, irp, )
#define unaligned_load_floating(storage, mod) \
- alpha_fpstate_save(p, 1); \
+ alpha_fpstate_save(td, 1); \
unaligned_load(storage, frp, mod)
#define unaligned_store_floating(storage, mod) \
- alpha_fpstate_save(p, 0); \
+ alpha_fpstate_save(td, 0); \
unaligned_store(storage, frp, mod)
unsigned long
@@ -988,13 +992,14 @@ extern int alpha_unaligned_print, alpha_unaligned_fix;
extern int alpha_unaligned_sigbus;
int
-unaligned_fixup(va, opcode, reg, p)
+unaligned_fixup(va, opcode, reg, td)
unsigned long va, opcode, reg;
- struct proc *p;
+ struct thread *td;
{
int doprint, dofix, dosigbus;
int signal, size;
const char *type;
+ struct proc *p;
unsigned long *regptr, longdata, uac;
int intdata; /* signed to get extension when storing */
struct {
@@ -1024,10 +1029,13 @@ unaligned_fixup(va, opcode, reg, p)
*
*/
- 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 = alpha_unaligned_print && !(uac & MDP_UAC_NOPRINT);
dofix = alpha_unaligned_fix && !(uac & MDP_UAC_NOFIX);
@@ -1061,8 +1069,8 @@ unaligned_fixup(va, opcode, reg, p)
if (doprint) {
uprintf(
"pid %d (%s): unaligned access: va=0x%lx pc=0x%lx ra=0x%lx op=",
- p->p_pid, p->p_comm, va, p->p_frame->tf_regs[FRAME_PC],
- p->p_frame->tf_regs[FRAME_RA]);
+ p->p_pid, p->p_comm, va, td->td_frame->tf_regs[FRAME_PC],
+ td->td_frame->tf_regs[FRAME_RA]);
uprintf(type,opcode);
uprintf("\n");
}
@@ -1165,8 +1173,8 @@ out:
* and fills in *ucodep with the code to be delivered.
*/
int
-handle_opdec(p, ucodep)
- struct proc *p;
+handle_opdec(td, ucodep)
+ struct thread *td;
u_int64_t *ucodep;
{
alpha_instruction inst;
@@ -1179,9 +1187,9 @@ handle_opdec(p, ucodep)
* This keeps us from having to check for it in lots of places
* later.
*/
- p->p_frame->tf_regs[FRAME_SP] = alpha_pal_rdusp();
+ td->td_frame->tf_regs[FRAME_SP] = alpha_pal_rdusp();
- inst_pc = memaddr = p->p_frame->tf_regs[FRAME_PC] - 4;
+ inst_pc = memaddr = td->td_frame->tf_regs[FRAME_PC] - 4;
if (copyin((caddr_t)inst_pc, &inst, sizeof (inst)) != 0) {
/*
* really, this should never happen, but in case it
@@ -1196,21 +1204,21 @@ handle_opdec(p, ucodep)
case op_ldwu:
case op_stw:
case op_stb:
- regptr = irp(p, inst.mem_format.rs);
+ regptr = irp(td, inst.mem_format.rs);
if (regptr != NULL)
memaddr = *regptr;
else
memaddr = 0;
memaddr += inst.mem_format.displacement;
- regptr = irp(p, inst.mem_format.rd);
+ regptr = irp(td, inst.mem_format.rd);
if (inst.mem_format.opcode == op_ldwu ||
inst.mem_format.opcode == op_stw) {
if (memaddr & 0x01) {
sig = unaligned_fixup(memaddr,
inst.mem_format.opcode,
- inst.mem_format.rd, p);
+ inst.mem_format.rd, td);
if (sig)
goto unaligned_fixup_sig;
break;
@@ -1260,11 +1268,11 @@ handle_opdec(p, ucodep)
} else {
if (inst.operate_reg_format.sbz != 0)
goto sigill;
- regptr = irp(p, inst.operate_reg_format.rt);
+ regptr = irp(td, inst.operate_reg_format.rt);
b = (regptr != NULL) ? *regptr : 0;
}
- regptr = irp(p, inst.operate_generic_format.rc);
+ regptr = irp(td, inst.operate_generic_format.rc);
if (regptr != NULL)
*regptr = b;
break;
@@ -1278,11 +1286,11 @@ handle_opdec(p, ucodep)
} else {
if (inst.operate_reg_format.sbz != 0)
goto sigill;
- regptr = irp(p, inst.operate_reg_format.rt);
+ regptr = irp(td, inst.operate_reg_format.rt);
w = (regptr != NULL) ? *regptr : 0;
}
- regptr = irp(p, inst.operate_generic_format.rc);
+ regptr = irp(td, inst.operate_generic_format.rc);
if (regptr != NULL)
*regptr = w;
break;
@@ -1298,7 +1306,7 @@ handle_opdec(p, ucodep)
* nothing will have been successfully modified so we don't
* have to write it out.
*/
- alpha_pal_wrusp(p->p_frame->tf_regs[FRAME_SP]);
+ alpha_pal_wrusp(td->td_frame->tf_regs[FRAME_SP]);
return (0);
@@ -1308,7 +1316,7 @@ sigill:
sigsegv:
sig = SIGSEGV;
- p->p_frame->tf_regs[FRAME_PC] = inst_pc; /* re-run instr. */
+ td->td_frame->tf_regs[FRAME_PC] = inst_pc; /* re-run instr. */
unaligned_fixup_sig:
*ucodep = memaddr; /* faulting address */
return (sig);
diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c
index 0aec807..6e302cd 100644
--- a/sys/alpha/alpha/vm_machdep.c
+++ b/sys/alpha/alpha/vm_machdep.c
@@ -118,30 +118,35 @@ vm_fault_quick(v, prot)
* 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;
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);
/*
* Cache the physical address of the pcb, so we can
* swap to it easily.
*/
- p2->p_md.md_pcbpaddr = (void*)vtophys((vm_offset_t)&p2->p_addr->u_pcb);
+ td2->td_md.md_pcbpaddr = (void*)vtophys((vm_offset_t)td2->td_pcb);
/*
* Copy floating point state from the FP chip to the PCB
* if this process has state stored there.
*/
- alpha_fpstate_save(p1, 0);
+ alpha_fpstate_save(td1, 0);
/*
* Copy pcb and stack from proc p1 to p2. We do this as
@@ -149,16 +154,16 @@ 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;
- p2->p_addr->u_pcb.pcb_hw.apcb_usp = alpha_pal_rdusp();
- p2->p_addr->u_pcb.pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN;
+ bcopy(td1->td_pcb, td2->td_pcb, sizeof(struct pcb));
+ td2->td_pcb->pcb_hw.apcb_usp = alpha_pal_rdusp();
+ td2->td_pcb->pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN;
/*
* Set the floating point state.
*/
- 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);
@@ -169,7 +174,7 @@ cpu_fork(p1, p2, flags)
* is started, to resume here, returning nonzero from setjmp.
*/
#ifdef DIAGNOSTIC
- alpha_fpstate_check(p1);
+ alpha_fpstate_check(td1);
#endif
/*
@@ -179,34 +184,32 @@ 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->tf_regs[FRAME_V0] = 0; /* child's pid (linux) */
- p2tf->tf_regs[FRAME_A3] = 0; /* no error */
- p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
+ p2tf = td2->td_frame;
+ p2tf->tf_regs[FRAME_V0] = 0; /* child's pid (linux) */
+ p2tf->tf_regs[FRAME_A3] = 0; /* no error */
+ p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
/*
* Arrange for continuation at fork_return(), which
* will return to exception_return(). Note that the child
* process doesn't stay in the kernel for long!
*/
- up = p2->p_addr;
- up->u_pcb.pcb_hw.apcb_ksp = (u_int64_t)p2tf;
- up->u_pcb.pcb_context[0] = (u_int64_t)fork_return; /* s0: a0 */
- up->u_pcb.pcb_context[1] = (u_int64_t)exception_return; /* s1: ra */
- up->u_pcb.pcb_context[2] = (u_long) p2; /* s2: a1 */
- up->u_pcb.pcb_context[7] = (u_int64_t)fork_trampoline; /* ra: magic */
+ td2->td_pcb->pcb_hw.apcb_ksp = (u_int64_t)p2tf;
+ td2->td_pcb->pcb_context[0] = (u_int64_t)fork_return; /* s0: a0 */
+ td2->td_pcb->pcb_context[1] = (u_int64_t)exception_return;/* s1: ra */
+ td2->td_pcb->pcb_context[2] = (u_long)td2; /* s2: a1 */
+ td2->td_pcb->pcb_context[7] = (u_int64_t)fork_trampoline; /* ra: magic*/
#ifdef SMP
/*
* We start off at a nesting level of 1 within the kernel.
*/
- p2->p_md.md_kernnest = 1;
+ td2->td_md.md_kernnest = 1;
#endif
}
@@ -217,8 +220,8 @@ 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;
{
@@ -226,8 +229,8 @@ cpu_set_fork_handler(p, func, arg)
* Note that the trap frame follows the args, so the function
* is really called like this: func(arg, frame);
*/
- p->p_addr->u_pcb.pcb_context[0] = (u_long) func;
- p->p_addr->u_pcb.pcb_context[2] = (u_long) arg;
+ td->td_pcb->pcb_context[0] = (u_long) func;
+ td->td_pcb->pcb_context[2] = (u_long) arg;
}
/*
@@ -238,11 +241,11 @@ cpu_set_fork_handler(p, func, arg)
* from proc0.
*/
void
-cpu_exit(p)
- register struct proc *p;
+cpu_exit(td)
+ register struct thread *td;
{
- alpha_fpstate_drop(p);
+ alpha_fpstate_drop(td);
}
void
@@ -255,14 +258,23 @@ cpu_wait(p)
* 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;
+
+ /* XXXKSE this is totally bogus! (and insecure) */
+ 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)ctob(UAREA_PAGES),
+ UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, td);
+ return error;
}
/*
diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h
index 69ed2ea..e5fd400 100644
--- a/sys/alpha/include/cpu.h
+++ b/sys/alpha/include/cpu.h
@@ -52,7 +52,7 @@
#include <machine/frame.h>
-#define cpu_getstack(p) (alpha_pal_rdusp())
+#define cpu_getstack(td) (alpha_pal_rdusp())
/*
* Arguments to hardclock and gatherstats encapsulate the previous
@@ -99,7 +99,7 @@ struct clockframe {
#ifdef _KERNEL
struct pcb;
-struct proc;
+struct thread;
struct reg;
struct rpb;
struct trapframe;
@@ -116,10 +116,10 @@ void XentSys __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
void XentUna __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */
void alpha_init __P((u_long, u_long, u_long, u_long, u_long));
int alpha_pa_access __P((u_long));
-void alpha_fpstate_check __P((struct proc *p));
-void alpha_fpstate_save __P((struct proc *p, int write));
-void alpha_fpstate_drop __P((struct proc *p));
-void alpha_fpstate_switch __P((struct proc *p));
+void alpha_fpstate_check __P((struct thread *p));
+void alpha_fpstate_save __P((struct thread *p, int write));
+void alpha_fpstate_drop __P((struct thread *p));
+void alpha_fpstate_switch __P((struct thread *p));
int badaddr __P((void *, size_t));
int badaddr_read __P((void *, size_t, void *));
u_int64_t console_restart __P((u_int64_t, u_int64_t, u_int64_t));
@@ -138,7 +138,7 @@ void regdump __P((struct trapframe *));
void regtoframe __P((struct reg *, struct trapframe *));
void savectx __P((struct pcb *));
void set_iointr __P((void (*)(void *, unsigned long)));
-void switch_exit __P((struct proc *)); /* MAGIC */
+void switch_exit __P((struct thread *)); /* MAGIC */
void fork_trampoline __P((void)); /* MAGIC */
void syscall __P((u_int64_t, struct trapframe *));
void trap __P((unsigned long, unsigned long, unsigned long, unsigned long,
diff --git a/sys/alpha/include/fpu.h b/sys/alpha/include/fpu.h
index 250db28..712a1f9 100644
--- a/sys/alpha/include/fpu.h
+++ b/sys/alpha/include/fpu.h
@@ -117,7 +117,7 @@
#ifdef _KERNEL
-extern int fp_software_completion(u_int64_t regmask, struct proc *p);
+extern int fp_software_completion(u_int64_t regmask, struct thread *p);
#endif
diff --git a/sys/alpha/include/globaldata.h b/sys/alpha/include/globaldata.h
index d577fee..5d8514b 100644
--- a/sys/alpha/include/globaldata.h
+++ b/sys/alpha/include/globaldata.h
@@ -44,15 +44,15 @@
* point at the globaldata structure.
*/
struct globaldata {
- struct alpha_pcb gd_idlepcb; /* pcb for idling */
- struct proc *gd_curproc; /* current process */
- struct proc *gd_idleproc; /* idle process */
- struct proc *gd_fpcurproc; /* fp state owner */
- struct pcb *gd_curpcb; /* current pcb */
- struct timeval gd_switchtime;
- int gd_switchticks;
- u_int gd_cpuid; /* this cpu number */
- u_int gd_other_cpus; /* all other cpus */
+ struct alpha_pcb gd_idlepcb; /* pcb for idling */
+ struct thread *gd_curthread; /* current thread */
+ struct thread *gd_idlethread; /* idle thread */
+ struct thread *gd_fpcurthread; /* fp state owner */
+ struct pcb *gd_curpcb; /* current pcb */
+ struct timeval gd_switchtime;
+ int gd_switchticks;
+ u_int gd_cpuid; /* this cpu number */
+ u_int gd_other_cpus; /* all other cpus */
u_int64_t gd_idlepcbphys; /* pa of gd_idlepcb */
u_int64_t gd_pending_ipis; /* pending IPI events */
u_int32_t gd_next_asn; /* next ASN to allocate */
diff --git a/sys/alpha/include/globals.h b/sys/alpha/include/globals.h
index 313541b..46dab32 100644
--- a/sys/alpha/include/globals.h
+++ b/sys/alpha/include/globals.h
@@ -40,9 +40,11 @@ register struct globaldata *globalp __asm__("$8");
#define PCPU_PTR(member) (&GLOBALP->gd_ ## member)
#define PCPU_SET(member,value) (GLOBALP->gd_ ## member = (value))
-#define CURPROC PCPU_GET(curproc)
-#define CURTHD PCPU_GET(curproc) /* temporary */
-#define curproc PCPU_GET(curproc)
+#define curthread PCPU_GET(curthread)
+#define CURPROC (curthread->td_proc)
+#define curproc (curthread->td_proc)
+#define curksegrp (curthread->td_ksegrp)
+#define curkse (curthread->td_kse)
#endif /* _KERNEL */
diff --git a/sys/alpha/include/md_var.h b/sys/alpha/include/md_var.h
index 41512d7..b4fdfe4 100644
--- a/sys/alpha/include/md_var.h
+++ b/sys/alpha/include/md_var.h
@@ -40,7 +40,7 @@ extern int Maxmem;
extern int busdma_swi_pending;
struct fpreg;
-struct proc;
+struct thread;
struct reg;
struct cam_sim;
struct pcicfg;
@@ -50,10 +50,10 @@ void cpu_halt __P((void));
void cpu_reset __P((void));
int is_physical_memory __P((vm_offset_t addr));
void swi_vm __P((void *));
-int fill_regs __P((struct proc *, struct reg *));
-int set_regs __P((struct proc *, struct reg *));
-int fill_fpregs __P((struct proc *, struct fpreg *));
-int set_fpregs __P((struct proc *, struct fpreg *));
+int fill_regs __P((struct thread *, struct reg *));
+int set_regs __P((struct thread *, struct reg *));
+int fill_fpregs __P((struct thread *, struct fpreg *));
+int set_fpregs __P((struct thread *, struct fpreg *));
void alpha_register_pci_scsi __P((int bus, int slot, struct cam_sim *sim));
#ifdef _SYS_BUS_H_
struct resource *alpha_platform_alloc_ide_intr(int chan);
diff --git a/sys/alpha/include/mutex.h b/sys/alpha/include/mutex.h
index c141d6f..9192bb2 100644
--- a/sys/alpha/include/mutex.h
+++ b/sys/alpha/include/mutex.h
@@ -58,7 +58,7 @@ extern struct mtx clock_lock;
1: ldq_l a0, lck+MTX_LOCK; \
cmpeq a0, MTX_UNOWNED, a1; \
beq a1, 1b; \
- ldq a0, PC_CURPROC(globalp); \
+ ldq a0, PC_CURTHREAD(globalp); \
stq_c a0, lck+MTX_LOCK; \
beq a0, 1b; \
mb; \
diff --git a/sys/alpha/include/param.h b/sys/alpha/include/param.h
index 0a0206e..91dabba 100644
--- a/sys/alpha/include/param.h
+++ b/sys/alpha/include/param.h
@@ -133,8 +133,10 @@
#define SSIZE 1 /* initial stack size/NBPG */
#define SINCR 1 /* increment of stack/NBPG */
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
+#define KSTACK_PAGES 2 /* pages of kstack (with pcb) */
+#define UAREA_PAGES 1 /* pages of u-area */
+
+#define KSTACK_GUARD /* compile in kstack guard page */
/*
* Constants related to network buffer management.
diff --git a/sys/alpha/include/pcpu.h b/sys/alpha/include/pcpu.h
index d577fee..5d8514b 100644
--- a/sys/alpha/include/pcpu.h
+++ b/sys/alpha/include/pcpu.h
@@ -44,15 +44,15 @@
* point at the globaldata structure.
*/
struct globaldata {
- struct alpha_pcb gd_idlepcb; /* pcb for idling */
- struct proc *gd_curproc; /* current process */
- struct proc *gd_idleproc; /* idle process */
- struct proc *gd_fpcurproc; /* fp state owner */
- struct pcb *gd_curpcb; /* current pcb */
- struct timeval gd_switchtime;
- int gd_switchticks;
- u_int gd_cpuid; /* this cpu number */
- u_int gd_other_cpus; /* all other cpus */
+ struct alpha_pcb gd_idlepcb; /* pcb for idling */
+ struct thread *gd_curthread; /* current thread */
+ struct thread *gd_idlethread; /* idle thread */
+ struct thread *gd_fpcurthread; /* fp state owner */
+ struct pcb *gd_curpcb; /* current pcb */
+ struct timeval gd_switchtime;
+ int gd_switchticks;
+ u_int gd_cpuid; /* this cpu number */
+ u_int gd_other_cpus; /* all other cpus */
u_int64_t gd_idlepcbphys; /* pa of gd_idlepcb */
u_int64_t gd_pending_ipis; /* pending IPI events */
u_int32_t gd_next_asn; /* next ASN to allocate */
diff --git a/sys/alpha/include/pmap.h b/sys/alpha/include/pmap.h
index 055ea36..959805e 100644
--- a/sys/alpha/include/pmap.h
+++ b/sys/alpha/include/pmap.h
@@ -220,6 +220,8 @@ extern char *ptvmmap; /* poor name! */
extern vm_offset_t virtual_avail;
extern vm_offset_t virtual_end;
+struct vmspace;
+
vm_offset_t pmap_steal_memory __P((vm_size_t));
void pmap_bootstrap __P((vm_offset_t, u_int));
void pmap_setdevram __P((unsigned long long basea, vm_offset_t sizea));
@@ -230,8 +232,8 @@ unsigned *pmap_pte __P((pmap_t, vm_offset_t)) __pure2;
vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t));
void pmap_set_opt __P((unsigned *));
void pmap_set_opt_bsp __P((void));
-void pmap_deactivate __P((struct proc *p));
-void pmap_emulate_reference __P((struct proc *p, vm_offset_t v, int user, int write));
+void pmap_deactivate __P((struct thread *td));
+void pmap_emulate_reference __P((struct vmspace *vm, vm_offset_t v, int user, int write));
#endif /* _KERNEL */
diff --git a/sys/alpha/include/proc.h b/sys/alpha/include/proc.h
index b3f98f6..16cf1d5 100644
--- a/sys/alpha/include/proc.h
+++ b/sys/alpha/include/proc.h
@@ -43,7 +43,7 @@ struct mdbpt {
u_int32_t contents;
};
-struct mdproc {
+struct mdthread {
u_long md_flags;
struct pcb *md_pcbpaddr; /* phys addr of the pcb */
struct mdbpt md_sstep[2]; /* two single step breakpoints */
@@ -62,4 +62,7 @@ struct mdproc {
unaligned access */
#define MDP_UAC_MASK (MDP_UAC_NOPRINT | MDP_UAC_NOFIX | MDP_UAC_SIGBUS)
+struct mdproc {
+};
+
#endif /* !_MACHINE_PROC_H_ */
diff --git a/sys/alpha/include/ptrace.h b/sys/alpha/include/ptrace.h
index 5a9cf14..87a03af 100644
--- a/sys/alpha/include/ptrace.h
+++ b/sys/alpha/include/ptrace.h
@@ -48,7 +48,7 @@
#define FIX_SSTEP(p) ptrace_clear_single_step(p)
#ifdef _KERNEL
-int ptrace_clear_single_step(struct proc *_p);
+int ptrace_clear_single_step(struct thread *_p);
#endif
#endif
diff --git a/sys/alpha/include/reg.h b/sys/alpha/include/reg.h
index 5dfde65..b4a73f3 100644
--- a/sys/alpha/include/reg.h
+++ b/sys/alpha/include/reg.h
@@ -110,7 +110,7 @@ struct dbreg {
#ifdef _KERNEL
void restorefpstate __P((struct fpreg *));
void savefpstate __P((struct fpreg *));
-void setregs __P((struct proc *, u_long, u_long, u_long));
+void setregs __P((struct thread *, u_long, u_long, u_long));
#endif
#endif /* _ALPHA_REG_H_ */
diff --git a/sys/alpha/include/vmparam.h b/sys/alpha/include/vmparam.h
index bd08553..29dcc99 100644
--- a/sys/alpha/include/vmparam.h
+++ b/sys/alpha/include/vmparam.h
@@ -62,7 +62,7 @@
* with a 32bit value. OSF1 manages to have a variable location for
* the user stack which we should probably also support.
*/
-#define USRSTACK (0x12000000LL - (UPAGES*PAGE_SIZE))
+#define USRSTACK (0x12000000LL)
/*
* Virtual memory related constants, all in bytes
diff --git a/sys/alpha/linux/linux_proto.h b/sys/alpha/linux/linux_proto.h
index 9caa5ea..31f052c 100644
--- a/sys/alpha/linux/linux_proto.h
+++ b/sys/alpha/linux/linux_proto.h
@@ -15,6 +15,8 @@
struct proc;
+struct thread;
+
#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
0 : sizeof(register_t) - sizeof(t))
@@ -594,144 +596,144 @@ struct linux_getdents64_args {
char dirent_l_[PADL_(void *)]; void * dirent; char dirent_r_[PADR_(void *)];
char count_l_[PADL_(l_uint)]; l_uint count; char count_r_[PADR_(l_uint)];
};
-int linux_fork __P((struct proc *, struct linux_fork_args *));
-int osf1_wait4 __P((struct proc *, struct osf1_wait4_args *));
-int linux_link __P((struct proc *, struct linux_link_args *));
-int linux_unlink __P((struct proc *, struct linux_unlink_args *));
-int linux_chdir __P((struct proc *, struct linux_chdir_args *));
-int linux_mknod __P((struct proc *, struct linux_mknod_args *));
-int linux_chmod __P((struct proc *, struct linux_chmod_args *));
-int linux_chown __P((struct proc *, struct linux_chown_args *));
-int linux_brk __P((struct proc *, struct linux_brk_args *));
-int linux_lseek __P((struct proc *, struct linux_lseek_args *));
-int linux_getpid __P((struct proc *, struct linux_getpid_args *));
-int linux_umount __P((struct proc *, struct linux_umount_args *));
-int linux_getuid __P((struct proc *, struct linux_getuid_args *));
-int linux_ptrace __P((struct proc *, struct linux_ptrace_args *));
-int linux_access __P((struct proc *, struct linux_access_args *));
-int linux_kill __P((struct proc *, struct linux_kill_args *));
-int linux_open __P((struct proc *, struct linux_open_args *));
-int linux_getgid __P((struct proc *, struct linux_getgid_args *));
-int osf1_sigprocmask __P((struct proc *, struct osf1_sigprocmask_args *));
-int linux_sigpending __P((struct proc *, struct linux_sigpending_args *));
-int linux_ioctl __P((struct proc *, struct linux_ioctl_args *));
-int linux_symlink __P((struct proc *, struct linux_symlink_args *));
-int linux_readlink __P((struct proc *, struct linux_readlink_args *));
-int linux_execve __P((struct proc *, struct linux_execve_args *));
-int linux_getpagesize __P((struct proc *, struct linux_getpagesize_args *));
-int linux_vfork __P((struct proc *, struct linux_vfork_args *));
-int linux_newstat __P((struct proc *, struct linux_newstat_args *));
-int linux_newlstat __P((struct proc *, struct linux_newlstat_args *));
-int linux_mmap __P((struct proc *, struct linux_mmap_args *));
-int linux_munmap __P((struct proc *, struct linux_munmap_args *));
-int linux_mprotect __P((struct proc *, struct linux_mprotect_args *));
-int linux_madvise __P((struct proc *, struct linux_madvise_args *));
-int linux_vhangup __P((struct proc *, struct linux_vhangup_args *));
-int linux_setgroups __P((struct proc *, struct linux_setgroups_args *));
-int linux_getgroups __P((struct proc *, struct linux_getgroups_args *));
-int linux_setpgid __P((struct proc *, struct linux_setpgid_args *));
-int osf1_setitimer __P((struct proc *, struct osf1_setitimer_args *));
-int linux_gethostname __P((struct proc *, struct linux_gethostname_args *));
-int linux_getdtablesize __P((struct proc *, struct linux_getdtablesize_args *));
-int linux_newfstat __P((struct proc *, struct linux_newfstat_args *));
-int linux_fcntl __P((struct proc *, struct linux_fcntl_args *));
-int osf1_select __P((struct proc *, struct osf1_select_args *));
-int osf1_socket __P((struct proc *, struct osf1_socket_args *));
-int linux_connect __P((struct proc *, struct linux_connect_args *));
-int osf1_sigreturn __P((struct proc *, struct osf1_sigreturn_args *));
-int osf1_sigsuspend __P((struct proc *, struct osf1_sigsuspend_args *));
-int linux_recvmsg __P((struct proc *, struct linux_recvmsg_args *));
-int linux_sendmsg __P((struct proc *, struct linux_sendmsg_args *));
-int osf1_gettimeofday __P((struct proc *, struct osf1_gettimeofday_args *));
-int osf1_getrusage __P((struct proc *, struct osf1_getrusage_args *));
-int linux_rename __P((struct proc *, struct linux_rename_args *));
-int linux_truncate __P((struct proc *, struct linux_truncate_args *));
-int osf1_sendto __P((struct proc *, struct osf1_sendto_args *));
-int linux_socketpair __P((struct proc *, struct linux_socketpair_args *));
-int linux_mkdir __P((struct proc *, struct linux_mkdir_args *));
-int linux_rmdir __P((struct proc *, struct linux_rmdir_args *));
-int linux_getrlimit __P((struct proc *, struct linux_getrlimit_args *));
-int linux_setrlimit __P((struct proc *, struct linux_setrlimit_args *));
-int linux_quotactl __P((struct proc *, struct linux_quotactl_args *));
-int osf1_sigaction __P((struct proc *, struct osf1_sigaction_args *));
-int linux_msgctl __P((struct proc *, struct linux_msgctl_args *));
-int linux_msgget __P((struct proc *, struct linux_msgget_args *));
-int linux_msgrcv __P((struct proc *, struct linux_msgrcv_args *));
-int linux_msgsnd __P((struct proc *, struct linux_msgsnd_args *));
-int linux_semctl __P((struct proc *, struct linux_semctl_args *));
-int linux_semget __P((struct proc *, struct linux_semget_args *));
-int linux_semop __P((struct proc *, struct linux_semop_args *));
-int linux_lchown __P((struct proc *, struct linux_lchown_args *));
-int linux_shmat __P((struct proc *, struct linux_shmat_args *));
-int linux_shmctl __P((struct proc *, struct linux_shmctl_args *));
-int linux_shmdt __P((struct proc *, struct linux_shmdt_args *));
-int linux_shmget __P((struct proc *, struct linux_shmget_args *));
-int linux_msync __P((struct proc *, struct linux_msync_args *));
-int linux_getpgid __P((struct proc *, struct linux_getpgid_args *));
-int linux_getsid __P((struct proc *, struct linux_getsid_args *));
-int linux_sigaltstack __P((struct proc *, struct linux_sigaltstack_args *));
-int osf1_sysinfo __P((struct proc *, struct osf1_sysinfo_args *));
-int linux_sysfs __P((struct proc *, struct linux_sysfs_args *));
-int osf1_getsysinfo __P((struct proc *, struct osf1_getsysinfo_args *));
-int osf1_setsysinfo __P((struct proc *, struct osf1_setsysinfo_args *));
-int linux_bdflush __P((struct proc *, struct linux_bdflush_args *));
-int linux_sethae __P((struct proc *, struct linux_sethae_args *));
-int linux_mount __P((struct proc *, struct linux_mount_args *));
-int linux_old_adjtimex __P((struct proc *, struct linux_old_adjtimex_args *));
-int linux_swapoff __P((struct proc *, struct linux_swapoff_args *));
-int linux_getdents __P((struct proc *, struct linux_getdents_args *));
-int linux_create_module __P((struct proc *, struct linux_create_module_args *));
-int linux_init_module __P((struct proc *, struct linux_init_module_args *));
-int linux_delete_module __P((struct proc *, struct linux_delete_module_args *));
-int linux_get_kernel_syms __P((struct proc *, struct linux_get_kernel_syms_args *));
-int linux_syslog __P((struct proc *, struct linux_syslog_args *));
-int linux_reboot __P((struct proc *, struct linux_reboot_args *));
-int linux_clone __P((struct proc *, struct linux_clone_args *));
-int linux_uselib __P((struct proc *, struct linux_uselib_args *));
-int linux_sysinfo __P((struct proc *, struct linux_sysinfo_args *));
-int linux_sysctl __P((struct proc *, struct linux_sysctl_args *));
-int linux_oldumount __P((struct proc *, struct linux_oldumount_args *));
-int linux_times __P((struct proc *, struct linux_times_args *));
-int linux_personality __P((struct proc *, struct linux_personality_args *));
-int linux_setfsuid __P((struct proc *, struct linux_setfsuid_args *));
-int linux_setfsgid __P((struct proc *, struct linux_setfsgid_args *));
-int linux_ustat __P((struct proc *, struct linux_ustat_args *));
-int linux_statfs __P((struct proc *, struct linux_statfs_args *));
-int linux_fstatfs __P((struct proc *, struct linux_fstatfs_args *));
-int linux_sched_setscheduler __P((struct proc *, struct linux_sched_setscheduler_args *));
-int linux_sched_getscheduler __P((struct proc *, struct linux_sched_getscheduler_args *));
-int linux_sched_get_priority_max __P((struct proc *, struct linux_sched_get_priority_max_args *));
-int linux_sched_get_priority_min __P((struct proc *, struct linux_sched_get_priority_min_args *));
-int linux_newuname __P((struct proc *, struct linux_newuname_args *));
-int linux_mremap __P((struct proc *, struct linux_mremap_args *));
-int linux_nfsservctl __P((struct proc *, struct linux_nfsservctl_args *));
-int linux_pciconfig_read __P((struct proc *, struct linux_pciconfig_read_args *));
-int linux_pciconfig_write __P((struct proc *, struct linux_pciconfig_write_args *));
-int linux_query_module __P((struct proc *, struct linux_query_module_args *));
-int linux_prctl __P((struct proc *, struct linux_prctl_args *));
-int linux_pread __P((struct proc *, struct linux_pread_args *));
-int linux_pwrite __P((struct proc *, struct linux_pwrite_args *));
-int linux_rt_sigreturn __P((struct proc *, struct linux_rt_sigreturn_args *));
-int linux_rt_sigaction __P((struct proc *, struct linux_rt_sigaction_args *));
-int linux_rt_sigprocmask __P((struct proc *, struct linux_rt_sigprocmask_args *));
-int linux_rt_sigpending __P((struct proc *, struct linux_rt_sigpending_args *));
-int linux_rt_sigtimedwait __P((struct proc *, struct linux_rt_sigtimedwait_args *));
-int linux_rt_sigqueueinfo __P((struct proc *, struct linux_rt_sigqueueinfo_args *));
-int linux_rt_sigsuspend __P((struct proc *, struct linux_rt_sigsuspend_args *));
-int linux_select __P((struct proc *, struct linux_select_args *));
-int linux_getitimer __P((struct proc *, struct linux_getitimer_args *));
-int linux_setitimer __P((struct proc *, struct linux_setitimer_args *));
-int linux_utimes __P((struct proc *, struct linux_utimes_args *));
-int linux_wait4 __P((struct proc *, struct linux_wait4_args *));
-int linux_adjtimex __P((struct proc *, struct linux_adjtimex_args *));
-int linux_getcwd __P((struct proc *, struct linux_getcwd_args *));
-int linux_capget __P((struct proc *, struct linux_capget_args *));
-int linux_capset __P((struct proc *, struct linux_capset_args *));
-int linux_sendfile __P((struct proc *, struct linux_sendfile_args *));
-int linux_pivot_root __P((struct proc *, struct linux_pivot_root_args *));
-int linux_mincore __P((struct proc *, struct linux_mincore_args *));
-int linux_pciconfig_iobase __P((struct proc *, struct linux_pciconfig_iobase_args *));
-int linux_getdents64 __P((struct proc *, struct linux_getdents64_args *));
+int linux_fork __P((struct thread *, struct linux_fork_args *));
+int osf1_wait4 __P((struct thread *, struct osf1_wait4_args *));
+int linux_link __P((struct thread *, struct linux_link_args *));
+int linux_unlink __P((struct thread *, struct linux_unlink_args *));
+int linux_chdir __P((struct thread *, struct linux_chdir_args *));
+int linux_mknod __P((struct thread *, struct linux_mknod_args *));
+int linux_chmod __P((struct thread *, struct linux_chmod_args *));
+int linux_chown __P((struct thread *, struct linux_chown_args *));
+int linux_brk __P((struct thread *, struct linux_brk_args *));
+int linux_lseek __P((struct thread *, struct linux_lseek_args *));
+int linux_getpid __P((struct thread *, struct linux_getpid_args *));
+int linux_umount __P((struct thread *, struct linux_umount_args *));
+int linux_getuid __P((struct thread *, struct linux_getuid_args *));
+int linux_ptrace __P((struct thread *, struct linux_ptrace_args *));
+int linux_access __P((struct thread *, struct linux_access_args *));
+int linux_kill __P((struct thread *, struct linux_kill_args *));
+int linux_open __P((struct thread *, struct linux_open_args *));
+int linux_getgid __P((struct thread *, struct linux_getgid_args *));
+int osf1_sigprocmask __P((struct thread *, struct osf1_sigprocmask_args *));
+int linux_sigpending __P((struct thread *, struct linux_sigpending_args *));
+int linux_ioctl __P((struct thread *, struct linux_ioctl_args *));
+int linux_symlink __P((struct thread *, struct linux_symlink_args *));
+int linux_readlink __P((struct thread *, struct linux_readlink_args *));
+int linux_execve __P((struct thread *, struct linux_execve_args *));
+int linux_getpagesize __P((struct thread *, struct linux_getpagesize_args *));
+int linux_vfork __P((struct thread *, struct linux_vfork_args *));
+int linux_newstat __P((struct thread *, struct linux_newstat_args *));
+int linux_newlstat __P((struct thread *, struct linux_newlstat_args *));
+int linux_mmap __P((struct thread *, struct linux_mmap_args *));
+int linux_munmap __P((struct thread *, struct linux_munmap_args *));
+int linux_mprotect __P((struct thread *, struct linux_mprotect_args *));
+int linux_madvise __P((struct thread *, struct linux_madvise_args *));
+int linux_vhangup __P((struct thread *, struct linux_vhangup_args *));
+int linux_setgroups __P((struct thread *, struct linux_setgroups_args *));
+int linux_getgroups __P((struct thread *, struct linux_getgroups_args *));
+int linux_setpgid __P((struct thread *, struct linux_setpgid_args *));
+int osf1_setitimer __P((struct thread *, struct osf1_setitimer_args *));
+int linux_gethostname __P((struct thread *, struct linux_gethostname_args *));
+int linux_getdtablesize __P((struct thread *, struct linux_getdtablesize_args *));
+int linux_newfstat __P((struct thread *, struct linux_newfstat_args *));
+int linux_fcntl __P((struct thread *, struct linux_fcntl_args *));
+int osf1_select __P((struct thread *, struct osf1_select_args *));
+int osf1_socket __P((struct thread *, struct osf1_socket_args *));
+int linux_connect __P((struct thread *, struct linux_connect_args *));
+int osf1_sigreturn __P((struct thread *, struct osf1_sigreturn_args *));
+int osf1_sigsuspend __P((struct thread *, struct osf1_sigsuspend_args *));
+int linux_recvmsg __P((struct thread *, struct linux_recvmsg_args *));
+int linux_sendmsg __P((struct thread *, struct linux_sendmsg_args *));
+int osf1_gettimeofday __P((struct thread *, struct osf1_gettimeofday_args *));
+int osf1_getrusage __P((struct thread *, struct osf1_getrusage_args *));
+int linux_rename __P((struct thread *, struct linux_rename_args *));
+int linux_truncate __P((struct thread *, struct linux_truncate_args *));
+int osf1_sendto __P((struct thread *, struct osf1_sendto_args *));
+int linux_socketpair __P((struct thread *, struct linux_socketpair_args *));
+int linux_mkdir __P((struct thread *, struct linux_mkdir_args *));
+int linux_rmdir __P((struct thread *, struct linux_rmdir_args *));
+int linux_getrlimit __P((struct thread *, struct linux_getrlimit_args *));
+int linux_setrlimit __P((struct thread *, struct linux_setrlimit_args *));
+int linux_quotactl __P((struct thread *, struct linux_quotactl_args *));
+int osf1_sigaction __P((struct thread *, struct osf1_sigaction_args *));
+int linux_msgctl __P((struct thread *, struct linux_msgctl_args *));
+int linux_msgget __P((struct thread *, struct linux_msgget_args *));
+int linux_msgrcv __P((struct thread *, struct linux_msgrcv_args *));
+int linux_msgsnd __P((struct thread *, struct linux_msgsnd_args *));
+int linux_semctl __P((struct thread *, struct linux_semctl_args *));
+int linux_semget __P((struct thread *, struct linux_semget_args *));
+int linux_semop __P((struct thread *, struct linux_semop_args *));
+int linux_lchown __P((struct thread *, struct linux_lchown_args *));
+int linux_shmat __P((struct thread *, struct linux_shmat_args *));
+int linux_shmctl __P((struct thread *, struct linux_shmctl_args *));
+int linux_shmdt __P((struct thread *, struct linux_shmdt_args *));
+int linux_shmget __P((struct thread *, struct linux_shmget_args *));
+int linux_msync __P((struct thread *, struct linux_msync_args *));
+int linux_getpgid __P((struct thread *, struct linux_getpgid_args *));
+int linux_getsid __P((struct thread *, struct linux_getsid_args *));
+int linux_sigaltstack __P((struct thread *, struct linux_sigaltstack_args *));
+int osf1_sysinfo __P((struct thread *, struct osf1_sysinfo_args *));
+int linux_sysfs __P((struct thread *, struct linux_sysfs_args *));
+int osf1_getsysinfo __P((struct thread *, struct osf1_getsysinfo_args *));
+int osf1_setsysinfo __P((struct thread *, struct osf1_setsysinfo_args *));
+int linux_bdflush __P((struct thread *, struct linux_bdflush_args *));
+int linux_sethae __P((struct thread *, struct linux_sethae_args *));
+int linux_mount __P((struct thread *, struct linux_mount_args *));
+int linux_old_adjtimex __P((struct thread *, struct linux_old_adjtimex_args *));
+int linux_swapoff __P((struct thread *, struct linux_swapoff_args *));
+int linux_getdents __P((struct thread *, struct linux_getdents_args *));
+int linux_create_module __P((struct thread *, struct linux_create_module_args *));
+int linux_init_module __P((struct thread *, struct linux_init_module_args *));
+int linux_delete_module __P((struct thread *, struct linux_delete_module_args *));
+int linux_get_kernel_syms __P((struct thread *, struct linux_get_kernel_syms_args *));
+int linux_syslog __P((struct thread *, struct linux_syslog_args *));
+int linux_reboot __P((struct thread *, struct linux_reboot_args *));
+int linux_clone __P((struct thread *, struct linux_clone_args *));
+int linux_uselib __P((struct thread *, struct linux_uselib_args *));
+int linux_sysinfo __P((struct thread *, struct linux_sysinfo_args *));
+int linux_sysctl __P((struct thread *, struct linux_sysctl_args *));
+int linux_oldumount __P((struct thread *, struct linux_oldumount_args *));
+int linux_times __P((struct thread *, struct linux_times_args *));
+int linux_personality __P((struct thread *, struct linux_personality_args *));
+int linux_setfsuid __P((struct thread *, struct linux_setfsuid_args *));
+int linux_setfsgid __P((struct thread *, struct linux_setfsgid_args *));
+int linux_ustat __P((struct thread *, struct linux_ustat_args *));
+int linux_statfs __P((struct thread *, struct linux_statfs_args *));
+int linux_fstatfs __P((struct thread *, struct linux_fstatfs_args *));
+int linux_sched_setscheduler __P((struct thread *, struct linux_sched_setscheduler_args *));
+int linux_sched_getscheduler __P((struct thread *, struct linux_sched_getscheduler_args *));
+int linux_sched_get_priority_max __P((struct thread *, struct linux_sched_get_priority_max_args *));
+int linux_sched_get_priority_min __P((struct thread *, struct linux_sched_get_priority_min_args *));
+int linux_newuname __P((struct thread *, struct linux_newuname_args *));
+int linux_mremap __P((struct thread *, struct linux_mremap_args *));
+int linux_nfsservctl __P((struct thread *, struct linux_nfsservctl_args *));
+int linux_pciconfig_read __P((struct thread *, struct linux_pciconfig_read_args *));
+int linux_pciconfig_write __P((struct thread *, struct linux_pciconfig_write_args *));
+int linux_query_module __P((struct thread *, struct linux_query_module_args *));
+int linux_prctl __P((struct thread *, struct linux_prctl_args *));
+int linux_pread __P((struct thread *, struct linux_pread_args *));
+int linux_pwrite __P((struct thread *, struct linux_pwrite_args *));
+int linux_rt_sigreturn __P((struct thread *, struct linux_rt_sigreturn_args *));
+int linux_rt_sigaction __P((struct thread *, struct linux_rt_sigaction_args *));
+int linux_rt_sigprocmask __P((struct thread *, struct linux_rt_sigprocmask_args *));
+int linux_rt_sigpending __P((struct thread *, struct linux_rt_sigpending_args *));
+int linux_rt_sigtimedwait __P((struct thread *, struct linux_rt_sigtimedwait_args *));
+int linux_rt_sigqueueinfo __P((struct thread *, struct linux_rt_sigqueueinfo_args *));
+int linux_rt_sigsuspend __P((struct thread *, struct linux_rt_sigsuspend_args *));
+int linux_select __P((struct thread *, struct linux_select_args *));
+int linux_getitimer __P((struct thread *, struct linux_getitimer_args *));
+int linux_setitimer __P((struct thread *, struct linux_setitimer_args *));
+int linux_utimes __P((struct thread *, struct linux_utimes_args *));
+int linux_wait4 __P((struct thread *, struct linux_wait4_args *));
+int linux_adjtimex __P((struct thread *, struct linux_adjtimex_args *));
+int linux_getcwd __P((struct thread *, struct linux_getcwd_args *));
+int linux_capget __P((struct thread *, struct linux_capget_args *));
+int linux_capset __P((struct thread *, struct linux_capset_args *));
+int linux_sendfile __P((struct thread *, struct linux_sendfile_args *));
+int linux_pivot_root __P((struct thread *, struct linux_pivot_root_args *));
+int linux_mincore __P((struct thread *, struct linux_mincore_args *));
+int linux_pciconfig_iobase __P((struct thread *, struct linux_pciconfig_iobase_args *));
+int linux_getdents64 __P((struct thread *, struct linux_getdents64_args *));
#ifdef COMPAT_43
diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c
index f6b67b8..ee3dbef 100644
--- a/sys/alpha/tlsb/zs_tlsb.c
+++ b/sys/alpha/tlsb/zs_tlsb.c
@@ -264,7 +264,7 @@ zs_cnputc(dev_t dev, int c)
static int
-zsopen(dev_t dev, int flag, int mode, struct proc *p)
+zsopen(dev_t dev, int flag, int mode, struct thread *td)
{
struct zs_softc *sc = ZS_SOFTC(minor(dev));
struct tty *tp;
@@ -290,7 +290,7 @@ zsopen(dev_t dev, int flag, int mode, struct proc *p)
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
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;
}
@@ -311,7 +311,7 @@ zsopen(dev_t dev, int flag, int mode, struct proc *p)
}
static int
-zsclose(dev_t dev, int flag, int mode, struct proc *p)
+zsclose(dev_t dev, int flag, int mode, struct thread *td)
{
struct zs_softc *sc = ZS_SOFTC(minor(dev));
struct tty *tp;
@@ -332,7 +332,7 @@ zsclose(dev_t dev, int flag, int mode, struct proc *p)
}
static int
-zsioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+zsioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
struct zs_softc *sc = ZS_SOFTC(minor(dev));
struct tty *tp;
@@ -343,7 +343,7 @@ zsioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
tp = ZS_SOFTC(minor(dev))->tp;
- 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);
OpenPOWER on IntegriCloud