7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 /*
25 * Copyright (c) 2010, Intel Corporation.
26 * All rights reserved.
27 */
28
29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
31
32 /*
33 * Portions of this source code were derived from Berkeley 4.3 BSD
34 * under license from the Regents of the University of California.
35 */
36
37 /*
38 * UNIX machine dependent virtual memory support.
39 */
40
41 #include <sys/types.h>
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/user.h>
45 #include <sys/proc.h>
46 #include <sys/kmem.h>
606 * we returned from as_fault() above. We just fall
607 * through as_fault() below.
608 */
609 as_rangeunlock(as);
610 }
611
612 res = as_fault(hat, as, addr, 1, F_INVAL, rw);
613 }
614
615 out:
616 if (mapped_red)
617 segkp_unmap_red();
618
619 return (res);
620 }
621
622 void
623 map_addr(caddr_t *addrp, size_t len, offset_t off, int vacalign, uint_t flags)
624 {
625 struct proc *p = curproc;
626 caddr_t userlimit = (flags & _MAP_LOW32) ?
627 (caddr_t)_userlimit32 : p->p_as->a_userlimit;
628
629 map_addr_proc(addrp, len, off, vacalign, userlimit, curproc, flags);
630 }
631
632 /*ARGSUSED*/
633 int
634 map_addr_vacalign_check(caddr_t addr, u_offset_t off)
635 {
636 return (0);
637 }
638
639 /*
640 * map_addr_proc() is the routine called when the system is to
641 * choose an address for the user. We will pick an address
642 * range which is the highest available below userlimit.
643 *
644 * Every mapping will have a redzone of a single page on either side of
645 * the request. This is done to leave one page unmapped between segments.
646 * This is not required, but it's useful for the user because if their
647 * program strays across a segment boundary, it will catch a fault
648 * immediately making debugging a little easier. Currently the redzone
649 * is mandatory.
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24 /*
25 * Copyright (c) 2010, Intel Corporation.
26 * All rights reserved.
27 * Copyright (c) 2014, Joyent, Inc. All rights reserved.
28 */
29
30 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
31 /* All Rights Reserved */
32
33 /*
34 * Portions of this source code were derived from Berkeley 4.3 BSD
35 * under license from the Regents of the University of California.
36 */
37
38 /*
39 * UNIX machine dependent virtual memory support.
40 */
41
42 #include <sys/types.h>
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/user.h>
46 #include <sys/proc.h>
47 #include <sys/kmem.h>
607 * we returned from as_fault() above. We just fall
608 * through as_fault() below.
609 */
610 as_rangeunlock(as);
611 }
612
613 res = as_fault(hat, as, addr, 1, F_INVAL, rw);
614 }
615
616 out:
617 if (mapped_red)
618 segkp_unmap_red();
619
620 return (res);
621 }
622
623 void
624 map_addr(caddr_t *addrp, size_t len, offset_t off, int vacalign, uint_t flags)
625 {
626 struct proc *p = curproc;
627 map_addr_proc(addrp, len, off, vacalign,
628 map_userlimit(p, p->p_as, flags), curproc, flags);
629 }
630
631 /*ARGSUSED*/
632 int
633 map_addr_vacalign_check(caddr_t addr, u_offset_t off)
634 {
635 return (0);
636 }
637
638 /*
639 * map_addr_proc() is the routine called when the system is to
640 * choose an address for the user. We will pick an address
641 * range which is the highest available below userlimit.
642 *
643 * Every mapping will have a redzone of a single page on either side of
644 * the request. This is done to leave one page unmapped between segments.
645 * This is not required, but it's useful for the user because if their
646 * program strays across a segment boundary, it will catch a fault
647 * immediately making debugging a little easier. Currently the redzone
648 * is mandatory.
|