Question

Can I load data from RAM by using pointer to memory with physical addressing(not to virtual) from my driver (Linux-kernel) without allocating pages (PDEs/PTEs) in virtual addressing?

Was it helpful?

Solution

Yes! "/dev/mem" is an image of physical memory, and you can even access this from user space.

For example, to access physical address 0x7000000, the code below summarizes the steps:

fd = open("/dev/mem", O_RDWR);
map = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x7000000);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top