__va()和phys_to_virt()之间有什么区别,为了同样的目的需要这两个单独的实现,这两者之间有什么区别?
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没有被定义,则等于。