Because mmap(9E) does not have a parameter that can be used to pass data model information, the driver's mmap(9E) entry point should be written to use the new DDI function ddi_mmap_get_model(9F). This function returns one of the following values to indicate the application's data type model:
DDI_MODEL_ILP32 - Application expects the ILP32 data model
DDI_MODEL_ILP64 - Application expects the LP64 data model
DDI_FAILURE - Function was not called from mmap(9E)
As with ioctl(9E) and devmap(9E), the model bits can be passed to ddi_model_convert_from(9F) to determine whether data conversion is necessary.
Example F-3 shows the use of ddi_mmap_get_model(9F).
struct data { int len; caddr_t addr }; xxmmap(dev_t dev, off_t off, int prot) { struct data dtc; /* local copy for clash resolution */ struct data *dp = (struct data *)shared_area; #ifdef _MULTI_DATAMODEL switch (ddi_model_convert_from(ddi_mmap_get_model())) { case DDI_MODEL_ILP32: { struct data32 { int len; uint32_t *addr } *da32p; da32p = (struct data32 *)shared_area; dp = &dtc; dp->len = da32p->len; dp->address = da32p->address; break; } case DDI_MODEL_NONE: break; } #endif /* _MULTI_DATAMODEL */ /* continues along using dp */ ... }