• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _ASM_X86_PAGE_DEFS_H
2 #define _ASM_X86_PAGE_DEFS_H
3 
4 #include <linux/const.h>
5 #include <linux/types.h>
6 
7 /* PAGE_SHIFT determines the page size */
8 #define PAGE_SHIFT	12
9 #define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
10 #define PAGE_MASK	(~(PAGE_SIZE-1))
11 
12 #define PMD_PAGE_SIZE		(_AC(1, UL) << PMD_SHIFT)
13 #define PMD_PAGE_MASK		(~(PMD_PAGE_SIZE-1))
14 
15 #define PUD_PAGE_SIZE		(_AC(1, UL) << PUD_SHIFT)
16 #define PUD_PAGE_MASK		(~(PUD_PAGE_SIZE-1))
17 
18 #define __PHYSICAL_MASK		((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))
19 #define __VIRTUAL_MASK		((1UL << __VIRTUAL_MASK_SHIFT) - 1)
20 
21 /* Cast *PAGE_MASK to a signed type so that it is sign-extended if
22    virtual addresses are 32-bits but physical addresses are larger
23    (ie, 32-bit PAE). */
24 #define PHYSICAL_PAGE_MASK	(((signed long)PAGE_MASK) & __PHYSICAL_MASK)
25 #define PHYSICAL_PMD_PAGE_MASK	(((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK)
26 #define PHYSICAL_PUD_PAGE_MASK	(((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)
27 
28 #define HPAGE_SHIFT		PMD_SHIFT
29 #define HPAGE_SIZE		(_AC(1,UL) << HPAGE_SHIFT)
30 #define HPAGE_MASK		(~(HPAGE_SIZE - 1))
31 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
32 
33 #define HUGE_MAX_HSTATE 2
34 
35 #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
36 
37 #define VM_DATA_DEFAULT_FLAGS \
38 	(((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
39 	 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
40 
41 #define __PHYSICAL_START	ALIGN(CONFIG_PHYSICAL_START, \
42 				      CONFIG_PHYSICAL_ALIGN)
43 
44 #define __START_KERNEL		(__START_KERNEL_map + __PHYSICAL_START)
45 
46 #ifdef CONFIG_X86_64
47 #include <asm/page_64_types.h>
48 #define IOREMAP_MAX_ORDER       (PUD_SHIFT)
49 #else
50 #include <asm/page_32_types.h>
51 #define IOREMAP_MAX_ORDER       (PMD_SHIFT)
52 #endif	/* CONFIG_X86_64 */
53 
54 #ifndef __ASSEMBLY__
55 
56 extern int devmem_is_allowed(unsigned long pagenr);
57 
58 extern unsigned long max_low_pfn_mapped;
59 extern unsigned long max_pfn_mapped;
60 
get_max_mapped(void)61 static inline phys_addr_t get_max_mapped(void)
62 {
63 	return (phys_addr_t)max_pfn_mapped << PAGE_SHIFT;
64 }
65 
66 bool pfn_range_is_mapped(unsigned long start_pfn, unsigned long end_pfn);
67 
68 extern unsigned long init_memory_mapping(unsigned long start,
69 					 unsigned long end);
70 
71 extern void initmem_init(void);
72 
73 #endif	/* !__ASSEMBLY__ */
74 
75 #endif	/* _ASM_X86_PAGE_DEFS_H */
76