.TH mmap "" "" "Entry-Point Routine"
.PC "Check virtual mapping for a memory-mapped device"
.B "#include <sys/types.h>"
.B "#include <sys/mman.h>"
.B "#include <sys/vm.h>"
\fBint \fIprefix\fBmmap(\fIdevice\^\fB, \fIoffset\^\fB, \fIprotection\^\fB)\fR
\fBdev_t \fIdevice\^\fB; off_t \fIoffset\^\fB; int \fIprotection\^\fB;\fR
.PP
.B mmap
is the entry point to the driver's internal routine for memory-mapped devices.
The \*(CO system call
.BR mmap() ,
when applied to a character-special file, maps this device's memory
into user space, for direct manipulation by the user's application.
.PP
.I device
gives the device whose memory is being mapped.
.I offset
gives the offset within device memory at which mapping begins.
.I protection
gives the protection flags.
The following flags are Valid:
.DS
.ta 0.5i 1.5i
	\fBPROT_READ\fR	Page can be read
	\fBPROT_WRITE\fR	Page can be written on
	\fBPROT_EXEC\fR	Page can be executed
	\fBPROT_USER\fR	Page is accessible from user level
	\fBPROT_ALL\fR	All of the above
.DE
.PP
The
.B mmap
routine must check whether
.I offset
is within the range that the device supports.
If the offset does not exist, then it should return
.BR NOPAGE .
.PP
If
.I offset
exists, the
.B mmap
routine returns its physical-page identifier.
.SH "See Also"
.B
entry-point routines
.R
.SH Notes
This entry-point is used only by the DDI/DKI interface.
It is optional.
.PP
The driver's
.B mmap
routine has user context and can sleep.
.PP
As of this writing, the \*(CO kernel does not contain the system call
.BR mmap() .
