LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 09-10-2012, 10:27 AM   #1
shade963
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Rep: Reputation: Disabled
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
-D_FILE_OFFSET_BITS=64
as a gcc command line option but this didn't make a difference.

Edit:
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.

Last edited by shade963; 09-10-2012 at 04:05 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
read/write in block device driver zali Programming 4 05-05-2012 03:14 AM
Linux Driver - how to read/write a block or character device in kernel space (procfs) stybi Linux - Kernel 1 01-27-2011 06:26 AM
How to write a keyboard driver read and interrupt functions? sunr2007 Programming 1 01-13-2009 08:38 AM
How to write a character device driver to read the processor's GDT kiranshadow Linux - General 1 05-10-2008 11:28 AM
mmap refused with 0x80000000 virtual address fannyl Programming 2 08-03-2004 01:43 AM


All times are GMT -5. The time now is 06:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration