Writing Device Drivers

Driver-Specific Issues

In addition to general code cleanup to support the data model changes for LP64, driver writers have to provide support for both 32-bit and 64-bit applications.

The ioctl(9E), devmap(9E), and mmap(9E) entry points allow data structures to be shared directly between applications and device drivers. If those data structures change size between the 32-bit and 64-bit environments, then the entry points must be modified so that the driver can determine whether the data model of the application is the same as that of the kernel. When the data models differ, data structures can be adjusted, using the techniques discussed in the previous chapter.

Practically speaking, in many drivers, only a few ioctls need this kind of handling; the others will work without change as long as they pass around data structures that do not change in size.