Kernel Functions for Drivers ddimmapgetmodel(9F)
NAME
ddimmapgetmodel - return data model type of current
thread
SYNOPSIS
#include
#include
uintt ddimmapgetmodel(void);
INTERFACE LEVEL
Solaris DI specific (Solaris DI).
DESCRIPTION
ddimmapgetmodel() returns the C Language Type Model which
the current thread expects. ddimmapgetmodel() is used in
combination with ddimodelconvertfrom(9F) in the mmap(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.
RETURN VALUES
DIMODELILP32 Current thread expects 32-bit (ILP32)
semantics.
DIMODELP64 Current thread expects 64-bit (LP64)
semantics.
DIFAILURE The ddimmapgetmodel() function was
not called from the mmap(9E) entry
point.
CONTEXT
The ddimmapgetmodel() function can only be called from
the mmap(9E) driver entry point.
EXAMPLES
Example 1 : Using ddimmapgetmodel()
The following is an example of the mmap(9E) entry point and
how to support 32-bit and 64-bit applications with the same
device driver.
SunOS 5.11 Last change: 8 Feb 2001 1
Kernel Functions for Drivers ddimmapgetmodel(9F)
struct data32 {
int len;
caddr32t addr;
};
struct data {
int len;
caddrt addr;
};
xxmmap(devt dev, offt off, int prot) {
struct data dtc; /* a local copy for clash resolution */
struct data *dp = (struct data *)sharedarea;
switch (ddimodelconvertfrom(ddimmapgetmodel())) {
case DIMODELILP32:
{
struct data32 *da32p;
da32p = (struct data32 *)sharedarea;
dp = &dtc;
dp->len = da32p->len;
dp->address = da32->address;
break;
}
case DIMODELNONE:
break;
}
/* continues along using dp */
...
}
SEE ALSO
mmap(9E), ddimodelconvertfrom(9F)
Writing Device Drivers
SunOS 5.11 Last change: 8 Feb 2001 2
|