Print this page
patch as-lock-macro-simplification
*** 362,387 ****
char first = 1;
faultcode_t res;
*lenp = 0;
if (cow) {
! AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER);
seg = as_findseg(as, uaddr, 0);
if ((seg == NULL) || ((base = seg->s_base) > uaddr) ||
(uaddr + total) > base + seg->s_size) {
! AS_LOCK_EXIT(as, &as->a_lock);
return (EINVAL);
}
/*
* The COW scheme should work for all segment types.
* But to be safe, we check against segvn.
*/
if (seg->s_ops != &segvn_ops) {
! AS_LOCK_EXIT(as, &as->a_lock);
return (ENOTSUP);
} else if ((SEGOP_GETTYPE(seg, uaddr) & MAP_PRIVATE) == 0) {
! AS_LOCK_EXIT(as, &as->a_lock);
return (ENOTSUP);
}
}
hat = as->a_hat;
size = total;
--- 362,387 ----
char first = 1;
faultcode_t res;
*lenp = 0;
if (cow) {
! AS_LOCK_ENTER(as, RW_WRITER);
seg = as_findseg(as, uaddr, 0);
if ((seg == NULL) || ((base = seg->s_base) > uaddr) ||
(uaddr + total) > base + seg->s_size) {
! AS_LOCK_EXIT(as);
return (EINVAL);
}
/*
* The COW scheme should work for all segment types.
* But to be safe, we check against segvn.
*/
if (seg->s_ops != &segvn_ops) {
! AS_LOCK_EXIT(as);
return (ENOTSUP);
} else if ((SEGOP_GETTYPE(seg, uaddr) & MAP_PRIVATE) == 0) {
! AS_LOCK_EXIT(as);
return (ENOTSUP);
}
}
hat = as->a_hat;
size = total;
*** 482,492 ****
cached_ppp++;
app++;
++i;
}
if (cow) {
! AS_LOCK_EXIT(as, &as->a_lock);
}
if (first && res == FC_NOMAP) {
/*
* If the address is not mapped yet, we call as_fault to
* fault the pages in. We could've fallen back to copy and
--- 482,492 ----
cached_ppp++;
app++;
++i;
}
if (cow) {
! AS_LOCK_EXIT(as);
}
if (first && res == FC_NOMAP) {
/*
* If the address is not mapped yet, we call as_fault to
* fault the pages in. We could've fallen back to copy and
*** 500,510 ****
uaddr += size;
total -= size;
size = total;
res = as_fault(as->a_hat, as, uaddr, size, F_INVAL, S_READ);
if (cow)
! AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER);
goto tryagain;
}
switch (res) {
case FC_NOSUPPORT:
return (ENOTSUP);
--- 500,510 ----
uaddr += size;
total -= size;
size = total;
res = as_fault(as->a_hat, as, uaddr, size, F_INVAL, S_READ);
if (cow)
! AS_LOCK_ENTER(as, RW_WRITER);
goto tryagain;
}
switch (res) {
case FC_NOSUPPORT:
return (ENOTSUP);