I need to support an old hardware, which user land library doesn't have source code, but I have the source code for the device driver. Therefore, I have to rewrite the device driver to support IA-32 mode user land binaries.
For the ioctl calls, compat_ioctl is added to support IA-32 in user land. But the 32 bit library makes mmap calls, which returns only half of the address (of course). My question is, is there any support for mmap that's similar to compat_ioctl vs ioctl? If no compat_mmap, how to support IA-32 user land mmap call?
Appreciate your help!
You don't need to worry about it. When your f_op->mmap()
function is called, it's passed a struct vm_area_struct
which is already correctly positioned for the calling task.
(On x86-64, the arch_get_unmapped_area()
function takes care of this - it ensures that the area returned is less than TASK_SIZE
, and TASK_SIZE
depends on whether the task has the TIF_ADDR32
flag set).