mem.c (108517) | mem.c (109623) |
---|---|
1/*- 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department, and code derived from software contributed to --- 24 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * from: Utah $Hdr: mem.c 1.13 89/10/08$ 40 * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 | 1/*- 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department, and code derived from software contributed to --- 24 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * from: Utah $Hdr: mem.c 1.13 89/10/08$ 40 * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 |
41 * $FreeBSD: head/sys/amd64/amd64/mem.c 108517 2002-12-31 21:44:38Z njl $ | 41 * $FreeBSD: head/sys/amd64/amd64/mem.c 109623 2003-01-21 08:56:16Z alfred $ |
42 */ 43 44/* 45 * Memory special file 46 */ 47 48#include <sys/param.h> 49#include <sys/conf.h> --- 210 unchanged lines hidden (view full) --- 260 return (ENXIO); 261 262 switch (cmd) { 263 case MEMRANGE_GET: 264 nd = imin(mo->mo_arg[0], mem_range_softc.mr_ndesc); 265 if (nd > 0) { 266 md = (struct mem_range_desc *) 267 malloc(nd * sizeof(struct mem_range_desc), | 42 */ 43 44/* 45 * Memory special file 46 */ 47 48#include <sys/param.h> 49#include <sys/conf.h> --- 210 unchanged lines hidden (view full) --- 260 return (ENXIO); 261 262 switch (cmd) { 263 case MEMRANGE_GET: 264 nd = imin(mo->mo_arg[0], mem_range_softc.mr_ndesc); 265 if (nd > 0) { 266 md = (struct mem_range_desc *) 267 malloc(nd * sizeof(struct mem_range_desc), |
268 M_MEMDESC, M_WAITOK); | 268 M_MEMDESC, 0); |
269 error = mem_range_attr_get(md, &nd); 270 if (!error) 271 error = copyout(md, mo->mo_desc, 272 nd * sizeof(struct mem_range_desc)); 273 free(md, M_MEMDESC); 274 } 275 else 276 nd = mem_range_softc.mr_ndesc; 277 mo->mo_arg[0] = nd; 278 break; 279 280 case MEMRANGE_SET: 281 md = (struct mem_range_desc *)malloc(sizeof(struct mem_range_desc), | 269 error = mem_range_attr_get(md, &nd); 270 if (!error) 271 error = copyout(md, mo->mo_desc, 272 nd * sizeof(struct mem_range_desc)); 273 free(md, M_MEMDESC); 274 } 275 else 276 nd = mem_range_softc.mr_ndesc; 277 mo->mo_arg[0] = nd; 278 break; 279 280 case MEMRANGE_SET: 281 md = (struct mem_range_desc *)malloc(sizeof(struct mem_range_desc), |
282 M_MEMDESC, M_WAITOK); | 282 M_MEMDESC, 0); |
283 error = copyin(mo->mo_desc, md, sizeof(struct mem_range_desc)); 284 /* clamp description string */ 285 md->mr_owner[sizeof(md->mr_owner) - 1] = 0; 286 if (error == 0) 287 error = mem_range_attr_set(md, &mo->mo_arg[0]); 288 free(md, M_MEMDESC); 289 break; 290 } --- 75 unchanged lines hidden --- | 283 error = copyin(mo->mo_desc, md, sizeof(struct mem_range_desc)); 284 /* clamp description string */ 285 md->mr_owner[sizeof(md->mr_owner) - 1] = 0; 286 if (error == 0) 287 error = mem_range_attr_set(md, &mo->mo_arg[0]); 288 free(md, M_MEMDESC); 289 break; 290 } --- 75 unchanged lines hidden --- |