diff options
author | kato <kato@FreeBSD.org> | 2001-01-28 11:06:28 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 2001-01-28 11:06:28 +0000 |
commit | c859c785605d74c30bfaa4a70b42069e103edaca (patch) | |
tree | 184dccbdb45222a7c5dbe02164ad9dd20c738240 /sys/pc98 | |
parent | 49a09de58af958b1c8f0a5b8c12d179816b3f023 (diff) | |
download | FreeBSD-src-c859c785605d74c30bfaa4a70b42069e103edaca.zip FreeBSD-src-c859c785605d74c30bfaa4a70b42069e103edaca.tar.gz |
Synced with sys/i386/i386/machdep.c revision 1.436.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/i386/machdep.c | 44 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 44 |
2 files changed, 72 insertions, 16 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 4105324..be66264 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -454,8 +454,6 @@ again: SLIST_INIT(&cpuhead); SLIST_INSERT_HEAD(&cpuhead, GLOBALDATA, gd_allcpu); - mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); - #ifdef SMP /* * OK, enough kmem_alloc/malloc state should be up, lets get on with it! @@ -491,6 +489,7 @@ osendsig(catcher, sig, mask, code) int oonstack; p = curproc; + PROC_LOCK(p); psp = p->p_sigacts; regs = p->p_md.md_regs; oonstack = sigonstack(regs->tf_esp); @@ -505,6 +504,7 @@ osendsig(catcher, sig, mask, code) #endif } else fp = (struct osigframe *)regs->tf_esp - 1; + PROC_UNLOCK(p); /* * grow_stack() will return 0 if *fp does not fit inside the stack @@ -517,10 +517,12 @@ osendsig(catcher, sig, mask, code) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ + PROC_LOCK(p); SIGACTION(p, SIGILL) = SIG_DFL; SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); + PROC_UNLOCK(p); psignal(p, SIGILL); return; } @@ -532,6 +534,7 @@ osendsig(catcher, sig, mask, code) /* Build the argument list for the signal handler. */ sf.sf_signum = sig; sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc; + PROC_LOCK(p); if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_arg2 = (register_t)&fp->sf_siginfo; @@ -544,6 +547,7 @@ osendsig(catcher, sig, mask, code) sf.sf_addr = regs->tf_err; sf.sf_ahu.sf_handler = catcher; } + PROC_UNLOCK(p); /* Save most if not all of trap frame. */ sf.sf_siginfo.si_sc.sc_eax = regs->tf_eax; @@ -628,8 +632,10 @@ sendsig(catcher, sig, mask, code) int oonstack; p = curproc; + PROC_LOCK(p); psp = p->p_sigacts; if (SIGISMEMBER(psp->ps_osigset, sig)) { + PROC_UNLOCK(p); osendsig(catcher, sig, mask, code); return; } @@ -656,6 +662,7 @@ sendsig(catcher, sig, mask, code) #endif } else sfp = (struct sigframe *)regs->tf_esp - 1; + PROC_UNLOCK(p); /* * grow_stack() will return 0 if *sfp does not fit inside the stack @@ -671,10 +678,12 @@ sendsig(catcher, sig, mask, code) #ifdef DEBUG printf("process %d has trashed its stack\n", p->p_pid); #endif + PROC_LOCK(p); SIGACTION(p, SIGILL) = SIG_DFL; SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); + PROC_UNLOCK(p); psignal(p, SIGILL); return; } @@ -686,6 +695,7 @@ sendsig(catcher, sig, mask, code) /* Build the argument list for the signal handler. */ sf.sf_signum = sig; sf.sf_ucontext = (register_t)&sfp->sf_uc; + PROC_LOCK(p); if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_siginfo = (register_t)&sfp->sf_si; @@ -701,6 +711,7 @@ sendsig(catcher, sig, mask, code) sf.sf_addr = regs->tf_err; sf.sf_ahu.sf_handler = catcher; } + PROC_UNLOCK(p); /* * If we're a vm86 process, we want to save the segment registers. @@ -854,6 +865,7 @@ osigreturn(p, uap) regs->tf_ss = scp->sc_ss; regs->tf_isp = scp->sc_isp; + PROC_LOCK(p); #if defined(COMPAT_43) || defined(COMPAT_SUNOS) if (scp->sc_onstack & 1) p->p_sigstk.ss_flags |= SS_ONSTACK; @@ -863,6 +875,7 @@ osigreturn(p, uap) SIGSETOLD(p->p_sigmask, scp->sc_mask); SIG_CANTMASK(p->p_sigmask); + PROC_UNLOCK(p); regs->tf_ebp = scp->sc_fp; regs->tf_esp = scp->sc_sp; regs->tf_eip = scp->sc_pc; @@ -967,6 +980,7 @@ sigreturn(p, uap) bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } + PROC_LOCK(p); #if defined(COMPAT_43) || defined(COMPAT_SUNOS) if (ucp->uc_mcontext.mc_onstack & 1) p->p_sigstk.ss_flags |= SS_ONSTACK; @@ -976,6 +990,7 @@ sigreturn(p, uap) p->p_sigmask = ucp->uc_sigmask; SIG_CANTMASK(p->p_sigmask); + PROC_UNLOCK(p); return (EJUSTRETURN); } @@ -2186,6 +2201,24 @@ init386(first) /* setup curproc so that mutexes work */ PCPU_SET(curproc, &proc0); + LIST_INIT(&proc0.p_heldmtx); + LIST_INIT(&proc0.p_contested); + + mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); +#ifdef SMP + /* + * Interrupts can happen very early, so initialize imen_mtx here, rather + * than in init_locks(). + */ + mtx_init(&imen_mtx, "imen", MTX_SPIN); +#endif + + /* + * Giant is used early for at least debugger traps and unexpected traps. + */ + mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); + mtx_enter(&Giant, MTX_DEF); + /* make ldt memory segments */ /* * The data segment limit must not cover the user area because we @@ -2260,11 +2293,6 @@ init386(first) isa_defaultirq(); #endif - /* - * Giant is used early for at least debugger traps and unexpected traps. - */ - mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); - #ifdef DDB kdb_init(); if (boothowto & RB_KDB) @@ -2588,7 +2616,7 @@ set_dbregs(p, dbregs) * from within kernel mode? */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p) != 0) { if (dbregs->dr7 & 0x3) { /* dr0 is enabled */ if (dbregs->dr0 >= VM_MAXUSER_ADDRESS) diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 4105324..be66264 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -454,8 +454,6 @@ again: SLIST_INIT(&cpuhead); SLIST_INSERT_HEAD(&cpuhead, GLOBALDATA, gd_allcpu); - mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); - #ifdef SMP /* * OK, enough kmem_alloc/malloc state should be up, lets get on with it! @@ -491,6 +489,7 @@ osendsig(catcher, sig, mask, code) int oonstack; p = curproc; + PROC_LOCK(p); psp = p->p_sigacts; regs = p->p_md.md_regs; oonstack = sigonstack(regs->tf_esp); @@ -505,6 +504,7 @@ osendsig(catcher, sig, mask, code) #endif } else fp = (struct osigframe *)regs->tf_esp - 1; + PROC_UNLOCK(p); /* * grow_stack() will return 0 if *fp does not fit inside the stack @@ -517,10 +517,12 @@ osendsig(catcher, sig, mask, code) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ + PROC_LOCK(p); SIGACTION(p, SIGILL) = SIG_DFL; SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); + PROC_UNLOCK(p); psignal(p, SIGILL); return; } @@ -532,6 +534,7 @@ osendsig(catcher, sig, mask, code) /* Build the argument list for the signal handler. */ sf.sf_signum = sig; sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc; + PROC_LOCK(p); if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_arg2 = (register_t)&fp->sf_siginfo; @@ -544,6 +547,7 @@ osendsig(catcher, sig, mask, code) sf.sf_addr = regs->tf_err; sf.sf_ahu.sf_handler = catcher; } + PROC_UNLOCK(p); /* Save most if not all of trap frame. */ sf.sf_siginfo.si_sc.sc_eax = regs->tf_eax; @@ -628,8 +632,10 @@ sendsig(catcher, sig, mask, code) int oonstack; p = curproc; + PROC_LOCK(p); psp = p->p_sigacts; if (SIGISMEMBER(psp->ps_osigset, sig)) { + PROC_UNLOCK(p); osendsig(catcher, sig, mask, code); return; } @@ -656,6 +662,7 @@ sendsig(catcher, sig, mask, code) #endif } else sfp = (struct sigframe *)regs->tf_esp - 1; + PROC_UNLOCK(p); /* * grow_stack() will return 0 if *sfp does not fit inside the stack @@ -671,10 +678,12 @@ sendsig(catcher, sig, mask, code) #ifdef DEBUG printf("process %d has trashed its stack\n", p->p_pid); #endif + PROC_LOCK(p); SIGACTION(p, SIGILL) = SIG_DFL; SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); + PROC_UNLOCK(p); psignal(p, SIGILL); return; } @@ -686,6 +695,7 @@ sendsig(catcher, sig, mask, code) /* Build the argument list for the signal handler. */ sf.sf_signum = sig; sf.sf_ucontext = (register_t)&sfp->sf_uc; + PROC_LOCK(p); if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_siginfo = (register_t)&sfp->sf_si; @@ -701,6 +711,7 @@ sendsig(catcher, sig, mask, code) sf.sf_addr = regs->tf_err; sf.sf_ahu.sf_handler = catcher; } + PROC_UNLOCK(p); /* * If we're a vm86 process, we want to save the segment registers. @@ -854,6 +865,7 @@ osigreturn(p, uap) regs->tf_ss = scp->sc_ss; regs->tf_isp = scp->sc_isp; + PROC_LOCK(p); #if defined(COMPAT_43) || defined(COMPAT_SUNOS) if (scp->sc_onstack & 1) p->p_sigstk.ss_flags |= SS_ONSTACK; @@ -863,6 +875,7 @@ osigreturn(p, uap) SIGSETOLD(p->p_sigmask, scp->sc_mask); SIG_CANTMASK(p->p_sigmask); + PROC_UNLOCK(p); regs->tf_ebp = scp->sc_fp; regs->tf_esp = scp->sc_sp; regs->tf_eip = scp->sc_pc; @@ -967,6 +980,7 @@ sigreturn(p, uap) bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } + PROC_LOCK(p); #if defined(COMPAT_43) || defined(COMPAT_SUNOS) if (ucp->uc_mcontext.mc_onstack & 1) p->p_sigstk.ss_flags |= SS_ONSTACK; @@ -976,6 +990,7 @@ sigreturn(p, uap) p->p_sigmask = ucp->uc_sigmask; SIG_CANTMASK(p->p_sigmask); + PROC_UNLOCK(p); return (EJUSTRETURN); } @@ -2186,6 +2201,24 @@ init386(first) /* setup curproc so that mutexes work */ PCPU_SET(curproc, &proc0); + LIST_INIT(&proc0.p_heldmtx); + LIST_INIT(&proc0.p_contested); + + mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); +#ifdef SMP + /* + * Interrupts can happen very early, so initialize imen_mtx here, rather + * than in init_locks(). + */ + mtx_init(&imen_mtx, "imen", MTX_SPIN); +#endif + + /* + * Giant is used early for at least debugger traps and unexpected traps. + */ + mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); + mtx_enter(&Giant, MTX_DEF); + /* make ldt memory segments */ /* * The data segment limit must not cover the user area because we @@ -2260,11 +2293,6 @@ init386(first) isa_defaultirq(); #endif - /* - * Giant is used early for at least debugger traps and unexpected traps. - */ - mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); - #ifdef DDB kdb_init(); if (boothowto & RB_KDB) @@ -2588,7 +2616,7 @@ set_dbregs(p, dbregs) * from within kernel mode? */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p) != 0) { if (dbregs->dr7 & 0x3) { /* dr0 is enabled */ if (dbregs->dr0 >= VM_MAXUSER_ADDRESS) |