Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern __predict_false() uvm_useracc() failure.
details: https://anonhg.NetBSD.org/src/rev/742f33b86f17
branches: trunk
changeset: 485921:742f33b86f17
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon May 08 20:03:20 2000 +0000
description:
__predict_false() uvm_useracc() failure.
diffstat:
sys/kern/kern_physio.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diffs (63 lines):
diff -r 5d588cd83e4e -r 742f33b86f17 sys/kern/kern_physio.c
--- a/sys/kern/kern_physio.c Mon May 08 20:02:21 2000 +0000
+++ b/sys/kern/kern_physio.c Mon May 08 20:03:20 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_physio.c,v 1.41 2000/03/29 03:43:32 simonb Exp $ */
+/* $NetBSD: kern_physio.c,v 1.42 2000/05/08 20:03:20 thorpej Exp $ */
/*-
* Copyright (c) 1994 Christopher G. Demetriou
@@ -94,13 +94,15 @@
* writing, so we ignore the uio's rw parameter. Also note that if
* we're doing a read, that's a *write* to user-space.
*/
- if (uio->uio_segflg == UIO_USERSPACE)
- for (i = 0; i < uio->uio_iovcnt; i++)
+ if (uio->uio_segflg == UIO_USERSPACE) {
+ for (i = 0; i < uio->uio_iovcnt; i++) {
/* XXXCDC: map not locked, rethink */
- if (!uvm_useracc(uio->uio_iov[i].iov_base,
+ if (__predict_false(!uvm_useracc(uio->uio_iov[i].iov_base,
uio->uio_iov[i].iov_len,
- (flags == B_READ) ? B_WRITE : B_READ))
+ (flags == B_READ) ? B_WRITE : B_READ)))
return (EFAULT);
+ }
+ }
/* Make sure we have a buffer, creating one if necessary. */
if ((nobuf = (bp == NULL)) != 0) {
@@ -180,9 +182,10 @@
* restores it.
*/
PHOLD(p);
- if (uvm_vslock(p, bp->b_data, todo, (flags & B_READ) ?
+ if (__predict_false(uvm_vslock(p, bp->b_data, todo,
+ (flags & B_READ) ?
VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ)
- != KERN_SUCCESS) {
+ != KERN_SUCCESS)) {
bp->b_flags |= B_ERROR;
bp->b_error = EFAULT;
goto after_vsunlock;
@@ -231,9 +234,9 @@
*/
done = bp->b_bcount - bp->b_resid;
#ifdef DIAGNOSTIC
- if (done < 0)
+ if (__predict_false(done < 0))
panic("done < 0; strategy broken");
- if (done > todo)
+ if (__predict_false(done > todo))
panic("done > todo; strategy broken");
#endif
iovp->iov_len -= done;
@@ -309,7 +312,7 @@
if (bp->b_vp)
brelvp(bp);
- if (bp->b_flags & B_WANTED)
+ if (__predict_false(bp->b_flags & B_WANTED))
panic("putphysbuf: private buf B_WANTED");
s = splbio();
pool_put(&bufpool, bp);
Home |
Main Index |
Thread Index |
Old Index