blob: 424e82f8ae272888d0a3faa73e23b56454b2fd66 [file] [log] [blame]
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +01001#ifndef _ASM_X86_PAGE_32_H
2#define _ASM_X86_PAGE_32_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
Linus Torvalds1da177e2005-04-16 15:20:36 -07004/*
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +01005 * This handles the memory map.
6 *
7 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
8 * a virtual address space of one gigabyte, which limits the
9 * amount of physical memory you can use to about 950MB.
10 *
11 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
12 * and CONFIG_HIGHMEM64G options in the kernel configuration.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 */
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010014#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
Jeremy Fitzhardinge3dc494e2007-05-02 19:27:13 +020015
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010016#ifdef CONFIG_X86_PAE
17#define __PHYSICAL_MASK_SHIFT 36
18#define __VIRTUAL_MASK_SHIFT 32
19#define PAGETABLE_LEVELS 3
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#ifndef __ASSEMBLY__
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010022typedef u64 pteval_t;
23typedef u64 pmdval_t;
24typedef u64 pudval_t;
25typedef u64 pgdval_t;
26typedef u64 pgprotval_t;
27typedef u64 phys_addr_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Jeremy Fitzhardingec8e53932008-01-30 13:32:57 +010029typedef union {
30 struct {
31 unsigned long pte_low, pte_high;
32 };
33 pteval_t pte;
34} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010035#endif /* __ASSEMBLY__
36 */
37#else /* !CONFIG_X86_PAE */
38#define __PHYSICAL_MASK_SHIFT 32
39#define __VIRTUAL_MASK_SHIFT 32
40#define PAGETABLE_LEVELS 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010042#ifndef __ASSEMBLY__
43typedef unsigned long pteval_t;
44typedef unsigned long pmdval_t;
45typedef unsigned long pudval_t;
46typedef unsigned long pgdval_t;
47typedef unsigned long pgprotval_t;
48typedef unsigned long phys_addr_t;
David Woodhousecd469e02006-04-27 15:48:08 +010049
Joe Perches095d1c42008-03-23 01:02:57 -070050typedef union {
51 pteval_t pte;
52 pteval_t pte_low;
53} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010054
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010055#endif /* __ASSEMBLY__ */
56#endif /* CONFIG_X86_PAE */
57
Ingo Molnar3bf8f5a2008-02-09 00:15:06 +010058#ifndef __ASSEMBLY__
59typedef struct page *pgtable_t;
60#endif
61
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010062#ifdef CONFIG_HUGETLB_PAGE
63#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
64#endif
65
66#ifndef __ASSEMBLY__
Joe Perches095d1c42008-03-23 01:02:57 -070067#define __phys_addr(x) ((x) - PAGE_OFFSET)
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010068#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
69
70#ifdef CONFIG_FLATMEM
71#define pfn_valid(pfn) ((pfn) < max_mapnr)
72#endif /* CONFIG_FLATMEM */
73
74extern int nx_enabled;
75
76/*
77 * This much address space is reserved for vmalloc() and iomap()
78 * as well as fixmap mappings.
79 */
80extern unsigned int __VMALLOC_RESERVE;
81extern int sysctl_legacy_va_layout;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010082
83#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
Joe Perches095d1c42008-03-23 01:02:57 -070084#define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010085
86#ifdef CONFIG_X86_USE_3DNOW
87#include <asm/mmx.h>
88
89static inline void clear_page(void *page)
90{
91 mmx_clear_page(page);
92}
93
94static inline void copy_page(void *to, void *from)
95{
96 mmx_copy_page(to, from);
97}
98#else /* !CONFIG_X86_USE_3DNOW */
99#include <linux/string.h>
100
101static inline void clear_page(void *page)
102{
103 memset(page, 0, PAGE_SIZE);
104}
105
106static inline void copy_page(void *to, void *from)
107{
108 memcpy(to, from, PAGE_SIZE);
109}
110#endif /* CONFIG_X86_3DNOW */
111#endif /* !__ASSEMBLY__ */
112
113#endif /* _ASM_X86_PAGE_32_H */