Li, Xin B
2005-Oct-29 02:03 UTC
[Xen-devel] misleading names in xen memory management code
Keir, I think we have some misleading names in xen memory management code: 1) #define page_to_pfn(_page) ((unsigned long)((_page) - frame_table)) Actually, it should be page_to_mfn. 2) #define l1e_from_pfn(pfn, flags) \ ((l1_pgentry_t) { ((intpte_t)(pfn) << PAGE_SHIFT) | put_pte_flags(flags) }) Seems l1e_from_mfn(mfn, flags) is much more clear. Am I right? -Xin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Pratt
2005-Oct-29 02:25 UTC
RE: [Xen-devel] misleading names in xen memory management code
> Keir, I think we have some misleading names in xen memory management > code: > 1) #define page_to_pfn(_page) ((unsigned long)((_page) - > frame_table)) Actually, it should be page_to_mfn. > > 2) #define l1e_from_pfn(pfn, flags) \ > ((l1_pgentry_t) { ((intpte_t)(pfn) << PAGE_SHIFT) | > put_pte_flags(flags) }) > Seems l1e_from_mfn(mfn, flags) is much more clear. > > Am I right?Yep, these are functions from the very early days of Xen, before the terminology was properly developed. They could usefully be renamed. While doing this, it would be well worth paying attention to uses of page_to_pfn to check that the value returned is never shifted left PAGE_SHIFT without appropriate casting (for PAE). Ian _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel