__va()和phys_to_virt()之间有什么区别,这两个单独的实现需要同样的目的,这两者之间有什么区别吗?
答案 0 :(得分:3)
phys_to_virt和__va是预处理器宏。 phys_to_virt:
#if !defined(CONFIG_MMU)
#define virt_to_phys(address) ((unsigned long)(address))
#define phys_to_virt(address) ((void *)(address))
#else
#define virt_to_phys(address) (__pa(address))
#define phys_to_virt(address) (__va(address))
#endif
和__va
#define __va(x) ((void *)((unsigned long) (x)))
如果未定义CONFIG_MMU则为等于。