Go to the documentation of this file.
21 #ifndef __ASM_MEMORY_H
22 #define __ASM_MEMORY_H
24 #include <linux/compiler.h>
25 #include <linux/const.h>
26 #include <linux/types.h>
27 #include <asm/sizes.h>
33 #define UL(x) _AC(x, UL)
43 #define PAGE_OFFSET UL(0xffffffc000000000)
44 #define MODULES_END (PAGE_OFFSET)
45 #define MODULES_VADDR (MODULES_END - SZ_64M)
47 #define TASK_SIZE_64 (UL(1) << VA_BITS)
50 #define TASK_SIZE_32 UL(0x100000000)
51 #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \
52 TASK_SIZE_32 : TASK_SIZE_64)
54 #define TASK_SIZE TASK_SIZE_64
57 #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4))
59 #if TASK_SIZE_64 > MODULES_VADDR
60 #error Top of 64-bit user space clashes with start of module space
68 #define __virt_to_phys(x) (((phys_addr_t)(x) - PAGE_OFFSET + PHYS_OFFSET))
69 #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET + PAGE_OFFSET))
74 #define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
75 #define __pfn_to_phys(pfn) ((phys_addr_t)(pfn) << PAGE_SHIFT)
80 #define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page)))
81 #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
86 #define MT_DEVICE_nGnRnE 0
87 #define MT_DEVICE_nGnRE 1
88 #define MT_DEVICE_GRE 2
89 #define MT_NORMAL_NC 3
96 #define PHYS_OFFSET ({ memstart_addr; })
106 #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
126 #define __pa(x) __virt_to_phys((unsigned long)(x))
127 #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x)))
128 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
134 #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
136 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
137 #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
138 ((void *)(kaddr) < (void *)high_memory))