Cleanup/fix virt_to_maddr
PATCH 1/1 Cleanup/fix virt_to_maddr
Hi!
Where virt_to_maddr() or __pa() is used, paddr_t is mostly expected rather unsigned long. This may fix random issues in PAE mode.
Christoph
xen/include/asm-x86/page.h +1 -1
@@ -222,7 +222,7 @@ typedef struct { u64 pfn; } pagetable_t;/* Convert between Xen-heap virtual addresses and machine addresses. */ #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) -#define virt_to_maddr (va) ((unsigned long)(va)-PAGE_OFFSET) +#define virt_to_maddr (va) ((paddr_t)(va)-PAGE_OFFSET)#define maddr_to_virt (ma) ((void *)((unsigned long)(ma)+PAGE_OFFSET))/* Shorthand versions of the above functions. */ #define __pa (x) (virt_to_maddr(x))
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Christoph Egger
Where
virt_to_maddr()or__pa()is used,paddr_tis mostly expected rather unsigned long. This may fix random issues in PAE mode.
They're only used on Xen heap virtual addresses whose physical addresses are always below 64MB. So there should be no issues in returning a ulong.
-- Keir
Quoted 6 lines · Keir Fraser
Quoted 2 lines · Christoph Egger
Where
virt_to_maddr()or__pa()is used,paddr_tis mostly expected rather unsigned long. This may fix random issues in PAE mode.They're only used on Xen heap virtual addresses whose physical addresses are always below 64MB. So there should be no issues in returning a ulong.
Oh, I see. So it's absolutely not used for domains (which I assumed)?
Christoph
Quoted 4 lines · Christoph Egger
Quoted 2 lines
They're only used on Xen heap virtual addresses whose physical addresses are always below 64MB. So there should be no issues in returning a ulong.
Oh, I see. So it's absolutely not used for domains (which I assumed)?
No, all it does is a simple arithmetic transformation (subtracting PAGE_OFFSET) which is only valid for non-guest pages on x86_32. It can be used for any page on x86_64, but there we have paddr_t==ulong.
-- Keir