dc74a495933d1f48b3da6774646f79cdb940ff64
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department and Ralph Campbell.
* %sccs.include.redist.c%
* from: Utah $Hdr: mem.c 1.14 90/10/12$
* @(#)mem.c 8.1 (Berkeley) %G%
register struct iovec
*iov
;
extern vm_offset_t avail_end
;
while (uio
->uio_resid
> 0 && error
== 0) {
/* minor device 0 is physical memory */
v
= (u_long
)uio
->uio_offset
;
error
= uiomove((caddr_t
)(MACH_CACHED_MEMORY_ADDR
+ v
),
/* minor device 1 is kernel memory */
v
= (u_long
)uio
->uio_offset
;
if (v
< MACH_CACHED_MEMORY_ADDR
)
if (v
+ c
<= MACH_PHYS_TO_CACHED(avail_end
) ||
v
>= MACH_KSEG2_ADDR
&& kernacc((caddr_t
)v
, c
,
uio
->uio_rw
== UIO_READ
? B_READ
: B_WRITE
)) {
error
= uiomove((caddr_t
)v
, (int)c
, uio
);
/* minor device 2 is EOF/RATHOLE */
if (uio
->uio_rw
== UIO_WRITE
)
/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
if (uio
->uio_rw
== UIO_WRITE
) {
malloc(CLBYTES
, M_TEMP
, M_WAITOK
);
c
= min(iov
->iov_len
, CLBYTES
);
error
= uiomove(zbuf
, (int)c
, uio
);