vm_glue.c (103216) | vm_glue.c (103767) |
---|---|
1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 45 unchanged lines hidden (view full) --- 54 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 55 * School of Computer Science 56 * Carnegie Mellon University 57 * Pittsburgh PA 15213-3890 58 * 59 * any improvements or extensions that they make and grant Carnegie the 60 * rights to redistribute these changes. 61 * | 1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 45 unchanged lines hidden (view full) --- 54 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 55 * School of Computer Science 56 * Carnegie Mellon University 57 * Pittsburgh PA 15213-3890 58 * 59 * any improvements or extensions that they make and grant Carnegie the 60 * rights to redistribute these changes. 61 * |
62 * $FreeBSD: head/sys/vm/vm_glue.c 103216 2002-09-11 08:13:56Z julian $ | 62 * $FreeBSD: head/sys/vm/vm_glue.c 103767 2002-09-21 22:07:17Z jake $ |
63 */ 64 65#include "opt_vm.h" 66 67#include <sys/param.h> 68#include <sys/systm.h> 69#include <sys/lock.h> 70#include <sys/mutex.h> --- 73 unchanged lines hidden (view full) --- 144 */ 145int 146useracc(addr, len, rw) 147 caddr_t addr; 148 int len, rw; 149{ 150 boolean_t rv; 151 vm_prot_t prot; | 63 */ 64 65#include "opt_vm.h" 66 67#include <sys/param.h> 68#include <sys/systm.h> 69#include <sys/lock.h> 70#include <sys/mutex.h> --- 73 unchanged lines hidden (view full) --- 144 */ 145int 146useracc(addr, len, rw) 147 caddr_t addr; 148 int len, rw; 149{ 150 boolean_t rv; 151 vm_prot_t prot; |
152 vm_map_t map; |
|
152 153 KASSERT((rw & ~VM_PROT_ALL) == 0, 154 ("illegal ``rw'' argument to useracc (%x)\n", rw)); 155 prot = rw; | 153 154 KASSERT((rw & ~VM_PROT_ALL) == 0, 155 ("illegal ``rw'' argument to useracc (%x)\n", rw)); 156 prot = rw; |
156 /* 157 * XXX - check separately to disallow access to user area and user 158 * page tables - they are in the map. 159 * 160 * XXX - VM_MAXUSER_ADDRESS is an end address, not a max. It was once 161 * only used (as an end address) in trap.c. Use it as an end address 162 * here too. This bogusness has spread. I just fixed where it was 163 * used as a max in vm_mmap.c. 164 */ 165 if ((vm_offset_t) addr + len > /* XXX */ VM_MAXUSER_ADDRESS 166 || (vm_offset_t) addr + len < (vm_offset_t) addr) { | 157 map = &curproc->p_vmspace->vm_map; 158 if ((vm_offset_t)addr + len > vm_map_max(map) || 159 (vm_offset_t)addr + len < (vm_offset_t)addr) { |
167 return (FALSE); 168 } | 160 return (FALSE); 161 } |
169 rv = vm_map_check_protection(&curproc->p_vmspace->vm_map, 170 trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len), 171 prot); | 162 rv = vm_map_check_protection(map, trunc_page((vm_offset_t)addr), 163 round_page((vm_offset_t)addr + len), prot); |
172 return (rv == TRUE); 173} 174 175/* 176 * MPSAFE 177 */ 178void 179vslock(addr, len) --- 694 unchanged lines hidden --- | 164 return (rv == TRUE); 165} 166 167/* 168 * MPSAFE 169 */ 170void 171vslock(addr, len) --- 694 unchanged lines hidden --- |