Index: pc98/i386/machdep.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/i386/machdep.c,v retrieving revision 1.244 diff -u -r1.244 machdep.c --- pc98/i386/machdep.c 2001/09/12 08:38:01 1.244 +++ pc98/i386/machdep.c 2001/09/13 01:48:31 @@ -302,14 +302,16 @@ struct osigframe sf; struct osigframe *fp; struct proc *p; + struct thread *td; struct sigacts *psp; struct trapframe *regs; int oonstack; - p = curproc; + td = curthread; + p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; - regs = p->p_frame; + regs = td->td_frame; oonstack = sigonstack(regs->tf_esp); /* Allocate and validate space for the signal handler context. */ @@ -399,7 +401,7 @@ if (regs->tf_eflags & PSL_VM) { /* XXX confusing names: `tf' isn't a trapframe; `regs' is. */ struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs; - struct vm86_kernel *vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86; + struct vm86_kernel *vm86 = &td->td_pcb->pcb_ext->ext_vm86; sf.sf_siginfo.si_sc.sc_gs = tf->tf_vm86_gs; sf.sf_siginfo.si_sc.sc_fs = tf->tf_vm86_fs; @@ -422,7 +424,7 @@ * ...Kill the process. */ PROC_LOCK(p); - sigexit(p, SIGILL); + sigexit(td, SIGILL); /* NOTREACHED */ } @@ -447,12 +449,14 @@ { struct sigframe sf; struct proc *p; + struct thread *td; struct sigacts *psp; struct trapframe *regs; struct sigframe *sfp; int oonstack; - p = curproc; + td = curthread; + p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; #ifdef COMPAT_43 @@ -461,7 +465,7 @@ return; } #endif - regs = p->p_frame; + regs = td->td_frame; oonstack = sigonstack(regs->tf_esp); /* Save user context. */ @@ -541,7 +545,7 @@ */ if (regs->tf_eflags & PSL_VM) { struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs; - struct vm86_kernel *vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86; + struct vm86_kernel *vm86 = &td->td_pcb->pcb_ext->ext_vm86; sf.sf_uc.uc_mcontext.mc_gs = tf->tf_vm86_gs; sf.sf_uc.uc_mcontext.mc_fs = tf->tf_vm86_fs; @@ -574,7 +578,7 @@ * ...Kill the process. */ PROC_LOCK(p); - sigexit(p, SIGILL); + sigexit(td, SIGILL); /* NOTREACHED */ } @@ -599,17 +603,18 @@ */ #ifdef COMPAT_43 int -osigreturn(p, uap) - struct proc *p; +osigreturn(td, uap) + struct thread *td; struct osigreturn_args /* { struct osigcontext *sigcntxp; } */ *uap; { struct trapframe *regs; struct osigcontext *scp; + struct proc *p = td->td_proc; int eflags; - regs = p->p_frame; + regs = td->td_frame; scp = uap->sigcntxp; if (!useracc((caddr_t)scp, sizeof(*scp), VM_PROT_READ)) return (EFAULT); @@ -622,9 +627,9 @@ * if pcb_ext == 0 or vm86_inited == 0, the user hasn't * set up the vm86 area, and we can't enter vm86 mode. */ - if (p->p_addr->u_pcb.pcb_ext == 0) + if (td->td_pcb->pcb_ext == 0) return (EINVAL); - vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86; + vm86 = &td->td_pcb->pcb_ext->ext_vm86; if (vm86->vm86_inited == 0) return (EINVAL); @@ -710,12 +715,13 @@ #endif int -sigreturn(p, uap) - struct proc *p; +sigreturn(td, uap) + struct thread *td; struct sigreturn_args /* { ucontext_t *sigcntxp; } */ *uap; { + struct proc *p = td->td_proc; struct trapframe *regs; ucontext_t *ucp; int cs, eflags; @@ -725,7 +731,7 @@ if (!useracc((caddr_t)ucp, sizeof(struct osigcontext), VM_PROT_READ)) return (EFAULT); if (((struct osigcontext *)ucp)->sc_trapno == 0x01d516) - return (osigreturn(p, (struct osigreturn_args *)uap)); + return (osigreturn(td, (struct osigreturn_args *)uap)); /* * Since ucp is not an osigcontext but a ucontext_t, we have to * check again if all of it is accessible. A ucontext_t is @@ -737,7 +743,7 @@ if (!useracc((caddr_t)ucp, sizeof(*ucp), VM_PROT_READ)) return (EFAULT); - regs = p->p_frame; + regs = td->td_frame; eflags = ucp->uc_mcontext.mc_eflags; if (eflags & PSL_VM) { struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs; @@ -747,9 +753,9 @@ * if pcb_ext == 0 or vm86_inited == 0, the user hasn't * set up the vm86 area, and we can't enter vm86 mode. */ - if (p->p_addr->u_pcb.pcb_ext == 0) + if (td->td_pcb->pcb_ext == 0) return (EINVAL); - vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86; + vm86 = &td->td_pcb->pcb_ext->ext_vm86; if (vm86->vm86_inited == 0) return (EINVAL); @@ -878,14 +884,14 @@ * Clear registers on exec */ void -setregs(p, entry, stack, ps_strings) - struct proc *p; +setregs(td, entry, stack, ps_strings) + struct thread *td; u_long entry; u_long stack; u_long ps_strings; { - struct trapframe *regs = p->p_frame; - struct pcb *pcb = &p->p_addr->u_pcb; + struct trapframe *regs = td->td_frame; + struct pcb *pcb = td->td_pcb; if (pcb->pcb_ldt) user_ldt_free(pcb); @@ -938,7 +944,7 @@ * traps to the emulator (if it is done at all) mainly because * emulators don't provide an entry point for initialization. */ - p->p_addr->u_pcb.pcb_flags &= ~FP_SOFTFP; + td->td_pcb->pcb_flags &= ~FP_SOFTFP; /* * Arrange to trap the next npx or `fwait' instruction (see npx.c @@ -961,7 +967,7 @@ * Make sure sure edx is 0x0 on entry. Linux binaries depend * on it. */ - p->p_retval[1] = 0; + td->td_retval[1] = 0; } void @@ -1029,7 +1035,8 @@ static struct i386tss dblfault_tss; static char dblfault_stack[PAGE_SIZE]; -extern struct user *proc0paddr; +extern struct user *proc0uarea; +extern vm_offset_t proc0kstack; /* software prototypes -- in more palatable form */ @@ -1718,8 +1725,12 @@ struct region_descriptor r_gdt, r_idt; #endif - proc0.p_addr = proc0paddr; - + proc_linkup(&proc0); + 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; atdevbase = ISA_HOLE_START + KERNBASE; #ifdef PC98 @@ -1785,10 +1796,10 @@ lgdt(&r_gdt); /* setup curproc so that mutexes work */ - PCPU_SET(curproc, &proc0); + PCPU_SET(curthread, thread0); PCPU_SET(spinlocks, NULL); - LIST_INIT(&proc0.p_contested); + LIST_INIT(&thread0->td_contested); /* * Initialize mutexes. @@ -1892,8 +1903,8 @@ initializecpu(); /* Initialize CPU registers */ /* make an initial tss so cpu can get interrupt stack on syscall! */ - PCPU_SET(common_tss.tss_esp0, - (int) proc0.p_addr + UPAGES*PAGE_SIZE - 16); + PCPU_SET(common_tss.tss_esp0, thread0->td_kstack + + KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb) - 16); PCPU_SET(common_tss.tss_ss0, GSEL(GDATA_SEL, SEL_KPL)); gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); private_tss = 0; @@ -1948,10 +1959,10 @@ _udatasel = LSEL(LUDATA_SEL, SEL_UPL); /* setup proc 0's pcb */ - proc0.p_addr->u_pcb.pcb_flags = 0; - proc0.p_addr->u_pcb.pcb_cr3 = (int)IdlePTD; - proc0.p_addr->u_pcb.pcb_ext = 0; - proc0.p_frame = &proc0_tf; + thread0->td_pcb->pcb_flags = 0; /* XXXKSE */ + thread0->td_pcb->pcb_cr3 = (int)IdlePTD; + thread0->td_pcb->pcb_ext = 0; + thread0->td_frame = &proc0_tf; } #if defined(I586_CPU) && !defined(NO_F00F_HACK) @@ -1994,31 +2005,26 @@ #endif /* defined(I586_CPU) && !NO_F00F_HACK */ int -ptrace_set_pc(p, addr) - struct proc *p; - unsigned long addr; +ptrace_set_pc(struct thread *td, unsigned long addr) { - p->p_frame->tf_eip = addr; + td->td_frame->tf_eip = addr; return (0); } int -ptrace_single_step(p) - struct proc *p; +ptrace_single_step(struct thread *td) { - p->p_frame->tf_eflags |= PSL_T; + td->td_frame->tf_eflags |= PSL_T; return (0); } int -fill_regs(p, regs) - struct proc *p; - struct reg *regs; +fill_regs(struct thread *td, struct reg *regs) { struct pcb *pcb; struct trapframe *tp; - tp = p->p_frame; + tp = td->td_frame; regs->r_fs = tp->tf_fs; regs->r_es = tp->tf_es; regs->r_ds = tp->tf_ds; @@ -2034,20 +2040,18 @@ regs->r_eflags = tp->tf_eflags; regs->r_esp = tp->tf_esp; regs->r_ss = tp->tf_ss; - pcb = &p->p_addr->u_pcb; + pcb = td->td_pcb; regs->r_gs = pcb->pcb_gs; return (0); } int -set_regs(p, regs) - struct proc *p; - struct reg *regs; +set_regs(struct thread *td, struct reg *regs) { struct pcb *pcb; struct trapframe *tp; - tp = p->p_frame; + tp = td->td_frame; if (!EFL_SECURE(regs->r_eflags, tp->tf_eflags) || !CS_SECURE(regs->r_cs)) return (EINVAL); @@ -2066,7 +2070,7 @@ tp->tf_eflags = regs->r_eflags; tp->tf_esp = regs->r_esp; tp->tf_ss = regs->r_ss; - pcb = &p->p_addr->u_pcb; + pcb = td->td_pcb; pcb->pcb_gs = regs->r_gs; return (0); } @@ -2126,45 +2130,39 @@ #endif /* CPU_ENABLE_SSE */ int -fill_fpregs(p, fpregs) - struct proc *p; - struct fpreg *fpregs; +fill_fpregs(struct thread *td, struct fpreg *fpregs) { #ifdef CPU_ENABLE_SSE if (cpu_fxsr) { - fill_fpregs_xmm(&p->p_addr->u_pcb.pcb_save.sv_xmm, + fill_fpregs_xmm(&td->td_pcb->pcb_save.sv_xmm, (struct save87 *)fpregs); return (0); } #endif /* CPU_ENABLE_SSE */ - bcopy(&p->p_addr->u_pcb.pcb_save.sv_87, fpregs, sizeof *fpregs); + bcopy(&td->td_pcb->pcb_save.sv_87, fpregs, sizeof *fpregs); return (0); } int -set_fpregs(p, fpregs) - struct proc *p; - struct fpreg *fpregs; +set_fpregs(struct thread *td, struct fpreg *fpregs) { #ifdef CPU_ENABLE_SSE if (cpu_fxsr) { set_fpregs_xmm((struct save87 *)fpregs, - &p->p_addr->u_pcb.pcb_save.sv_xmm); + &td->td_pcb->pcb_save.sv_xmm); return (0); } #endif /* CPU_ENABLE_SSE */ - bcopy(fpregs, &p->p_addr->u_pcb.pcb_save.sv_87, sizeof *fpregs); + bcopy(fpregs, &td->td_pcb->pcb_save.sv_87, sizeof *fpregs); return (0); } int -fill_dbregs(p, dbregs) - struct proc *p; - struct dbreg *dbregs; +fill_dbregs(struct thread *td, struct dbreg *dbregs) { struct pcb *pcb; - if (p == NULL) { + if (td == NULL) { dbregs->dr0 = rdr0(); dbregs->dr1 = rdr1(); dbregs->dr2 = rdr2(); @@ -2175,7 +2173,7 @@ dbregs->dr7 = rdr7(); } else { - pcb = &p->p_addr->u_pcb; + pcb = td->td_pcb; dbregs->dr0 = pcb->pcb_dr0; dbregs->dr1 = pcb->pcb_dr1; dbregs->dr2 = pcb->pcb_dr2; @@ -2189,15 +2187,13 @@ } int -set_dbregs(p, dbregs) - struct proc *p; - struct dbreg *dbregs; +set_dbregs(struct thread *td, struct dbreg *dbregs) { struct pcb *pcb; int i; u_int32_t mask1, mask2; - if (p == NULL) { + if (td == NULL) { load_dr0(dbregs->dr0); load_dr1(dbregs->dr1); load_dr2(dbregs->dr2); @@ -2219,7 +2215,7 @@ if ((dbregs->dr7 & mask1) == mask2) return (EINVAL); - pcb = &p->p_addr->u_pcb; + pcb = td->td_pcb; /* * Don't let a process set a breakpoint that is not within the @@ -2236,7 +2232,7 @@ * from within kernel mode? */ - if (suser(p) != 0) { + if (suser_td(td) != 0) { if (dbregs->dr7 & 0x3) { /* dr0 is enabled */ if (dbregs->dr0 >= VM_MAXUSER_ADDRESS) Index: pc98/pc98/fd.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/fd.c,v retrieving revision 1.109 diff -u -r1.109 fd.c --- pc98/pc98/fd.c 2001/07/23 13:07:24 1.109 +++ pc98/pc98/fd.c 2001/09/13 18:02:35 @@ -429,7 +429,7 @@ static timeout_t fd_pseudointr; static int fdstate(struct fdc_data *); static int retrier(struct fdc_data *); -static int fdformat(dev_t, struct fd_formb *, struct proc *); +static int fdformat(dev_t, struct fd_formb *, struct thread *); static int enable_fifo(fdc_p fdc); static void fd_clone (void *arg, char *name, int namelen, dev_t *dev); @@ -1863,7 +1863,7 @@ /* fdopen/fdclose */ /****************************************************************************/ int -Fdopen(dev_t dev, int flags, int mode, struct proc *p) +Fdopen(dev_t dev, int flags, int mode, struct thread *td) { fdu_t fdu = FDUNIT(minor(dev)); int type = FDTYPE(minor(dev)); @@ -1956,7 +1956,7 @@ } int -fdclose(dev_t dev, int flags, int mode, struct proc *p) +fdclose(dev_t dev, int flags, int mode, struct thread *td) { fdu_t fdu = FDUNIT(minor(dev)); struct fd_data *fd; @@ -2837,11 +2837,12 @@ } static int -fdformat(dev, finfo, p) +fdformat(dev, finfo, td) dev_t dev; struct fd_formb *finfo; - struct proc *p; + struct thread *td; { + struct proc *p = td->td_proc; fdu_t fdu; fd_p fd; @@ -2908,12 +2909,12 @@ */ static int -fdioctl(dev, cmd, addr, flag, p) +fdioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { fdu_t fdu = FDUNIT(minor(dev)); fd_p fd = devclass_get_softc(fd_devclass, fdu); @@ -2979,7 +2980,7 @@ FD_FORMAT_VERSION) error = EINVAL; /* wrong version of formatting prog */ else - error = fdformat(dev, (struct fd_formb *)addr, p); + error = fdformat(dev, (struct fd_formb *)addr, td); break; case FD_GTYPE: /* get drive type */ @@ -2988,7 +2989,7 @@ case FD_STYPE: /* set drive type */ /* this is considered harmful; only allow for superuser */ - if (suser(p) != 0) + if (suser_td(td) != 0) return EPERM; *fd->ft = *(struct fd_type *)addr; break; @@ -3002,7 +3003,7 @@ break; case FD_CLRERR: - if (suser(p) != 0) + if (suser_td(td) != 0) return EPERM; fd->fdc->fdc_errs = 0; break; Index: pc98/pc98/mse.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/mse.c,v retrieving revision 1.33 diff -u -r1.33 mse.c --- pc98/pc98/mse.c 2001/03/26 12:41:21 1.33 +++ pc98/pc98/mse.c 2001/09/13 02:05:44 @@ -457,11 +457,11 @@ * Exclusive open the mouse, initialize it and enable interrupts. */ static int -mseopen(dev, flags, fmt, p) +mseopen(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { mse_softc_t *sc; int s; @@ -497,11 +497,11 @@ * mseclose: just turn off mouse innterrupts. */ static int -mseclose(dev, flags, fmt, p) +mseclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); int s; @@ -588,12 +588,12 @@ * mseioctl: process ioctl commands. */ static int -mseioctl(dev, cmd, addr, flag, p) +mseioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); mousestatus_t status; @@ -705,10 +705,10 @@ * msepoll: check for mouse input to be processed. */ static int -msepoll(dev, events, p) +msepoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); int s; @@ -725,7 +725,7 @@ * Since this is an exclusive open device, any previous * proc pointer is trash now, so we can just assign it. */ - selrecord(p, &sc->sc_selp); + selrecord(td, &sc->sc_selp); } } splx(s); Index: pc98/pc98/npx.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/npx.c,v retrieving revision 1.85 diff -u -r1.85 npx.c --- pc98/pc98/npx.c 2001/08/23 01:03:56 1.85 +++ pc98/pc98/npx.c 2001/09/13 02:21:35 @@ -133,23 +133,23 @@ #endif /* __GNUC__ */ #ifdef CPU_ENABLE_SSE -#define GET_FPU_CW(proc) \ +#define GET_FPU_CW(thread) \ (cpu_fxsr ? \ - (proc)->p_addr->u_pcb.pcb_save.sv_xmm.sv_env.en_cw : \ - (proc)->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_cw) -#define GET_FPU_SW(proc) \ + (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_cw : \ + (thread)->td_pcb->pcb_save.sv_87.sv_env.en_cw) +#define GET_FPU_SW(thread) \ (cpu_fxsr ? \ - (proc)->p_addr->u_pcb.pcb_save.sv_xmm.sv_env.en_sw : \ - (proc)->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_sw) + (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw : \ + (thread)->td_pcb->pcb_save.sv_87.sv_env.en_sw) #define GET_FPU_EXSW_PTR(pcb) \ (cpu_fxsr ? \ &(pcb)->pcb_save.sv_xmm.sv_ex_sw : \ &(pcb)->pcb_save.sv_87.sv_ex_sw) #else /* CPU_ENABLE_SSE */ -#define GET_FPU_CW(proc) \ - (proc->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_cw) -#define GET_FPU_SW(proc) \ - (proc->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_sw) +#define GET_FPU_CW(thread) \ + (thread->td_pcb->pcb_save.sv_87.sv_env.en_cw) +#define GET_FPU_SW(thread) \ + (thread->td_pcb->pcb_save.sv_87.sv_env.en_sw) #define GET_FPU_EXSW_PTR(pcb) \ (&(pcb)->pcb_save.sv_87.sv_ex_sw) #endif /* CPU_ENABLE_SSE */ @@ -255,7 +255,7 @@ npx_intr(dummy) void *dummy; { - struct proc *p; + struct thread *td; /* * The BUSY# latch must be cleared in all cases so that the next @@ -279,11 +279,11 @@ * that caused it and it will repeat. We will eventually (usually * soon) win the race to handle the interrupt properly. */ - p = PCPU_GET(npxproc); - if (p != NULL) { - p->p_addr->u_pcb.pcb_flags |= PCB_NPXTRAP; + td = PCPU_GET(npxthread); + if (td != NULL) { + td->td_pcb->pcb_flags |= PCB_NPXTRAP; mtx_lock_spin(&sched_lock); - p->p_sflag |= PS_ASTPENDING; + td->td_kse->ke_flags |= KEF_ASTPENDING; mtx_unlock_spin(&sched_lock); } } @@ -639,13 +639,13 @@ * Free coprocessor (if we have it). */ void -npxexit(p) - struct proc *p; +npxexit(td) + struct thread *td; { critical_t savecrit; savecrit = critical_enter(); - if (p == PCPU_GET(npxproc)) + if (td == PCPU_GET(npxthread)) npxsave(&PCPU_GET(curpcb)->pcb_save); critical_exit(savecrit); #ifdef NPX_DEBUG @@ -862,8 +862,8 @@ u_long *exstat; if (!npx_exists) { - printf("npxtrap: npxproc = %p, curproc = %p, npx_exists = %d\n", - PCPU_GET(npxproc), curproc, npx_exists); + printf("npxtrap: npxthread = %p, curthread = %p, npx_exists = %d\n", + PCPU_GET(npxthread), curthread, npx_exists); panic("npxtrap from nowhere"); } savecrit = critical_enter(); @@ -873,18 +873,18 @@ * state to memory. Fetch the relevant parts of the state from * wherever they are. */ - if (PCPU_GET(npxproc) != curproc) { - control = GET_FPU_CW(curproc); - status = GET_FPU_SW(curproc); + if (PCPU_GET(npxthread) != curthread) { + control = GET_FPU_CW(curthread); + status = GET_FPU_SW(curthread); } else { fnstcw(&control); fnstsw(&status); } - exstat = GET_FPU_EXSW_PTR(&curproc->p_addr->u_pcb); + exstat = GET_FPU_EXSW_PTR(curthread->td_pcb); *exstat = status; - if (PCPU_GET(npxproc) != curproc) - GET_FPU_SW(curproc) &= ~0x80bf; + if (PCPU_GET(npxthread) != curthread) + GET_FPU_SW(curthread) &= ~0x80bf; else fnclex(); critical_exit(savecrit); @@ -894,7 +894,7 @@ /* * Implement device not available (DNA) exception * - * It would be better to switch FP context here (if curproc != npxproc) + * It would be better to switch FP context here (if curthread != npxthread) * and not necessarily for every context switch, but it is too hard to * access foreign pcb's. */ @@ -906,9 +906,9 @@ if (!npx_exists) return (0); - if (PCPU_GET(npxproc) != NULL) { - printf("npxdna: npxproc = %p, curproc = %p\n", - PCPU_GET(npxproc), curproc); + if (PCPU_GET(npxthread) != NULL) { + printf("npxdna: npxthread = %p, curthread = %p\n", + PCPU_GET(npxthread), curthread); panic("npxdna"); } s = critical_enter(); @@ -916,7 +916,7 @@ /* * Record new context early in case frstor causes an IRQ13. */ - PCPU_SET(npxproc, CURPROC); + PCPU_SET(npxthread, curthread); exstat = GET_FPU_EXSW_PTR(PCPU_GET(curpcb)); *exstat = 0; @@ -948,13 +948,13 @@ * after the process has entered the kernel. It may even be delivered after * the fnsave here completes. A spurious IRQ13 for the fnsave is handled in * the same way as a very-late-arriving non-spurious IRQ13 from user mode: - * it is normally ignored at first because we set npxproc to NULL; it is + * it is normally ignored at first because we set npxthread to NULL; it is * normally retriggered in npxdna() after return to user mode. * * npxsave() must be called with interrupts disabled, so that it clears - * npxproc atomically with saving the state. We require callers to do the + * npxthread atomically with saving the state. We require callers to do the * disabling, since most callers need to disable interrupts anyway to call - * npxsave() atomically with checking npxproc. + * npxsave() atomically with checking npxthread. * * A previous version of npxsave() went to great lengths to excecute fnsave * with interrupts enabled in case executing it froze the CPU. This case @@ -970,7 +970,7 @@ fpusave(addr); start_emulating(); - PCPU_SET(npxproc, NULL); + PCPU_SET(npxthread, NULL); } static void Index: pc98/pc98/olpt.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/olpt.c,v retrieving revision 1.16 diff -u -r1.16 olpt.c --- pc98/pc98/olpt.c 2001/07/31 03:39:35 1.16 +++ pc98/pc98/olpt.c 2001/09/13 02:25:20 @@ -473,7 +473,7 @@ */ static int -lptopen (dev_t dev, int flags, int fmt, struct proc *p) +lptopen (dev_t dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; int s; @@ -612,7 +612,7 @@ */ static int -lptclose(dev_t dev, int flags, int fmt, struct proc *p) +lptclose(dev_t dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; #ifndef PC98 @@ -783,7 +783,7 @@ } static int -lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) +lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int error = 0; struct lpt_softc *sc; Index: pc98/pc98/scterm-sck.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/scterm-sck.c,v retrieving revision 1.9 diff -u -r1.9 scterm-sck.c --- pc98/pc98/scterm-sck.c 2001/08/07 12:10:17 1.9 +++ pc98/pc98/scterm-sck.c 2001/09/13 02:25:29 @@ -933,7 +933,7 @@ static int scterm_ioctl(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, - int flag, struct proc *p) + int flag, struct thread *td) { term_stat *tcp = scp->ts; vid_info_t *vi; Index: pc98/pc98/sio.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/sio.c,v retrieving revision 1.153 diff -u -r1.153 sio.c --- pc98/pc98/sio.c 2001/06/26 11:48:17 1.153 +++ pc98/pc98/sio.c 2001/09/13 02:32:52 @@ -2128,11 +2128,11 @@ } static int -sioopen(dev, flag, mode, p) +sioopen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -2190,7 +2190,7 @@ } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_td(td)) { error = EBUSY; goto out; } @@ -2360,11 +2360,11 @@ } static int -sioclose(dev, flag, mode, p) +sioclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int mynor; @@ -3124,12 +3124,12 @@ } static int -sioioctl(dev, cmd, data, flag, p) +sioioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -3160,7 +3160,7 @@ } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -3210,7 +3210,7 @@ if (lt->c_ospeed != 0) dt->c_ospeed = tp->t_ospeed; } - 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); s = spltty(); @@ -3253,7 +3253,7 @@ break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); @@ -3311,7 +3311,7 @@ break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); Index: pc98/pc98/spkr.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/spkr.c,v retrieving revision 1.29 diff -u -r1.29 spkr.c --- pc98/pc98/spkr.c 2001/03/26 12:41:21 1.29 +++ pc98/pc98/spkr.c 2001/09/13 18:04:54 @@ -494,11 +494,11 @@ static char *spkr_inbuf; /* incoming buf */ int -spkropen(dev, flags, fmt, p) +spkropen(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { #ifdef DEBUG (void) printf("spkropen: entering with dev = %s\n", devtoname(dev)); @@ -553,11 +553,11 @@ } int -spkrclose(dev, flags, fmt, p) +spkrclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { #ifdef DEBUG (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev)); @@ -576,12 +576,12 @@ } int -spkrioctl(dev, cmd, cmdarg, flags, p) +spkrioctl(dev, cmd, cmdarg, flags, td) dev_t dev; unsigned long cmd; caddr_t cmdarg; int flags; - struct proc *p; + struct thread *td; { #ifdef DEBUG (void) printf("spkrioctl: entering with dev = %s, cmd = %lx\n", Index: pc98/pc98/syscons.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/syscons.c,v retrieving revision 1.164 diff -u -r1.164 syscons.c --- pc98/pc98/syscons.c 2001/08/07 12:23:47 1.164 +++ pc98/pc98/syscons.c 2001/09/13 02:39:33 @@ -439,7 +439,7 @@ } int -scopen(dev_t dev, int flag, int mode, struct proc *p) +scopen(dev_t dev, int flag, int mode, struct thread *td) { int unit = scdevtounit(dev); sc_softc_t *sc; @@ -478,7 +478,7 @@ (*linesw[tp->t_line].l_modem)(tp, 1); } else - if (tp->t_state & TS_XCLUDE && suser(p)) + if (tp->t_state & TS_XCLUDE && suser_td(td)) return(EBUSY); error = (*linesw[tp->t_line].l_open)(dev, tp); @@ -498,7 +498,7 @@ } int -scclose(dev_t dev, int flag, int mode, struct proc *p) +scclose(dev_t dev, int flag, int mode, struct thread *td) { struct tty *tp = dev->si_tty; scr_stat *scp; @@ -636,7 +636,7 @@ } int -scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int error; int i; @@ -649,23 +649,23 @@ /* If there is a user_ioctl function call that first */ if (sc_user_ioctl) { - error = (*sc_user_ioctl)(dev, cmd, data, flag, p); + error = (*sc_user_ioctl)(dev, cmd, data, flag, td); if (error != ENOIOCTL) return error; } - error = sc_vid_ioctl(tp, cmd, data, flag, p); + error = sc_vid_ioctl(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; #ifndef SC_NO_HISTORY - error = sc_hist_ioctl(tp, cmd, data, flag, p); + error = sc_hist_ioctl(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; #endif #ifndef SC_NO_SYSMOUSE - error = sc_mouse_ioctl(tp, cmd, data, flag, p); + error = sc_mouse_ioctl(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; #endif @@ -676,7 +676,7 @@ sc = scp->sc; if (scp->tsw) { - error = (*scp->tsw->te_ioctl)(scp, tp, cmd, data, flag, p); + error = (*scp->tsw->te_ioctl)(scp, tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; } @@ -857,7 +857,7 @@ DPRINTF(5, ("sc%d: VT_SETMODE ", sc->unit)); if (scp->smode.mode == VT_PROCESS) { p1 = pfind(scp->pid); - if (scp->proc == p1 && scp->proc != p) { + if (scp->proc == p1 && scp->proc != td->td_proc) { if (p1) PROC_UNLOCK(p1); DPRINTF(5, ("error EPERM\n")); @@ -886,9 +886,9 @@ DPRINTF(5, ("error EINVAL\n")); return EINVAL; } - DPRINTF(5, ("VT_PROCESS %d, ", p->p_pid)); + DPRINTF(5, ("VT_PROCESS %d, ", td->td_proc->p_pid)); bcopy(data, &scp->smode, sizeof(struct vt_mode)); - scp->proc = p; + scp->proc = td->td_proc; scp->pid = scp->proc->p_pid; if ((scp == sc->cur_scp) && (sc->unit == sc_console_unit)) cons_unavail = TRUE; @@ -913,7 +913,7 @@ return EINVAL; } /* ...and this process is controlling it. */ - if (scp->proc != p) { + if (scp->proc != td->td_proc) { splx(s); return EPERM; } @@ -979,19 +979,19 @@ return 0; case KDENABIO: /* allow io operations */ - error = suser(p); + error = suser_td(td); if (error != 0) return error; if (securelevel > 0) return EPERM; #ifdef __i386__ - p->p_frame->tf_eflags |= PSL_IOPL; + td->td_frame->tf_eflags |= PSL_IOPL; #endif return 0; case KDDISABIO: /* disallow io operations (default) */ #ifdef __i386__ - p->p_frame->tf_eflags &= ~PSL_IOPL; + td->td_frame->tf_eflags &= ~PSL_IOPL; #endif return 0; @@ -1278,7 +1278,7 @@ break; } - 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); Index: pc98/pc98/wd.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/wd.c,v retrieving revision 1.121 diff -u -r1.121 wd.c --- pc98/pc98/wd.c 2001/06/12 09:40:04 1.121 +++ pc98/pc98/wd.c 2001/09/13 02:30:30 @@ -1226,7 +1226,7 @@ * Initialize a drive. */ int -wdopen(dev_t dev, int flags, int fmt, struct proc *p) +wdopen(dev_t dev, int flags, int fmt, struct thread *td) { register unsigned int lunit; register struct softc *du; Index: pc98/pc98/wd_cd.c =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/pc98/pc98/wd_cd.c,v retrieving revision 1.39 diff -u -r1.39 wd_cd.c --- pc98/pc98/wd_cd.c 2001/05/06 20:00:00 1.39 +++ pc98/pc98/wd_cd.c 2001/09/13 02:31:53 @@ -375,7 +375,7 @@ } static int -acdopen(dev_t dev, int flags, int fmt, struct proc *p) +acdopen(dev_t dev, int flags, int fmt, struct thread *td) { int lun = dkunit(dev); struct acd *cdp; @@ -401,7 +401,7 @@ } int -acdclose(dev_t dev, int flags, int fmt, struct proc *p) +acdclose(dev_t dev, int flags, int fmt, struct thread *td) { struct acd *cdp = acdtab[dkunit(dev)]; @@ -572,7 +572,7 @@ } int -acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { int lun = dkunit(dev); struct acd *cdp = acdtab[lun]; @@ -626,7 +626,7 @@ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0); case CDIOCRESET: - error = suser(p); + error = suser_td(td); if (error) return (error); return acd_request_wait(cdp, ATAPI_TEST_UNIT_READY,