1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man9f / ddi_mmap_get_model.9f
blob33c43e961d256c996bd18823dff37f4299a32a01
1 '\" te
2 .\"  Copyright (c) 2001 Sun Microsystems, Inc.
3 .\"  All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH DDI_MMAP_GET_MODEL 9F "Feb 8, 2001"
8 .SH NAME
9 ddi_mmap_get_model \- return data model type of current thread
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/ddi.h>
14 #include <sys/sunddi.h>
18 \fBuint_t\fR \fBddi_mmap_get_model\fR(\fBvoid\fR);
19 .fi
21 .SH INTERFACE LEVEL
22 .sp
23 .LP
24 Solaris DDI specific (Solaris DDI).
25 .SH DESCRIPTION
26 .sp
27 .LP
28 \fBddi_mmap_get_model()\fR returns the \fIC\fR Language Type Model which the
29 current thread expects. \fBddi_mmap_get_model()\fR is used in combination with
30 \fBddi_model_convert_from\fR(9F) in the \fBmmap\fR(9E) driver entry point to
31 determine whether there is a data model mismatch between the current thread and
32 the device driver. The device driver might have to adjust the shape of data
33 structures before exporting them to a user thread which supports a different
34 data model.
35 .SH RETURN VALUES
36 .sp
37 .ne 2
38 .na
39 \fB\fBDDI_MODEL_ILP32\fR \fR
40 .ad
41 .RS 20n
42 Current thread expects 32-bit \fI(ILP32)\fR semantics.
43 .RE
45 .sp
46 .ne 2
47 .na
48 \fB\fBDDI_MODEL_LP64\fR \fR
49 .ad
50 .RS 20n
51 Current thread expects 64-bit \fI(LP64)\fR semantics.
52 .RE
54 .sp
55 .ne 2
56 .na
57 \fB\fBDDI_FAILURE\fR \fR
58 .ad
59 .RS 20n
60 The \fBddi_mmap_get_model()\fR function was not called from the \fBmmap\fR(9E)
61 entry point.
62 .RE
64 .SH CONTEXT
65 .sp
66 .LP
67 The \fBddi_mmap_get_model()\fR function can only be called from the
68 \fBmmap\fR(9E) driver entry point.
69 .SH EXAMPLES
70 .LP
71 \fBExample 1 \fR: Using \fBddi_mmap_get_model()\fR
72 .sp
73 .LP
74 The following is an example of the \fBmmap\fR(9E) entry point and how to
75 support 32-bit and 64-bit applications with the same device driver.
77 .sp
78 .in +2
79 .nf
80 struct data32 {
81         int len;
82         caddr32_t addr;
85 struct data {
86         int len;
87         caddr_t addr;
89 xxmmap(dev_t dev, off_t off, int prot) {
90         struct data dtc; /* a local copy for clash resolution */
91         struct data *dp = (struct data *)shared_area;
93         switch (ddi_model_convert_from(ddi_mmap_get_model())) {
94         case DDI_MODEL_ILP32:
95         {
96                 struct data32 *da32p;
98                 da32p = (struct data32 *)shared_area;
99                 dp = &dtc;
100                 dp->len = da32p->len;
101                 dp->address = da32->address;
102                 break;
103         }
104         case DDI_MODEL_NONE:
105                 break;
106         }
107         /* continues along using dp */
108        \&.\|.\|.
111 .in -2
113 .SH SEE ALSO
116 \fBmmap\fR(9E), \fBddi_model_convert_from\fR(9F)
119 \fIWriting Device Drivers\fR