vm_glue.c (52635) | vm_glue.c (52644) |
---|---|
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 52635 1999-10-29 18:09:36Z phk $ | 62 * $FreeBSD: head/sys/vm/vm_glue.c 52644 1999-10-30 06:32:05Z phk $ |
63 */ 64 65#include "opt_rlimit.h" 66#include "opt_vm.h" 67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/proc.h> --- 42 unchanged lines hidden (view full) --- 113 114int 115kernacc(addr, len, rw) 116 caddr_t addr; 117 int len, rw; 118{ 119 boolean_t rv; 120 vm_offset_t saddr, eaddr; | 63 */ 64 65#include "opt_rlimit.h" 66#include "opt_vm.h" 67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/proc.h> --- 42 unchanged lines hidden (view full) --- 113 114int 115kernacc(addr, len, rw) 116 caddr_t addr; 117 int len, rw; 118{ 119 boolean_t rv; 120 vm_offset_t saddr, eaddr; |
121 vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; | 121 vm_prot_t prot; |
122 | 122 |
123 KASSERT(rw & (~VM_PROT_ALL), 124 ("illegal ``rw'' argument to kernacc (%x)\n", rw)); 125 prot = rw; |
|
123 saddr = trunc_page((vm_offset_t)addr); 124 eaddr = round_page((vm_offset_t)addr + len); 125 vm_map_lock_read(kernel_map); 126 rv = vm_map_check_protection(kernel_map, saddr, eaddr, prot); 127 vm_map_unlock_read(kernel_map); 128 return (rv == TRUE); 129} 130 131int 132useracc(addr, len, rw) 133 caddr_t addr; 134 int len, rw; 135{ 136 boolean_t rv; | 126 saddr = trunc_page((vm_offset_t)addr); 127 eaddr = round_page((vm_offset_t)addr + len); 128 vm_map_lock_read(kernel_map); 129 rv = vm_map_check_protection(kernel_map, saddr, eaddr, prot); 130 vm_map_unlock_read(kernel_map); 131 return (rv == TRUE); 132} 133 134int 135useracc(addr, len, rw) 136 caddr_t addr; 137 int len, rw; 138{ 139 boolean_t rv; |
137 vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; | 140 vm_prot_t prot; |
138 vm_map_t map; 139 vm_map_entry_t save_hint; 140 | 141 vm_map_t map; 142 vm_map_entry_t save_hint; 143 |
144 KASSERT(rw & (~VM_PROT_ALL), 145 ("illegal ``rw'' argument to useracc (%x)\n", rw)); 146 prot = rw; |
|
141 /* 142 * XXX - check separately to disallow access to user area and user 143 * page tables - they are in the map. 144 * 145 * XXX - VM_MAXUSER_ADDRESS is an end address, not a max. It was once 146 * only used (as an end address) in trap.c. Use it as an end address 147 * here too. This bogusness has spread. I just fixed where it was 148 * used as a max in vm_mmap.c. --- 368 unchanged lines hidden --- | 147 /* 148 * XXX - check separately to disallow access to user area and user 149 * page tables - they are in the map. 150 * 151 * XXX - VM_MAXUSER_ADDRESS is an end address, not a max. It was once 152 * only used (as an end address) in trap.c. Use it as an end address 153 * here too. This bogusness has spread. I just fixed where it was 154 * used as a max in vm_mmap.c. --- 368 unchanged lines hidden --- |