문제

Assume that there is a device using memory-mapped I/O i.e. there is a specific range of physical memory assigned to this device

If virtual memory system is not used, then it is quite straightforward to manipulate the device through read/write operations done with corresponding physical addresses

What if there is virtual memory system ?

Device driver needs to be aware of that specific range of physical memory assigned to that device, but how does it access that address range if it should use virtual addresses instead of physical ?

도움이 되었습니까?

해결책

In case of memory mapped IO devices, any physical address shared by that device can be mapped to the kernel virtual memory using the ioremap() API [1].

Hence in your case, we can map the physical address 0x1234 using ioremap() to obtain its kernel virtual address and start writing data to this address.

[1] http://lxr.gwbnsh.net.cn/linux/arch/cris/mm/ioremap.c

다른 팁

It's been a long time since I've done it, but my recollection is that when you map a block of physical memory, the address in your user space corresponds to that physical memory. Writing to your user-space address is a write to the physical memory.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top