Reputation: 30527
I have a physical memory address, which driver provide me through ioctl. How can I access it in my application in linux.
Upvotes: 2
Views: 1728
Reputation: 74702
This is evil, you're going to have subtle problems with this approach, and you're most likely going to corrupt memory. As abyx says, have the IOCTL itself return the memory that you're interested in.
Upvotes: 4
Reputation: 73028
Usually, to access that in userspace you'd use copy_to_user()
to get a valid userspace copy.
Upvotes: 3
Reputation:
If you absolutely have to, use the functions mmap and mprotect from the header <unistd.h>
Open /dev/mem
Upvotes: 5