[SOLVED] Device driver read/write functions not running for address 0x80000000
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.