blob: 50b33ebcf851f385dfa8bd9788cbb94371df2df4 [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
Christoph Lameterb84200b2008-04-28 18:52:40 -070016#ifdef CONFIG_4KSTACKS
17#define THREAD_ORDER 0
18#else
19#define THREAD_ORDER 1
20#endif
21#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
22
23
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010024#ifdef CONFIG_X86_PAE
25#define __PHYSICAL_MASK_SHIFT 36
26#define __VIRTUAL_MASK_SHIFT 32
27#define PAGETABLE_LEVELS 3
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#ifndef __ASSEMBLY__
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010030typedef u64 pteval_t;
31typedef u64 pmdval_t;
32typedef u64 pudval_t;
33typedef u64 pgdval_t;
34typedef u64 pgprotval_t;
35typedef u64 phys_addr_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Jeremy Fitzhardingec8e53932008-01-30 13:32:57 +010037typedef union {
38 struct {
39 unsigned long pte_low, pte_high;
40 };
41 pteval_t pte;
42} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010043#endif /* __ASSEMBLY__
44 */
45#else /* !CONFIG_X86_PAE */
46#define __PHYSICAL_MASK_SHIFT 32
47#define __VIRTUAL_MASK_SHIFT 32
48#define PAGETABLE_LEVELS 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010050#ifndef __ASSEMBLY__
51typedef unsigned long pteval_t;
52typedef unsigned long pmdval_t;
53typedef unsigned long pudval_t;
54typedef unsigned long pgdval_t;
55typedef unsigned long pgprotval_t;
56typedef unsigned long phys_addr_t;
David Woodhousecd469e02006-04-27 15:48:08 +010057
Joe Perches095d1c42008-03-23 01:02:57 -070058typedef union {
59 pteval_t pte;
60 pteval_t pte_low;
61} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010062
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010063#endif /* __ASSEMBLY__ */
64#endif /* CONFIG_X86_PAE */
65
Ingo Molnar3bf8f5a2008-02-09 00:15:06 +010066#ifndef __ASSEMBLY__
67typedef struct page *pgtable_t;
68#endif
69
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010070#ifdef CONFIG_HUGETLB_PAGE
71#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
72#endif
73
74#ifndef __ASSEMBLY__
Joe Perches095d1c42008-03-23 01:02:57 -070075#define __phys_addr(x) ((x) - PAGE_OFFSET)
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010076#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
77
78#ifdef CONFIG_FLATMEM
79#define pfn_valid(pfn) ((pfn) < max_mapnr)
80#endif /* CONFIG_FLATMEM */
81
82extern int nx_enabled;
83
84/*
85 * This much address space is reserved for vmalloc() and iomap()
86 * as well as fixmap mappings.
87 */
88extern unsigned int __VMALLOC_RESERVE;
89extern int sysctl_legacy_va_layout;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010090
91#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
Joe Perches095d1c42008-03-23 01:02:57 -070092#define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010093
94#ifdef CONFIG_X86_USE_3DNOW
95#include <asm/mmx.h>
96
97static inline void clear_page(void *page)
98{
99 mmx_clear_page(page);
100}
101
102static inline void copy_page(void *to, void *from)
103{
104 mmx_copy_page(to, from);
105}
106#else /* !CONFIG_X86_USE_3DNOW */
107#include <linux/string.h>
108
109static inline void clear_page(void *page)
110{
111 memset(page, 0, PAGE_SIZE);
112}
113
114static inline void copy_page(void *to, void *from)
115{
116 memcpy(to, from, PAGE_SIZE);
117}
118#endif /* CONFIG_X86_3DNOW */
119#endif /* !__ASSEMBLY__ */
120
121#endif /* _ASM_X86_PAGE_32_H */