简体   繁体   English

如何在x86_64上支持IA-32 for mmap?

[英]How to support IA-32 for mmap on x86_64?

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. 因此,我必须重写设备驱动程序以支持IA-32模式用户陆地二进制文件。

For the ioctl calls, compat_ioctl is added to support IA-32 in user land. 对于ioctl调用,添加compat_ioctl以支持用户域中的IA-32。 But the 32 bit library makes mmap calls, which returns only half of the address (of course). 但是32位库会进行mmap调用,它只返回地址的一半(当然)。 My question is, is there any support for mmap that's similar to compat_ioctl vs ioctl? 我的问题是,是否有任何类似于compat_ioctl vs ioctl的mmap支持? If no compat_mmap, how to support IA-32 user land mmap call? 如果没有compat_mmap,如何支持IA-32用户登陆mmap?

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. 当你的f_op->mmap()函数被调用时,它会传递一个struct vm_area_struct ,它已经为调用任务正确定位了。

(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). (在x86-64上, arch_get_unmapped_area()函数负责处理 - 它确保返回的区域小于TASK_SIZE ,而TASK_SIZE取决于任务是否设置了TIF_ADDR32标志)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM