Device driver read/write functions not running for address 0x80000000
I have a device with 3 memory regions. I am using pread/pwrite in the user space app after opening the device. Everything works fine for the first 2 regions (starting at addresses 0x10800000 and 0x0c000000) but the read/write functions in the driver are not working for the third memory region (starts at address 0x80000000). The first line in the read/write functions are a printk statement and nothing is printed at all for the third memory region as if the read/write functions are not even called.
This is on a 32-bit system so I suspect the issue has to do with 0x80000000 overflowing a signed integer and being read as a negative number but I don't know how to work around this. Is there any way around this issue in the user space app?
I've tried adding
#define _FILE_OFFSET_BITS 64
as the first line in the source and
as a gcc command line option but this didn't make a difference.
Figured it out. I had to change my pread/pwrite calls to pread64/pwrite64, and I had to append ULL to the end of the offset or use a variable of type unsigned long long. I suspect I could type cast the variable as well but I haven't tried this yet.
|All times are GMT -5. The time now is 04:01 AM.|