'\" te .\" Copyright (c) 2001 Sun Microsystems, Inc. All Rights Reserved. .TH ddi_mmap_get_model 9F "8 Feb 2001" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME ddi_mmap_get_model \- return data model type of current thread .SH SYNOPSIS .LP .nf #include #include \fBuint_t\fR \fBddi_mmap_get_model\fR(\fBvoid\fR); .fi .SH INTERFACE LEVEL .sp .LP Solaris DDI specific (Solaris DDI). .SH DESCRIPTION .sp .LP \fBddi_mmap_get_model()\fR returns the \fIC\fR Language Type Model which the current thread expects. \fBddi_mmap_get_model()\fR is used in combination with \fBddi_model_convert_from\fR(9F) in the \fBmmap\fR(9E) driver entry point to determine whether there is a data model mismatch between the current thread and the device driver. The device driver might have to adjust the shape of data structures before exporting them to a user thread which supports a different data model. .SH RETURN VALUES .sp .ne 2 .mk .na \fB\fBDDI_MODEL_ILP32\fR \fR .ad .RS 20n .rt Current thread expects 32-bit \fI(ILP32)\fR semantics. .RE .sp .ne 2 .mk .na \fB\fBDDI_MODEL_LP64\fR \fR .ad .RS 20n .rt Current thread expects 64-bit \fI(LP64)\fR semantics. .RE .sp .ne 2 .mk .na \fB\fBDDI_FAILURE\fR \fR .ad .RS 20n .rt The \fBddi_mmap_get_model()\fR function was not called from the \fBmmap\fR(9E) entry point. .RE .SH CONTEXT .sp .LP The \fBddi_mmap_get_model()\fR function can only be called from the \fBmmap\fR(9E) driver entry point. .SH EXAMPLES .LP \fBExample 1 \fR: Using \fBddi_mmap_get_model()\fR .sp .LP The following is an example of the \fBmmap\fR(9E) entry point and how to support 32-bit and 64-bit applications with the same device driver. .sp .in +2 .nf struct data32 { int len; caddr32_t addr; }; struct data { int len; caddr_t addr; }; xxmmap(dev_t dev, off_t off, int prot) { struct data dtc; /* a local copy for clash resolution */ struct data *dp = (struct data *)shared_area; switch (ddi_model_convert_from(ddi_mmap_get_model())) { case DDI_MODEL_ILP32: { struct data32 *da32p; da32p = (struct data32 *)shared_area; dp = &dtc; dp->len = da32p->len; dp->address = da32->address; break; } case DDI_MODEL_NONE: break; } /* continues along using dp */ \&.\|.\|. } .fi .in -2 .SH SEE ALSO .sp .LP \fBmmap\fR(9E), \fBddi_model_convert_from\fR(9F) .sp .LP \fIWriting Device Drivers for Oracle Solaris 11.2\fR