Results 1 to 3 of 3
Hello all,
I am porting the code of a device driver from 32bit to 64bit. We have both 32bit and 64bit processes talking to the driver through ioctl, read and ...
- 05-31-2011 #1Just Joined!
- Join Date
- Mar 2006
- Posts
- 25
Is there a compat_read/compat_write (CONFIG_COMPAT)???
Hello all,
I am porting the code of a device driver from 32bit to 64bit. We have both 32bit and 64bit processes talking to the driver through ioctl, read and write system calls. To handle 32 bit ioctl, we implement the .compat_ioctl. Is there any way that we can handle 32 bit read/write? In the device driver, is there anyway we can tell if a read/write is from a 32 bit process or from a 64 bit process?
Your help is very much appreciated. Thank you.
- 06-01-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,961
I'm not sure it should matter since you have implemented compat_ioctl() in your driver. When that call is made, you would convert 32 to 64-bit structures and pass to your 64-bit driver code, and vice-versa. I haven't done this, but I did do some reading up on the issue, and this seems to be the method folks use when they have implemented compat_ioctl in their driver. I would suggest that you look at some current 64-bit kernel drivers that have implemented this, such as fs/compat_ioctl.c, drivers/char/agp/compat_ioctl.c, and block/compat_ioctl.c
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-01-2011 #3Just Joined!
- Join Date
- Mar 2006
- Posts
- 25
Hello Rubberman,
Thank you for your reply. We already implemented the compat_ioctl() to handle 32 bit ioctl. But don't know if there 's something similar to that to handle 32bit read/write (from 32 bit process).
Regards,
pvpnguyen


Reply With Quote
