mem.c (180664) | mem.c (183397) |
---|---|
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 * SUCH DAMAGE. 34 * 35 * from: Utah $Hdr: mem.c 1.13 89/10/08$ 36 * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 37 * from: FreeBSD: src/sys/i386/i386/mem.c,v 1.94 2001/09/26 38 */ 39 40#include <sys/cdefs.h> | 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 * SUCH DAMAGE. 34 * 35 * from: Utah $Hdr: mem.c 1.13 89/10/08$ 36 * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 37 * from: FreeBSD: src/sys/i386/i386/mem.c,v 1.94 2001/09/26 38 */ 39 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/mem.c 180664 2008-07-21 17:15:51Z marius $"); | 41__FBSDID("$FreeBSD: head/sys/sparc64/sparc64/mem.c 183397 2008-09-27 08:51:18Z ed $"); |
42 43/* 44 * Memory special file 45 * 46 * NOTE: other architectures support mmap()'ing the mem and kmem devices; this 47 * might cause illegal aliases to be created for the locked kernel page(s), so 48 * it is not implemented. 49 */ --- 56 unchanged lines hidden (view full) --- 106 iov = uio->uio_iov; 107 if (iov->iov_len == 0) { 108 uio->uio_iov++; 109 uio->uio_iovcnt--; 110 if (uio->uio_iovcnt < 0) 111 panic("memrw"); 112 continue; 113 } | 42 43/* 44 * Memory special file 45 * 46 * NOTE: other architectures support mmap()'ing the mem and kmem devices; this 47 * might cause illegal aliases to be created for the locked kernel page(s), so 48 * it is not implemented. 49 */ --- 56 unchanged lines hidden (view full) --- 106 iov = uio->uio_iov; 107 if (iov->iov_len == 0) { 108 uio->uio_iov++; 109 uio->uio_iovcnt--; 110 if (uio->uio_iovcnt < 0) 111 panic("memrw"); 112 continue; 113 } |
114 if (minor(dev) == CDEV_MINOR_MEM) { | 114 if (dev2unit(dev) == CDEV_MINOR_MEM) { |
115 pa = uio->uio_offset & ~PAGE_MASK; 116 if (!is_physical_memory(pa)) { 117 error = EFAULT; 118 break; 119 } 120 121 off = uio->uio_offset & PAGE_MASK; 122 cnt = PAGE_SIZE - ((vm_offset_t)iov->iov_base & --- 31 unchanged lines hidden (view full) --- 154 pmap_qremove(va, 1); 155 } else { 156 va = TLB_PHYS_TO_DIRECT(pa); 157 error = uiomove((void *)(va + off), cnt, 158 uio); 159 } 160 break; 161 } | 115 pa = uio->uio_offset & ~PAGE_MASK; 116 if (!is_physical_memory(pa)) { 117 error = EFAULT; 118 break; 119 } 120 121 off = uio->uio_offset & PAGE_MASK; 122 cnt = PAGE_SIZE - ((vm_offset_t)iov->iov_base & --- 31 unchanged lines hidden (view full) --- 154 pmap_qremove(va, 1); 155 } else { 156 va = TLB_PHYS_TO_DIRECT(pa); 157 error = uiomove((void *)(va + off), cnt, 158 uio); 159 } 160 break; 161 } |
162 else if (minor(dev) == CDEV_MINOR_KMEM) { | 162 else if (dev2unit(dev) == CDEV_MINOR_KMEM) { |
163 va = trunc_page(uio->uio_offset); 164 eva = round_page(uio->uio_offset + iov->iov_len); 165 166 /* 167 * Make sure that all of the pages are currently 168 * resident so we don't create any zero fill pages. 169 */ 170 for (; va < eva; va += PAGE_SIZE) --- 28 unchanged lines hidden --- | 163 va = trunc_page(uio->uio_offset); 164 eva = round_page(uio->uio_offset + iov->iov_len); 165 166 /* 167 * Make sure that all of the pages are currently 168 * resident so we don't create any zero fill pages. 169 */ 170 for (; va < eva; va += PAGE_SIZE) --- 28 unchanged lines hidden --- |