Pergunta

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?

Foi útil?

Solução

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);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top