Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以通过从我的驱动程序(Linux 内核)使用指向具有物理寻址(而不是虚拟)的内存的指针来从 RAM 加载数据,而无需在虚拟寻址中分配页面(PDE/PTE)吗?
是的!“/dev/mem”是物理内存的映像,您甚至可以从用户空间访问它。
例如,要访问物理地址0x7000000,下面的代码总结了步骤:
0x7000000
fd = open("/dev/mem", O_RDWR); map = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x7000000);