630
631 (void) as_unmap(as, uvaddr, len);
632
633 return (0);
634 }
635
636 /*
637 * If the page has been hashed into the physmem vnode, then just look it up
638 * and return it via pl, otherwise return ENOMEM as the map ioctl has not
639 * succeeded on the given page.
640 */
641 /*ARGSUSED*/
642 static int
643 physmem_getpage(struct vnode *vp, offset_t off, size_t len, uint_t *protp,
644 page_t *pl[], size_t plsz, struct seg *seg, caddr_t addr, enum seg_rw rw,
645 struct cred *cr, caller_context_t *ct)
646 {
647 page_t *pp;
648
649 ASSERT(len == PAGESIZE);
650 ASSERT(AS_READ_HELD(seg->s_as, &seg->s_as->a_lock));
651
652 /*
653 * If the page is in the hash, then we successfully claimed this
654 * page earlier, so return it to the caller.
655 */
656 pp = page_lookup(vp, off, SE_SHARED);
657 if (pp != NULL) {
658 pl[0] = pp;
659 pl[1] = NULL;
660 *protp = PROT_ALL;
661 return (0);
662 }
663 return (ENOMEM);
664 }
665
666 /*
667 * We can not allow a process mapping /dev/physmem pages to fork as there can
668 * only be a single mapping to a /dev/physmem page at a given time. Thus, the
669 * return of EINVAL when we are not working on our own address space.
670 * Otherwise we return zero as this function is required for normal operation.
|
630
631 (void) as_unmap(as, uvaddr, len);
632
633 return (0);
634 }
635
636 /*
637 * If the page has been hashed into the physmem vnode, then just look it up
638 * and return it via pl, otherwise return ENOMEM as the map ioctl has not
639 * succeeded on the given page.
640 */
641 /*ARGSUSED*/
642 static int
643 physmem_getpage(struct vnode *vp, offset_t off, size_t len, uint_t *protp,
644 page_t *pl[], size_t plsz, struct seg *seg, caddr_t addr, enum seg_rw rw,
645 struct cred *cr, caller_context_t *ct)
646 {
647 page_t *pp;
648
649 ASSERT(len == PAGESIZE);
650 ASSERT(AS_READ_HELD(seg->s_as));
651
652 /*
653 * If the page is in the hash, then we successfully claimed this
654 * page earlier, so return it to the caller.
655 */
656 pp = page_lookup(vp, off, SE_SHARED);
657 if (pp != NULL) {
658 pl[0] = pp;
659 pl[1] = NULL;
660 *protp = PROT_ALL;
661 return (0);
662 }
663 return (ENOMEM);
664 }
665
666 /*
667 * We can not allow a process mapping /dev/physmem pages to fork as there can
668 * only be a single mapping to a /dev/physmem page at a given time. Thus, the
669 * return of EINVAL when we are not working on our own address space.
670 * Otherwise we return zero as this function is required for normal operation.
|