mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
![Jeremy Fitzhardinge](/assets/img/avatar_default.png)
PFN_PHYS, as its name suggests, turns a pfn into a physical address. However, it is a macro which just operates on its argument without modifying its type. pfns are typed unsigned long, but an unsigned long may not be long enough to hold a physical address (32-bit systems with more than 32 bits of physcial address). Make sure we cast to phys_addr_t to return a complete result. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
13 lines
328 B
C
13 lines
328 B
C
#ifndef _LINUX_PFN_H_
|
|
#define _LINUX_PFN_H_
|
|
|
|
#ifndef __ASSEMBLY__
|
|
#include <linux/types.h>
|
|
#endif
|
|
|
|
#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
|
|
#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
|
|
#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
|
|
#define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT)
|
|
|
|
#endif
|