virt_to_phys on 5.4 kernel
5.4\arch\arm64\include\asm\Memory.h static inline phys_addr_t virt_to_phys(const volatile void *x) { return __virt_to_phys((unsigned long)(x)); }
#define __is_lm_address(addr) (((u64)(addr) ^ PAGE_OFFSET) < (PAGE_END - PAGE_OFFSET)) #define __lm_to_phys(addr) (((addr) & ~PAGE_OFFSET) + PHYS_OFFSET) #define __kimg_to_phys(addr) ((addr) - kimage_voffset) #define __virt_to_phys_nodebug(x) ({ \ phys_addr_t __x = (phys_addr_t)(__tag_reset(x)); \ __is_lm_address(__x) ? __lm_to_phys(__x) : __kimg_to_phys(__x); \ })
PAGE_OFFSET is 0xffffff8000000000, PHYS_OFFSET: 0x0
PAGE_END is 0xffffffc000000000, (PAGE_END - PAGE_OFFSET) is 0x4000000000
标签:__,phys,addr,virt,OFFSET,5.4,PAGE From: https://www.cnblogs.com/aspirs/p/16913159.html