3

I was going through device driver development in Linux. I've come across memory mapping of device driver in Linux.

I was trying to develop a RAM Disk block device driver (which creates virtual disk out of RAM). But I coudln't figure out how to use memory mapping here (just for trying out).

I guess block devices would 've used memory mapping.

Can someone shed some light on this ?

Also, if we map the memory in user space using remap_pfn_range, how will that work ? If the user simply writes something on the region, will it get automatically reflected inside the device or the request function that got registered for I/O will be called ?

viji
  • 2,706
  • 5
  • 28
  • 34
  • did you visit this link ?.Thought it might be helpful. http://www.scs.ch/~frey/linux/memorymap.html – Avichal Badaya Aug 20 '12 at 17:38
  • Hi @user1585811, that material gives an example about character device. But my question was about block devices. – viji Aug 20 '12 at 18:18
  • 6
    Linux already has a ram disk driver, `drivers/block/brd.c`, I suggest you read it and see if you can understand how it works. – mpe Aug 20 '12 at 23:03

0 Answers0