To enable a 64-bit driver and a 32-bit application to share memory, the binary layout generated by the 64-bit driver must be the same as consumed by the 32-bit application.
To determine whether there is a model mismatch, devmap(9E) uses the model parameter to pass the data model type expected by the application. model is set to one of the following:
DDI_MODEL_ILP32 - Application uses the ILP32 data model
DDI_MODEL_LP64 - Application uses the LP64 data model
Example F-2 shows the devmap(9E) model parameter being passed to the ddi_model_convert_from(9F) function.
struct data {
int len;
caddr_t addr;
};
xxdevmap(dev_t dev, devmap_cookie_t dhp, offset_t offset,
size_t len, size_t *maplen, uint_t model);
{
struct data dtc; /* local copy for clash resolution */
struct data *dp = (struct data *)shared_area;
#ifdef _MULTI_DATAMODEL
switch (ddi_model_convert_from(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 */
...
}