سؤال

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?

هل كانت مفيدة؟

المحلول

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);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top