aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/page.h
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2009-02-09 01:52:14 -0500
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-02-11 17:54:09 -0500
commit51c78eb3f0eb033f9fb4f2316851df1d9b07b953 (patch)
treeb5f49b17a2e90150a976df96d9c07520f0547e03 /arch/x86/include/asm/page.h
parent1484096ceb4d5f2b27c0fe53f125ee0903eac9af (diff)
x86: create _types.h counterparts for page*.h
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Diffstat (limited to 'arch/x86/include/asm/page.h')
-rw-r--r--arch/x86/include/asm/page.h64
1 files changed, 3 insertions, 61 deletions
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
index 40226999cbf8..3b2d2af951c3 100644
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -1,42 +1,9 @@
1#ifndef _ASM_X86_PAGE_H 1#ifndef _ASM_X86_PAGE_H
2#define _ASM_X86_PAGE_H 2#define _ASM_X86_PAGE_H
3 3
4#include <linux/const.h>
5
6/* PAGE_SHIFT determines the page size */
7#define PAGE_SHIFT 12
8#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1))
10
11#ifdef __KERNEL__ 4#ifdef __KERNEL__
12 5
13#define __PHYSICAL_MASK ((phys_addr_t)(1ULL << __PHYSICAL_MASK_SHIFT) - 1) 6#include <asm/page_types.h>
14#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
15
16/* Cast PAGE_MASK to a signed type so that it is sign-extended if
17 virtual addresses are 32-bits but physical addresses are larger
18 (ie, 32-bit PAE). */
19#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
20
21/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
22#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK)
23
24/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */
25#define PTE_FLAGS_MASK (~PTE_PFN_MASK)
26
27#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
28#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
29
30#define HPAGE_SHIFT PMD_SHIFT
31#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
32#define HPAGE_MASK (~(HPAGE_SIZE - 1))
33#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
34
35#define HUGE_MAX_HSTATE 2
36
37#ifndef __ASSEMBLY__
38#include <linux/types.h>
39#endif
40 7
41#ifdef CONFIG_X86_64 8#ifdef CONFIG_X86_64
42#include <asm/page_64.h> 9#include <asm/page_64.h>
@@ -44,39 +11,18 @@
44#include <asm/page_32.h> 11#include <asm/page_32.h>
45#endif /* CONFIG_X86_64 */ 12#endif /* CONFIG_X86_64 */
46 13
47#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
48
49#define VM_DATA_DEFAULT_FLAGS \
50 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
51 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
52
53
54#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
55 15
56typedef struct { pgdval_t pgd; } pgd_t;
57typedef struct { pgprotval_t pgprot; } pgprot_t;
58
59extern int page_is_ram(unsigned long pagenr);
60extern int pagerange_is_ram(unsigned long start, unsigned long end);
61extern int devmem_is_allowed(unsigned long pagenr);
62extern void map_devmem(unsigned long pfn, unsigned long size,
63 pgprot_t vma_prot);
64extern void unmap_devmem(unsigned long pfn, unsigned long size,
65 pgprot_t vma_prot);
66
67extern unsigned long max_low_pfn_mapped;
68extern unsigned long max_pfn_mapped;
69
70struct page; 16struct page;
71 17
72static inline void clear_user_page(void *page, unsigned long vaddr, 18static inline void clear_user_page(void *page, unsigned long vaddr,
73 struct page *pg) 19 struct page *pg)
74{ 20{
75 clear_page(page); 21 clear_page(page);
76} 22}
77 23
78static inline void copy_user_page(void *to, void *from, unsigned long vaddr, 24static inline void copy_user_page(void *to, void *from, unsigned long vaddr,
79 struct page *topage) 25 struct page *topage)
80{ 26{
81 copy_page(to, from); 27 copy_page(to, from);
82} 28}
@@ -102,8 +48,6 @@ static inline pgdval_t pgd_flags(pgd_t pgd)
102 48
103#if PAGETABLE_LEVELS >= 3 49#if PAGETABLE_LEVELS >= 3
104#if PAGETABLE_LEVELS == 4 50#if PAGETABLE_LEVELS == 4
105typedef struct { pudval_t pud; } pud_t;
106
107static inline pud_t native_make_pud(pmdval_t val) 51static inline pud_t native_make_pud(pmdval_t val)
108{ 52{
109 return (pud_t) { val }; 53 return (pud_t) { val };
@@ -127,8 +71,6 @@ static inline pudval_t pud_flags(pud_t pud)
127 return native_pud_val(pud) & PTE_FLAGS_MASK; 71 return native_pud_val(pud) & PTE_FLAGS_MASK;
128} 72}
129 73
130typedef struct { pmdval_t pmd; } pmd_t;
131
132static inline pmd_t native_make_pmd(pmdval_t val) 74static inline pmd_t native_make_pmd(pmdval_t val)
133{ 75{
134 return (pmd_t) { val }; 76 return (pmd_t) { val };