blob: e8d80d1de237bd502ce1412862f71d17bb201d90 [file] [log] [blame]
Vegard Nossum77ef50a2008-06-18 17:08:48 +02001#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
Alexander van Heukelum699d2932008-10-03 22:00:32 +020023#define STACKFAULT_STACK 0
24#define DOUBLEFAULT_STACK 1
25#define NMI_STACK 0
26#define DEBUG_STACK 0
27#define MCE_STACK 0
28#define N_EXCEPTION_STACKS 1
Christoph Lameterb84200b2008-04-28 18:52:40 -070029
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010030#ifdef CONFIG_X86_PAE
Jeremy Fitzhardingead524d42008-06-06 10:21:39 +010031/* 44=32+12, the limit we can fit into an unsigned long pfn */
32#define __PHYSICAL_MASK_SHIFT 44
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010033#define __VIRTUAL_MASK_SHIFT 32
34#define PAGETABLE_LEVELS 3
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#ifndef __ASSEMBLY__
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010037typedef u64 pteval_t;
38typedef u64 pmdval_t;
39typedef u64 pudval_t;
40typedef u64 pgdval_t;
41typedef u64 pgprotval_t;
42typedef u64 phys_addr_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Jeremy Fitzhardingec8e53932008-01-30 13:32:57 +010044typedef union {
45 struct {
46 unsigned long pte_low, pte_high;
47 };
48 pteval_t pte;
49} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010050#endif /* __ASSEMBLY__
51 */
52#else /* !CONFIG_X86_PAE */
53#define __PHYSICAL_MASK_SHIFT 32
54#define __VIRTUAL_MASK_SHIFT 32
55#define PAGETABLE_LEVELS 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010057#ifndef __ASSEMBLY__
58typedef unsigned long pteval_t;
59typedef unsigned long pmdval_t;
60typedef unsigned long pudval_t;
61typedef unsigned long pgdval_t;
62typedef unsigned long pgprotval_t;
63typedef unsigned long phys_addr_t;
David Woodhousecd469e02006-04-27 15:48:08 +010064
Joe Perches095d1c42008-03-23 01:02:57 -070065typedef union {
66 pteval_t pte;
67 pteval_t pte_low;
68} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010069
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010070#endif /* __ASSEMBLY__ */
71#endif /* CONFIG_X86_PAE */
72
Ingo Molnar3bf8f5a2008-02-09 00:15:06 +010073#ifndef __ASSEMBLY__
74typedef struct page *pgtable_t;
75#endif
76
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010077#ifdef CONFIG_HUGETLB_PAGE
78#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
79#endif
80
81#ifndef __ASSEMBLY__
Vegard Nossumaf5c2bd2008-10-03 17:54:25 +020082#define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET)
Jiri Slabya1bf9632008-06-12 13:56:40 +020083#ifdef CONFIG_DEBUG_VIRTUAL
Jiri Slaby59ea7462008-06-12 13:56:40 +020084extern unsigned long __phys_addr(unsigned long);
Jiri Slabya1bf9632008-06-12 13:56:40 +020085#else
Vegard Nossumaf5c2bd2008-10-03 17:54:25 +020086#define __phys_addr(x) __phys_addr_nodebug(x)
Jiri Slabya1bf9632008-06-12 13:56:40 +020087#endif
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010088#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
89
90#ifdef CONFIG_FLATMEM
91#define pfn_valid(pfn) ((pfn) < max_mapnr)
92#endif /* CONFIG_FLATMEM */
93
94extern int nx_enabled;
95
96/*
97 * This much address space is reserved for vmalloc() and iomap()
98 * as well as fixmap mappings.
99 */
100extern unsigned int __VMALLOC_RESERVE;
101extern int sysctl_legacy_va_layout;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +0100102
Yinghai Lu2ec65f82008-06-23 03:05:30 -0700103extern void find_low_pfn_range(void);
Yinghai Lu4e296842008-06-24 12:18:14 -0700104extern unsigned long init_memory_mapping(unsigned long start,
105 unsigned long end);
Yinghai Lu2ec65f82008-06-23 03:05:30 -0700106extern void initmem_init(unsigned long, unsigned long);
Jaswinder Singha80495e2008-07-23 17:33:57 +0530107extern void free_initmem(void);
Yinghai Lub2ac82a2008-06-22 02:45:39 -0700108extern void setup_bootmem_allocator(void);
109
110
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +0100111#ifdef CONFIG_X86_USE_3DNOW
112#include <asm/mmx.h>
113
114static inline void clear_page(void *page)
115{
116 mmx_clear_page(page);
117}
118
119static inline void copy_page(void *to, void *from)
120{
121 mmx_copy_page(to, from);
122}
123#else /* !CONFIG_X86_USE_3DNOW */
124#include <linux/string.h>
125
126static inline void clear_page(void *page)
127{
128 memset(page, 0, PAGE_SIZE);
129}
130
131static inline void copy_page(void *to, void *from)
132{
133 memcpy(to, from, PAGE_SIZE);
134}
135#endif /* CONFIG_X86_3DNOW */
136#endif /* !__ASSEMBLY__ */
137
Vegard Nossum77ef50a2008-06-18 17:08:48 +0200138#endif /* ASM_X86__PAGE_32_H */