LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-08-2005, 03:12 AM   #1
Kumar
Member
 
Registered: Sep 2003
Location: Pune, India
Distribution: Red Hat
Posts: 106

Rep: Reputation: 15
Implementing mmap


Hi,
I am trying to implement mmap in a character driver. My kernel version is 2.4.20-8 and gcc version is 3.2.2. In brief, this is what I am doing in my driver code-
1. static unsigned char *ebuffer; [This is a global variable]
2. ebuffer = (unsigned char *)kmalloc(PAGE_SIZE-1,GFP_KERNEL); [Inside init_module]
3. remap_page_range (vm, vm->vm_start, virt_to_phys(ebuffer), vm->vm_end - vm->vm_start, vm->vm_page_prot) [In my mmap function]
4. printk("Data %s",ebuffer); [In my ioctl function].


Now, In my user mode program, I open the device file(/dev/mm - created using mknod program) and do a mmap on it , followed by ioctl, the driver should dump the data which I wrote at the mapped adderss. But it is not working properly and printing some random stuff. Can anyone please tell me where I am going wrong?

Thank you.

Last edited by Kumar; 09-14-2005 at 05:12 AM.
 
  


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
mmap function professional1983 Programming 1 06-14-2005 04:23 AM
mmap() error FarAway Programming 3 03-30-2005 07:38 AM
using mmap AngryLlama Programming 1 02-09-2005 08:53 AM
kiobuf vs. mmap j4r0d Programming 8 01-10-2005 03:18 AM
mmap problem os2 Programming 4 06-21-2004 05:24 PM


All times are GMT -5. The time now is 05:16 AM.

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