diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2011-07-06 21:41:38 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2011-07-06 21:41:38 +0000 |
commit | 1f8bec9fc5270feedd8a624a9d95c12ca9f84541 (patch) | |
tree | 00106427be1dff3557a53963b35c56d2cbf075a2 | |
parent | f303274e6cc4f87cb47de6f68f997d8a37c76e0f (diff) |
Clean up after P_BIGLOCK removal.
KERNEL_PROC_LOCK -> KERNEL_LOCK
KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
-rw-r--r-- | sys/arch/amd64/amd64/fpu.c | 6 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/syscall.c | 32 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/trap.c | 47 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/trap.c | 116 | ||||
-rw-r--r-- | sys/arch/i386/i386/trap.c | 98 | ||||
-rw-r--r-- | sys/arch/i386/isa/npx.c | 6 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m88110_fp.c | 6 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/trap.c | 92 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/fp_emulate.c | 6 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 60 | ||||
-rw-r--r-- | sys/arch/powerpc/powerpc/trap.c | 76 | ||||
-rw-r--r-- | sys/arch/sparc64/fpu/fpu.c | 18 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/emul.c | 22 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/trap.c | 118 | ||||
-rw-r--r-- | sys/kern/init_main.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 8 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_lock.c | 19 | ||||
-rw-r--r-- | sys/kern/kern_sched.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 6 | ||||
-rw-r--r-- | sys/sys/proc.h | 3 | ||||
-rw-r--r-- | sys/sys/systm.h | 8 |
22 files changed, 350 insertions, 413 deletions
diff --git a/sys/arch/amd64/amd64/fpu.c b/sys/arch/amd64/amd64/fpu.c index 047468a8fd8..1c36e6e7443 100644 --- a/sys/arch/amd64/amd64/fpu.c +++ b/sys/arch/amd64/amd64/fpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpu.c,v 1.22 2011/03/20 21:44:08 guenther Exp $ */ +/* $OpenBSD: fpu.c,v 1.23 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: fpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /*- @@ -166,9 +166,9 @@ fputrap(struct trapframe *frame) sfp->fp_ex_sw = sfp->fp_fxsave.fx_fsw; code = x86fpflags_to_siginfo (statbits); sv.sival_ptr = (void *)frame->tf_rip; /* XXX - ? */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, frame->tf_err, code, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } static int diff --git a/sys/arch/amd64/amd64/syscall.c b/sys/arch/amd64/amd64/syscall.c index cabe03827e4..e43c2f61227 100644 --- a/sys/arch/amd64/amd64/syscall.c +++ b/sys/arch/amd64/amd64/syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.c,v 1.16 2011/04/03 14:56:28 guenther Exp $ */ +/* $OpenBSD: syscall.c,v 1.17 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: syscall.c,v 1.1 2003/04/26 18:39:32 fvdl Exp $ */ /*- @@ -127,32 +127,32 @@ syscall(struct trapframe *frame) lock = !(callp->sy_flags & SY_NOLOCK); #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, argp); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, callp->sy_argsize, argp); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif rval[0] = 0; rval[1] = frame->tf_rdx; #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = systrace_redirect(code, p, argp, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { if (lock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = (*callp->sy_call)(p, argp, rval); if (lock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } switch (error) { case 0: @@ -179,16 +179,16 @@ syscall(struct trapframe *frame) } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, error, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, error, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } @@ -203,17 +203,17 @@ child_return(void *arg) tf->tf_rdx = 1; tf->tf_rflags &= ~PSL_C; - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index 2a506003d65..10d1cc5ce2b 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.22 2010/11/01 15:41:01 phessler Exp $ */ +/* $OpenBSD: trap.c,v 1.23 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */ /*- @@ -250,22 +250,22 @@ copyfault: frame_dump(frame); #endif sv.sival_ptr = (void *)frame->tf_rip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, type & ~T_USER, BUS_OBJERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_ALIGNFLT|T_USER: sv.sival_ptr = (void *)frame->tf_rip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, type & ~T_USER, BUS_ADRALN, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_PRIVINFLT|T_USER: /* privileged instruction fault */ sv.sival_ptr = (void *)frame->tf_rip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type & ~T_USER, ILL_PRVOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_FPOPFLT|T_USER: /* coprocessor operand fault */ #ifdef TRAP_SIGDEBUG @@ -274,17 +274,17 @@ copyfault: frame_dump(frame); #endif sv.sival_ptr = (void *)frame->tf_rip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type & ~T_USER, ILL_COPROC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_ASTFLT|T_USER: /* Allow process switch */ uvmexp.softs++; if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } /* Allow a forced task switch. */ if (curcpu()->ci_want_resched) @@ -293,21 +293,21 @@ copyfault: case T_BOUND|T_USER: sv.sival_ptr = (void *)frame->tf_rip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTSUB, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_OFLOW|T_USER: sv.sival_ptr = (void *)frame->tf_rip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTOVF, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_DIVIDE|T_USER: sv.sival_ptr = (void *)frame->tf_rip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTDIV, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_ARITHTRAP|T_USER: @@ -330,7 +330,7 @@ copyfault: extern struct vm_map *kernel_map; cr2 = rcr2(); - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); faultcommon: vm = p->p_vmspace; if (vm == NULL) @@ -377,7 +377,7 @@ faultcommon: KERNEL_UNLOCK(); return; } - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; } if (error == EACCES) { @@ -409,10 +409,7 @@ faultcommon: sv.sival_ptr = (void *)fa; trapsignal(p, SIGSEGV, T_PAGEFLT, SEGV_MAPERR, sv); } - if (type == T_PAGEFLT) - KERNEL_UNLOCK(); - else - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } @@ -424,9 +421,9 @@ faultcommon: #ifdef MATH_EMULATE trace: #endif - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_BRKPT, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; #if NISA > 0 diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index 895302ee759..54dd8f20977 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.115 2011/06/06 14:20:50 jsing Exp $ */ +/* $OpenBSD: trap.c,v 1.116 2011/07/06 21:41:37 art Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -146,9 +146,9 @@ userret(struct proc *p) p->p_md.md_astpending = 0; uvmexp.softs++; if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } if (curcpu()->ci_want_resched) preempt(NULL); @@ -282,9 +282,9 @@ trap(int type, struct trapframe *frame) code = TRAP_TRACE; #endif /* pass to user debugger */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, type &~ T_USER, code, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } break; @@ -293,9 +293,9 @@ trap(int type, struct trapframe *frame) ss_clear_breakpoints(p); /* pass to user debugger */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_TRACE, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; #endif @@ -335,9 +335,9 @@ trap(int type, struct trapframe *frame) fpp[0] &= ~(((u_int64_t)HPPA_FPU_T) << 32); sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, flt, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } break; @@ -347,46 +347,46 @@ trap(int type, struct trapframe *frame) case T_EMULATION | T_USER: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type &~ T_USER, ILL_COPROC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_OVERFLOW | T_USER: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTOVF, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_CONDITION | T_USER: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTDIV, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_PRIV_OP | T_USER: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_PRIV_REG | T_USER: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVREG, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; /* these should never got here */ case T_HIGHERPL | T_USER: case T_LOWERPL | T_USER: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, vftype, SEGV_ACCERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; /* @@ -405,9 +405,9 @@ trap(int type, struct trapframe *frame) case T_IPROT | T_USER: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, vftype, SEGV_ACCERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_ITLBMISSNA: @@ -435,10 +435,7 @@ trap(int type, struct trapframe *frame) pl = frame_regmap(frame, (opcode >> 16) & 0x1f) & 3; - if (type & T_USER) - KERNEL_PROC_LOCK(p); - else - KERNEL_LOCK(); + KERNEL_LOCK(); if ((type & T_USER && space == HPPA_SID_KERNEL) || (frame->tf_iioq_head & 3) != pl || @@ -449,15 +446,12 @@ trap(int type, struct trapframe *frame) frame->tf_ipsw |= PSL_N; } - if (type & T_USER) - KERNEL_PROC_UNLOCK(p); - else - KERNEL_UNLOCK(); + KERNEL_UNLOCK(); } else if (type & T_USER) { sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type & ~T_USER, ILL_ILLTRP, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else panic("trap: %s @ 0x%x:0x%x for 0x%x:0x%x irr 0x%08x", tts, frame->tf_iisq_head, frame->tf_iioq_head, @@ -495,16 +489,13 @@ datacc: if ((type & T_USER && va >= VM_MAXUSER_ADDRESS) || (type & T_USER && map->pmap->pm_space != space)) { sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } - if (type & T_USER) - KERNEL_PROC_LOCK(p); - else - KERNEL_LOCK(); + KERNEL_LOCK(); ret = uvm_fault(map, trunc_page(va), fault, vftype); @@ -523,19 +514,16 @@ datacc: ret = EFAULT; } - if (type & T_USER) - KERNEL_PROC_UNLOCK(p); - else - KERNEL_UNLOCK(); + KERNEL_UNLOCK(); if (ret != 0) { if (type & T_USER) { sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, vftype, ret == EACCES? SEGV_ACCERR : SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else { if (p && p->p_addr->u_pcb.pcb_onfault) { frame->tf_iioq_tail = 4 + @@ -556,9 +544,9 @@ datacc: case T_DATALIGN | T_USER: datalign_user: sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, vftype, BUS_ADRALN, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_INTERRUPT: @@ -580,9 +568,9 @@ datalign_user: } if (type & T_USER) { sv.sival_int = va; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type &~ T_USER, ILL_ILLOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } /* FALLTHROUGH */ @@ -653,17 +641,17 @@ child_return(void *arg) tf->tf_ret1 = 1; /* ischild */ tf->tf_t1 = 0; /* errno */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } @@ -881,15 +869,15 @@ syscall(struct trapframe *frame) } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, callp->sy_argsize, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif if (error) @@ -899,18 +887,18 @@ syscall(struct trapframe *frame) rval[1] = frame->tf_ret1; #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); oerror = error = systrace_redirect(code, p, args, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { int nolock = (callp->sy_flags & SY_NOLOCK); if (!nolock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); oerror = error = (*callp->sy_call)(p, args, rval); if (!nolock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } switch (error) { @@ -934,16 +922,16 @@ syscall(struct trapframe *frame) break; } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, oerror, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, oerror, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif #ifdef DIAGNOSTIC diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 67745a85a47..a141cc608e1 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.97 2011/07/05 00:30:10 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.98 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ /*- @@ -300,68 +300,68 @@ trap(struct trapframe *frame) return; case T_PROTFLT|T_USER: /* protection fault */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); #ifdef VM86 if (frame->tf_eflags & PSL_VM) { vm86_gpfault(p, type & ~T_USER); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; } #endif /* If pmap_exec_fixup does something, let's retry the trap. */ if (pmap_exec_fixup(&p->p_vmspace->vm_map, frame, &p->p_addr->u_pcb)) { - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; } sv.sival_int = frame->tf_eip; trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_TSSFLT|T_USER: sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, vftype, BUS_OBJERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_SEGNPFLT|T_USER: case T_STKFLT|T_USER: sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_ALIGNFLT|T_USER: sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, vftype, BUS_ADRALN, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_PRIVINFLT|T_USER: /* privileged instruction fault */ sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_FPOPFLT|T_USER: /* coprocessor operand fault */ sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type &~ T_USER, ILL_COPROC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_ASTFLT|T_USER: /* Allow process switch */ uvmexp.softs++; if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } if (want_resched) preempt(NULL); @@ -371,36 +371,36 @@ trap(struct trapframe *frame) printf("pid %d killed due to lack of floating point\n", p->p_pid); sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGKILL, type &~ T_USER, FPE_FLTINV, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; } case T_BOUND|T_USER: sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTSUB, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_OFLOW|T_USER: sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTOVF, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_DIVIDE|T_USER: sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTDIV, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_ARITHTRAP|T_USER: sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, frame->tf_err, FPE_INTOVF, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; case T_XFTRAP|T_USER: @@ -437,7 +437,7 @@ trap(struct trapframe *frame) int rv; cr2 = rcr2(); - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); faultcommon: vm = p->p_vmspace; if (vm == NULL) @@ -476,7 +476,7 @@ trap(struct trapframe *frame) KERNEL_UNLOCK(); return; } - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; } @@ -491,7 +491,7 @@ trap(struct trapframe *frame) } sv.sival_int = fa; trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } @@ -506,15 +506,15 @@ trap(struct trapframe *frame) case T_BPTFLT|T_USER: /* bpt instruction fault */ sv.sival_int = rcr2(); - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_BRKPT, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_TRCTRAP|T_USER: /* trace trap */ sv.sival_int = rcr2(); - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_TRACE, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; #if NISA > 0 @@ -667,16 +667,16 @@ syscall(struct trapframe *frame) lock = !(callp->sy_flags & SY_NOLOCK); #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, argsize, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif @@ -688,17 +688,17 @@ syscall(struct trapframe *frame) #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); orig_error = error = systrace_redirect(code, p, args, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { if (lock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); orig_error = error = (*callp->sy_call)(p, args, rval); if (lock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } switch (error) { @@ -728,16 +728,16 @@ syscall(struct trapframe *frame) } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, orig_error, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, orig_error, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif #ifdef DIAGNOSTIC @@ -759,17 +759,17 @@ child_return(void *arg) tf->tf_eax = 0; tf->tf_eflags &= ~PSL_C; - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index 0699d910b03..e13e64f646b 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npx.c,v 1.54 2011/03/20 21:44:08 guenther Exp $ */ +/* $OpenBSD: npx.c,v 1.55 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: npx.c,v 1.57 1996/05/12 23:12:24 mycroft Exp $ */ #if 0 @@ -578,9 +578,9 @@ npxtrap(struct trapframe *frame) addr->sv_xmm.sv_ex_tw = addr->sv_xmm.sv_env.en_tw; code = x86fpflags_to_siginfo (statbits); sv.sival_int = frame->tf_eip; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, frame->tf_err, code, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } static int diff --git a/sys/arch/m88k/m88k/m88110_fp.c b/sys/arch/m88k/m88k/m88110_fp.c index 98daa76b9c7..64a31cb1ccf 100644 --- a/sys/arch/m88k/m88k/m88110_fp.c +++ b/sys/arch/m88k/m88k/m88110_fp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110_fp.c,v 1.3 2010/06/26 23:24:43 guenther Exp $ */ +/* $OpenBSD: m88110_fp.c,v 1.4 2011/07/06 21:41:37 art Exp $ */ /* * Copyright (c) 2007, Miodrag Vallat. @@ -215,9 +215,9 @@ m88110_fpu_exception(struct trapframe *frame) deliver: sv.sival_ptr = (void *)fault_addr; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, sig, 0, fault_type, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } } diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c index 6ba44be605a..2e213623c3a 100644 --- a/sys/arch/m88k/m88k/trap.c +++ b/sys/arch/m88k/m88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.75 2011/04/06 18:01:50 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.76 2011/07/06 21:41:37 art Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -223,9 +223,9 @@ ast(struct trapframe *frame) uvmexp.softs++; p->p_md.md_astpending = 0; if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } if (ci->ci_want_resched) preempt(NULL); @@ -395,7 +395,7 @@ lose: /* User mode instruction access fault */ /* FALLTHROUGH */ case T_DATAFLT+T_USER: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); user_fault: if (type == T_INSTFLT + T_USER) { pbus_type = CMMU_PFSR_FAULT(frame->tf_ipfsr); @@ -492,10 +492,7 @@ user_fault: fault_type = result == EACCES ? BUS_ADRERR : SEGV_MAPERR; } - if (type == T_DATAFLT) - KERNEL_UNLOCK(); - else - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_MISALGNFLT+T_USER: /* Fix any misaligned ld.d or st.d instructions */ @@ -605,9 +602,9 @@ user_fault: if (sig) { sv.sival_ptr = (void *)fault_addr; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, sig, fault_code, fault_type, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); /* * don't want multiple faults - we are going to * deliver signal. @@ -876,7 +873,7 @@ lose: /* User mode instruction access fault */ /* FALLTHROUGH */ case T_DATAFLT+T_USER: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); m88110_user_fault: if (type == T_INSTFLT+T_USER) { ftype = VM_PROT_READ; @@ -926,10 +923,7 @@ m88110_user_fault: printf("Unexpected Instruction fault isr %x\n", frame->tf_isr); #endif - if (type == T_DATAFLT) - KERNEL_UNLOCK(); - else - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto lose; } } else { @@ -977,10 +971,7 @@ m88110_user_fault: printf("Unexpected Data access fault dsr %x\n", frame->tf_dsr); #endif - if (type == T_DATAFLT) - KERNEL_UNLOCK(); - else - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto lose; } } @@ -992,10 +983,7 @@ m88110_user_fault: else if (result == EACCES) result = EFAULT; } - if (type == T_DATAFLT) - KERNEL_UNLOCK(); - else - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); /* * This could be a fault caused in copyin*() @@ -1129,9 +1117,9 @@ m88110_user_fault: if (sig) { deliver: sv.sival_ptr = (void *)fault_addr; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, sig, fault_code, fault_type, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } userexit: @@ -1216,33 +1204,33 @@ m88100_syscall(register_t code, struct trapframe *tf) goto bad; #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, callp->sy_argsize, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif rval[0] = 0; rval[1] = tf->tf_r[3]; #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = systrace_redirect(code, p, args, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { nolock = (callp->sy_flags & SY_NOLOCK); if (!nolock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = (*callp->sy_call)(p, args, rval); if (!nolock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } /* @@ -1301,16 +1289,16 @@ bad: break; } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, error, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, error, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } @@ -1380,33 +1368,33 @@ m88110_syscall(register_t code, struct trapframe *tf) goto bad; #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, callp->sy_argsize, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif rval[0] = 0; rval[1] = tf->tf_r[3]; #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = systrace_redirect(code, p, args, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { nolock = (callp->sy_flags & SY_NOLOCK); if (!nolock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = (*callp->sy_call)(p, args, rval); if (!nolock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } /* @@ -1468,16 +1456,16 @@ bad: } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, error, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, error, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } @@ -1513,17 +1501,17 @@ child_return(arg) } #endif - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } diff --git a/sys/arch/mips64/mips64/fp_emulate.c b/sys/arch/mips64/mips64/fp_emulate.c index aaec0c96f20..f23f883a3e2 100644 --- a/sys/arch/mips64/mips64/fp_emulate.c +++ b/sys/arch/mips64/mips64/fp_emulate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fp_emulate.c,v 1.3 2010/11/24 21:16:28 miod Exp $ */ +/* $OpenBSD: fp_emulate.c,v 1.4 2011/07/06 21:41:37 art Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -385,9 +385,9 @@ deliver: if (sig != SIGBUS && sig != SIGSEGV) #endif sv.sival_ptr = (void *)pc; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, sig, 0, fault_type, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } } diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index 6e30ca2aa30..d7fb139f748 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.73 2011/04/03 14:56:28 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.74 2011/07/06 21:41:37 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -166,9 +166,9 @@ ast() p->p_md.md_astpending = 0; if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } if (ci->ci_want_resched) preempt(NULL); @@ -273,10 +273,7 @@ trap(struct trap_frame *trapframe) } entry |= PG_M; *pte = entry; - if (USERMODE(trapframe->sr)) - KERNEL_PROC_LOCK(p); - else - KERNEL_LOCK(); + KERNEL_LOCK(); pmap_update_user_page(pmap, (trapframe->badvaddr & ~PGOFSET), entry); pa = pfn_to_pad(entry); @@ -284,10 +281,7 @@ trap(struct trap_frame *trapframe) if (pg == NULL) panic("trap: utlbmod: unmanaged page"); pmap_set_modify(pg); - if (USERMODE(trapframe->sr)) - KERNEL_PROC_UNLOCK(p); - else - KERNEL_UNLOCK(); + KERNEL_UNLOCK(); if (!USERMODE(trapframe->sr)) return; goto out; @@ -351,10 +345,7 @@ fault_common: onfault = p->p_addr->u_pcb.pcb_onfault; p->p_addr->u_pcb.pcb_onfault = 0; - if (USERMODE(trapframe->sr)) - KERNEL_PROC_LOCK(p); - else - KERNEL_LOCK(); + KERNEL_LOCK(); rv = uvm_fault(map, trunc_page(va), 0, ftype); p->p_addr->u_pcb.pcb_onfault = onfault; @@ -372,10 +363,7 @@ fault_common: else if (rv == EACCES) rv = EFAULT; } - if (USERMODE(trapframe->sr)) - KERNEL_PROC_UNLOCK(p); - else - KERNEL_UNLOCK(); + KERNEL_UNLOCK(); if (rv == 0) { if (!USERMODE(trapframe->sr)) return; @@ -510,15 +498,15 @@ printf("SIG-BUSB @%p pc %p, ra %p\n", trapframe->badvaddr, trapframe->pc, trapfr } } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, args.i); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, callp->sy_argsize, args.i); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif rval[0] = 0; @@ -530,18 +518,18 @@ printf("SIG-BUSB @%p pc %p, ra %p\n", trapframe->badvaddr, trapframe->pc, trapfr #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); i = systrace_redirect(code, p, args.i, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { int nolock = (callp->sy_flags & SY_NOLOCK); if (!nolock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); i = (*callp->sy_call)(p, &args, rval); if (!nolock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } switch (i) { case 0: @@ -562,15 +550,15 @@ printf("SIG-BUSB @%p pc %p, ra %p\n", trapframe->badvaddr, trapframe->pc, trapfr locr0->a3 = 1; } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, i, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, i, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif goto out; @@ -816,9 +804,9 @@ printf("SIG-BUSB @%p pc %p, ra %p\n", trapframe->badvaddr, trapframe->pc, trapfr p->p_md.md_regs->cause = trapframe->cause; p->p_md.md_regs->badvaddr = trapframe->badvaddr; sv.sival_ptr = (void *)trapframe->badvaddr; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, i, ucode, typ, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); out: /* * Note: we should only get here if returning to user mode. @@ -838,18 +826,18 @@ child_return(arg) trapframe->v1 = 1; trapframe->a3 = 0; - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 57c6e342709..7153267bbe3 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.84 2011/04/03 14:56:28 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.85 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -275,9 +275,9 @@ trap(struct trapframe *frame) case EXC_TRC|EXC_USER: { sv.sival_int = frame->srr0; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, type, TRAP_TRACE, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } break; @@ -351,7 +351,7 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0); frame->dar, frame->dsisr, 0)) break; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); if (frame->dsisr & DSISR_STORE) { ftype = VM_PROT_READ | VM_PROT_WRITE; vftype = VM_PROT_WRITE; @@ -360,7 +360,7 @@ printf("kern dsi on addr %x iar %x\n", frame->dar, frame->srr0); if (uvm_fault(&p->p_vmspace->vm_map, trunc_page(frame->dar), 0, ftype) == 0) { uvm_grow(p, trunc_page(frame->dar)); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } @@ -372,7 +372,7 @@ printf("dsi on addr %x iar %x lr %x\n", frame->dar, frame->srr0,frame->lr); */ sv.sival_int = frame->dar; trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } break; case EXC_ISI|EXC_USER: @@ -384,15 +384,15 @@ printf("dsi on addr %x iar %x lr %x\n", frame->dar, frame->srr0,frame->lr); frame->srr0, 0, 1)) break; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ftype = VM_PROT_READ | VM_PROT_EXECUTE; if (uvm_fault(&p->p_vmspace->vm_map, trunc_page(frame->srr0), 0, ftype) == 0) { uvm_grow(p, trunc_page(frame->srr0)); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #if 0 printf("isi iar %x lr %x\n", frame->srr0, frame->lr); @@ -402,9 +402,9 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr); /* XXX Likely that returning from this trap is bogus... */ /* XXX Have to make sure that sigreturn does the right thing. */ sv.sival_int = frame->srr0; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case EXC_SC|EXC_USER: { @@ -470,36 +470,36 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, argsize, params); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif rval[0] = 0; rval[1] = frame->fixreg[FIRSTARG + 1]; #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, params); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = systrace_redirect(code, p, params, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { nolock = (callp->sy_flags & SY_NOLOCK); if (!nolock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = (*callp->sy_call)(p, params, rval); if (!nolock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } switch (error) { case 0: @@ -528,15 +528,15 @@ syscall_bad: break; } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, error, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, error, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } @@ -559,10 +559,10 @@ syscall_bad: frame->srr0 += 4; else { sv.sival_int = frame->srr0; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, VM_PROT_EXECUTE, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } break; @@ -616,9 +616,9 @@ mpc_print_pci_stat(); errnum++; #endif sv.sival_int = frame->srr0; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, type, TRAP_BRKPT, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } #if 0 @@ -637,9 +637,9 @@ for (i = 0; i < errnum; i++) { } #endif sv.sival_int = frame->srr0; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } case EXC_PGM: @@ -667,25 +667,25 @@ for (i = 0; i < errnum; i++) { break; #else /* ALTIVEC */ sv.sival_int = frame->srr0; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; #endif case EXC_VECAST|EXC_USER: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, 0, FPE_FLTRES, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case EXC_AST|EXC_USER: uvmexp.softs++; p->p_md.md_astpending = 0; /* we are about to do it */ if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } if (ci->ci_want_resched) preempt(NULL); @@ -726,18 +726,18 @@ child_return(void *arg) /* Disable FPU, VECT, as we can't be fpuproc */ tf->srr1 &= ~(PSL_FP|PSL_VEC); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } diff --git a/sys/arch/sparc64/fpu/fpu.c b/sys/arch/sparc64/fpu/fpu.c index 4c4b5ccb544..6c524414a0a 100644 --- a/sys/arch/sparc64/fpu/fpu.c +++ b/sys/arch/sparc64/fpu/fpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpu.c,v 1.14 2010/01/01 13:13:07 miod Exp $ */ +/* $OpenBSD: fpu.c,v 1.15 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: fpu.c,v 1.11 2000/12/06 01:47:50 mrg Exp $ */ /* @@ -214,9 +214,9 @@ fpu_cleanup(p, fs) case FSR_TT_IEEE: if ((i = fsr & FSR_CX) == 0) panic("fpu ieee trap, but no exception"); - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, fpu_codes[i - 1], fpu_types[i - 1], sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; /* XXX should return, but queue remains */ case FSR_TT_UNFIN: @@ -239,9 +239,9 @@ fpu_cleanup(p, fs) log(LOG_ERR, "fpu hardware error (%s[%d])\n", p->p_comm, p->p_pid); uprintf("%s[%d]: fpu hardware error\n", p->p_comm, p->p_pid); - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, -1, FPE_FLTINV, sv); /* ??? */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); goto out; default: @@ -264,17 +264,17 @@ fpu_cleanup(p, fs) continue; case FPE: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, fpu_codes[(fs->fs_fsr & FSR_CX) - 1], fpu_types[(fs->fs_fsr & FSR_CX) - 1], sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case NOTFPU: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_COPROC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; default: diff --git a/sys/arch/sparc64/sparc64/emul.c b/sys/arch/sparc64/sparc64/emul.c index 9fbdb976ce5..2e18cac3518 100644 --- a/sys/arch/sparc64/sparc64/emul.c +++ b/sys/arch/sparc64/sparc64/emul.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emul.c,v 1.19 2010/11/27 19:41:48 miod Exp $ */ +/* $OpenBSD: emul.c,v 1.20 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: emul.c,v 1.8 2001/06/29 23:58:40 eeh Exp $ */ /*- @@ -333,9 +333,9 @@ emul_qf(int32_t insv, struct proc *p, union sigval sv, struct trapframe *tf) if (asi < ASI_PRIMARY) { /* privileged asi */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_PRVOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); return (0); } if (asi > ASI_SECONDARY_NOFAULT_LITTLE || @@ -346,29 +346,29 @@ emul_qf(int32_t insv, struct proc *p, union sigval sv, struct trapframe *tf) if ((freg & 3) != 0) { /* only valid for %fN where N % 4 = 0 */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); return (0); } if ((addr & 3) != 0) { /* request is not aligned */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); return (0); } fs = p->p_md.md_fpstate; if (fs == NULL) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); /* don't currently have an fpu context, get one */ fs = malloc(sizeof(*fs), M_SUBPROC, M_WAITOK); *fs = initfpstate; fs->fs_qsize = 0; p->p_md.md_fpstate = fs; - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else fpusave_proc(p, 1); @@ -393,10 +393,10 @@ emul_qf(int32_t insv, struct proc *p, union sigval sv, struct trapframe *tf) return (1); segv: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, isload ? VM_PROT_READ : VM_PROT_WRITE, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); return (0); } diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c index ecb3a4f4e44..b0229d7292e 100644 --- a/sys/arch/sparc64/sparc64/trap.c +++ b/sys/arch/sparc64/sparc64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.69 2011/07/04 22:53:53 tedu Exp $ */ +/* $OpenBSD: trap.c,v 1.70 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */ /* @@ -466,17 +466,17 @@ dopanic: pc, (long)tf->tf_npc, pstate, PSTATE_BITS); /* NOTREACHED */ } - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, type, ILL_ILLOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_AST: p->p_md.md_astpending = 0; if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } if (curcpu()->ci_want_resched) preempt(NULL); @@ -493,9 +493,9 @@ dopanic: */ write_user_windows(); if (rwindow_save(p) == -1) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_BADSTK, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } break; @@ -505,9 +505,9 @@ dopanic: if (copyin((caddr_t)pc, &ins, sizeof(ins)) != 0) { /* XXX Can this happen? */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } if (ins.i_any.i_op == IOP_mem && @@ -526,9 +526,9 @@ dopanic: ADVANCE; break; } - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); /* XXX code? */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } @@ -536,22 +536,22 @@ dopanic: case T_TEXTFAULT: case T_PRIVINST: case T_PRIVACT: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); /* XXX code? */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_FPDISABLED: { struct fpstate64 *fs = p->p_md.md_fpstate; if (fs == NULL) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); /* NOTE: fpstate must be 64-bit aligned */ fs = malloc((sizeof *fs), M_SUBPROC, M_WAITOK); *fs = initfpstate; fs->fs_qsize = 0; p->p_md.md_fpstate = fs; - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } /* @@ -589,9 +589,9 @@ dopanic: if (copyin((caddr_t)pc, &ins, sizeof(ins)) != 0) { /* XXX Can this happen? */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } if (ins.i_any.i_op == IOP_mem && @@ -602,9 +602,9 @@ dopanic: if (emul_qf(ins.i_int, p, sv, tf)) ADVANCE; } else { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } break; } @@ -619,7 +619,7 @@ dopanic: * core from the interrupt stack is not a good idea. * It causes random crashes. */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); sigexit(p, SIGKILL); /* NOTREACHED */ break; @@ -647,9 +647,9 @@ dopanic: } /* XXX sv.sival_ptr should be the fault address! */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv); /* XXX code? */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_FP_IEEE_754: @@ -684,22 +684,22 @@ dopanic: break; case T_TAGOF: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGEMT, 0, EMT_TAGOVF, sv); /* XXX code? */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_BREAKPOINT: - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_DIV0: ADVANCE; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, 0, FPE_INTDIV, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_CLEANWIN: @@ -715,25 +715,25 @@ dopanic: case T_RANGECHECK: ADVANCE; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); /* XXX code? */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_FIXALIGN: uprintf("T_FIXALIGN\n"); ADVANCE; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); /* XXX code? */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; case T_INTOF: uprintf("T_INTOF\n"); /* XXX */ ADVANCE; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGFPE, FPE_INTOVF_TRAP, FPE_INTOVF, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); break; } userret(p); @@ -854,7 +854,7 @@ data_access_fault(tf, type, pc, addr, sfva, sfsr) goto kfault; } } else { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); p->p_md.md_tf = tf; } @@ -919,7 +919,7 @@ kfault: } if ((tstate & TSTATE_PRIV) == 0) { - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); share_fpu(p, tf); } else { @@ -993,9 +993,9 @@ data_access_error(tf, type, afva, afsr, sfva, sfsr) return; } - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGSEGV, VM_PROT_READ|VM_PROT_WRITE, SEGV_MAPERR, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); out: if ((tstate & TSTATE_PRIV) == 0) { @@ -1045,7 +1045,7 @@ text_access_fault(tf, type, pc, sfsr) } else p->p_md.md_tf = tf; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); vm = p->p_vmspace; /* alas! must call the horrible vm code */ @@ -1079,7 +1079,7 @@ text_access_fault(tf, type, pc, sfsr) trapsignal(p, SIGSEGV, access_type, SEGV_MAPERR, sv); } - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); if ((tstate & TSTATE_PRIV) == 0) { userret(p); @@ -1132,9 +1132,9 @@ text_access_error(tf, type, pc, sfsr, afva, afsr) panic("text_access_error: kernel memory error"); /* User fault -- Berr */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } if ((sfsr & SFSR_FV) == 0 || (sfsr & SFSR_FT) == 0) @@ -1153,7 +1153,7 @@ text_access_error(tf, type, pc, sfsr, afva, afsr) } else p->p_md.md_tf = tf; - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); vm = p->p_vmspace; /* alas! must call the horrible vm code */ @@ -1189,7 +1189,7 @@ text_access_error(tf, type, pc, sfsr, afva, afsr) trapsignal(p, SIGSEGV, access_type, SEGV_MAPERR, sv); } - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); out: if ((tstate & TSTATE_PRIV) == 0) { @@ -1318,9 +1318,9 @@ syscall(tf, code, pc) #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsyscall(p, code, callp->sy_argsize, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif if (error) @@ -1331,25 +1331,25 @@ syscall(tf, code, pc) } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_call(p, code, args); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif rval[0] = 0; rval[1] = tf->tf_out[1]; #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = systrace_redirect(code, p, args, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } else #endif { if (lock) - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); error = (*callp->sy_call)(p, args, rval); if (lock) - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } switch (error) { vaddr_t dest; @@ -1391,16 +1391,16 @@ syscall(tf, code, pc) } #ifdef SYSCALL_DEBUG - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); scdebug_ret(p, code, error, rval); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); #endif userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, code, error, rval[0]); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif share_fpu(p, tf); @@ -1423,17 +1423,17 @@ child_return(arg) tf->tf_out[1] = 0; tf->tf_tstate &= ~(((int64_t)(ICC_C|XCC_C))<<TSTATE_CCR_SHIFT); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } #endif } diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 4d632a549d8..5607c8a6956 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.178 2011/07/05 04:48:02 guenther Exp $ */ +/* $OpenBSD: init_main.c,v 1.179 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -368,7 +368,7 @@ main(void *framep) initclocks(); /* Lock the kernel on behalf of proc0. */ - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); #ifdef SYSVSHM /* Initialize System V style shared memory. */ @@ -716,7 +716,7 @@ start_init(void *arg) * other than it doesn't exist, complain. */ if ((error = sys_execve(p, &args, retval)) == 0) { - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); return; } if (error != ENOENT) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 078249f1e7f..d611cf5c1b0 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.101 2011/07/05 04:48:02 guenther Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.102 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -393,7 +393,7 @@ reaper(void) { struct proc *p; - KERNEL_PROC_UNLOCK(curproc); + KERNEL_UNLOCK(); SCHED_ASSERT_UNLOCKED(); @@ -406,7 +406,7 @@ reaper(void) LIST_REMOVE(p, p_hash); mtx_leave(&deadproc_mutex); - KERNEL_PROC_LOCK(curproc); + KERNEL_LOCK(); /* * Free the VM resources we're still holding on to. @@ -428,7 +428,7 @@ reaper(void) proc_zap(p); } - KERNEL_PROC_UNLOCK(curproc); + KERNEL_UNLOCK(); } } diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index ebdc5a53a24..41b5332768d 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.126 2011/06/06 17:05:46 deraadt Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.127 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -528,6 +528,6 @@ proc_trampoline_mp(void) SCHED_ASSERT_UNLOCKED(); KASSERT(__mp_lock_held(&kernel_lock) == 0); - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); } #endif diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index bdc4f1129cd..c4588491077 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_lock.c,v 1.36 2011/07/06 01:49:42 art Exp $ */ +/* $OpenBSD: kern_lock.c,v 1.37 2011/07/06 21:41:37 art Exp $ */ /* * Copyright (c) 1995 @@ -369,23 +369,6 @@ _kernel_unlock(void) __mp_unlock(&kernel_lock); } -/* - * Acquire/release the kernel_lock on behalf of a process. Intended for - * use in the top half of the kernel. - */ -void -_kernel_proc_lock(struct proc *p) -{ - SCHED_ASSERT_UNLOCKED(); - __mp_lock(&kernel_lock); -} - -void -_kernel_proc_unlock(struct proc *p) -{ - __mp_unlock(&kernel_lock); -} - #ifdef MP_LOCKDEBUG /* CPU-dependent timing, needs this to be settable from ddb. */ int __mp_lock_spinout = 200000000; diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 3c55c59dfdb..1fd729eda14 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.22 2010/05/28 14:23:37 guenther Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.23 2011/07/06 21:41:37 art Exp $ */ /* * Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org> * @@ -109,7 +109,7 @@ sched_idle(void *v) struct cpu_info *ci = v; int s; - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); spc = &ci->ci_schedstate; @@ -191,7 +191,7 @@ sched_exit(struct proc *p) LIST_INSERT_HEAD(&spc->spc_deadproc, p, p_hash); /* This process no longer needs to hold the kernel lock. */ - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); SCHED_LOCK(s); idle = spc->spc_idleproc; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index c2ece9c8420..4d747c2f826 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.122 2011/07/05 04:48:02 guenther Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.123 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1249,7 +1249,7 @@ postsig(int signum) panic("postsig"); #endif - KERNEL_PROC_LOCK(p); + KERNEL_LOCK(); mask = sigmask(signum); atomic_clearbits_int(&p->p_siglist, mask); @@ -1330,7 +1330,7 @@ postsig(int signum) type, sigval); } - KERNEL_PROC_UNLOCK(p); + KERNEL_UNLOCK(); } /* diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 5d070f482ea..3ab22fdc185 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.139 2011/07/05 04:48:02 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.140 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -347,7 +347,6 @@ struct proc { #define P_INEXEC 0x200000 /* Process is doing an exec right now */ #define P_SYSTRACE 0x400000 /* Process system call tracing active*/ #define P_CONTINUED 0x800000 /* Proc has continued from a stopped state. */ -#define P_BIGLOCK 0x2000000 /* Process needs kernel "big lock" to run */ #define P_THREAD 0x4000000 /* Only a thread, not a real process */ #define P_IGNEXITRV 0x8000000 /* For thread kills */ #define P_SOFTDEP 0x10000000 /* Stuck processing softdep worklist */ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 0f376f65782..b5b205764e3 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.88 2011/04/26 17:20:20 jsing Exp $ */ +/* $OpenBSD: systm.h,v 1.89 2011/07/06 21:41:37 art Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -337,22 +337,16 @@ void user_config(void); void _kernel_lock_init(void); void _kernel_lock(void); void _kernel_unlock(void); -void _kernel_proc_lock(struct proc *); -void _kernel_proc_unlock(struct proc *); #define KERNEL_LOCK_INIT() _kernel_lock_init() #define KERNEL_LOCK() _kernel_lock() #define KERNEL_UNLOCK() _kernel_unlock() -#define KERNEL_PROC_LOCK(p) _kernel_proc_lock((p)) -#define KERNEL_PROC_UNLOCK(p) _kernel_proc_unlock((p)) #else /* ! MULTIPROCESSOR */ #define KERNEL_LOCK_INIT() /* nothing */ #define KERNEL_LOCK() /* nothing */ #define KERNEL_UNLOCK() /* nothing */ -#define KERNEL_PROC_LOCK(p) /* nothing */ -#define KERNEL_PROC_UNLOCK(p) /* nothing */ #endif /* MULTIPROCESSOR */ |