blob: f32062a821c532d18745347458ec133e9bc803c9 [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
23
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010024#ifdef CONFIG_X86_PAE
Jeremy Fitzhardingead524d42008-06-06 10:21:39 +010025/* 44=32+12, the limit we can fit into an unsigned long pfn */
26#define __PHYSICAL_MASK_SHIFT 44
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010027#define __VIRTUAL_MASK_SHIFT 32
28#define PAGETABLE_LEVELS 3
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#ifndef __ASSEMBLY__
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010031typedef u64 pteval_t;
32typedef u64 pmdval_t;
33typedef u64 pudval_t;
34typedef u64 pgdval_t;
35typedef u64 pgprotval_t;
36typedef u64 phys_addr_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Jeremy Fitzhardingec8e53932008-01-30 13:32:57 +010038typedef union {
39 struct {
40 unsigned long pte_low, pte_high;
41 };
42 pteval_t pte;
43} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010044#endif /* __ASSEMBLY__
45 */
46#else /* !CONFIG_X86_PAE */
47#define __PHYSICAL_MASK_SHIFT 32
48#define __VIRTUAL_MASK_SHIFT 32
49#define PAGETABLE_LEVELS 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010051#ifndef __ASSEMBLY__
52typedef unsigned long pteval_t;
53typedef unsigned long pmdval_t;
54typedef unsigned long pudval_t;
55typedef unsigned long pgdval_t;
56typedef unsigned long pgprotval_t;
57typedef unsigned long phys_addr_t;
David Woodhousecd469e02006-04-27 15:48:08 +010058
Joe Perches095d1c42008-03-23 01:02:57 -070059typedef union {
60 pteval_t pte;
61 pteval_t pte_low;
62} pte_t;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010063
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010064#endif /* __ASSEMBLY__ */
65#endif /* CONFIG_X86_PAE */
66
Ingo Molnar3bf8f5a2008-02-09 00:15:06 +010067#ifndef __ASSEMBLY__
68typedef struct page *pgtable_t;
69#endif
70
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010071#ifdef CONFIG_HUGETLB_PAGE
72#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
73#endif
74
75#ifndef __ASSEMBLY__
Joe Perches095d1c42008-03-23 01:02:57 -070076#define __phys_addr(x) ((x) - PAGE_OFFSET)
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010077#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
78
79#ifdef CONFIG_FLATMEM
80#define pfn_valid(pfn) ((pfn) < max_mapnr)
81#endif /* CONFIG_FLATMEM */
82
83extern int nx_enabled;
84
85/*
86 * This much address space is reserved for vmalloc() and iomap()
87 * as well as fixmap mappings.
88 */
89extern unsigned int __VMALLOC_RESERVE;
90extern int sysctl_legacy_va_layout;
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010091
92#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
Joe Perches095d1c42008-03-23 01:02:57 -070093#define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010094
Yinghai Lu2ec65f82008-06-23 03:05:30 -070095extern void find_low_pfn_range(void);
Yinghai Lu4e296842008-06-24 12:18:14 -070096extern unsigned long init_memory_mapping(unsigned long start,
97 unsigned long end);
Yinghai Lu2ec65f82008-06-23 03:05:30 -070098extern void initmem_init(unsigned long, unsigned long);
Jaswinder Singha80495e2008-07-23 17:33:57 +053099extern void free_initmem(void);
Yinghai Lub2ac82a2008-06-22 02:45:39 -0700100extern void setup_bootmem_allocator(void);
101
102
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +0100103#ifdef CONFIG_X86_USE_3DNOW
104#include <asm/mmx.h>
105
106static inline void clear_page(void *page)
107{
108 mmx_clear_page(page);
109}
110
111static inline void copy_page(void *to, void *from)
112{
113 mmx_copy_page(to, from);
114}
115#else /* !CONFIG_X86_USE_3DNOW */
116#include <linux/string.h>
117
118static inline void clear_page(void *page)
119{
120 memset(page, 0, PAGE_SIZE);
121}
122
123static inline void copy_page(void *to, void *from)
124{
125 memcpy(to, from, PAGE_SIZE);
126}
127#endif /* CONFIG_X86_3DNOW */
128#endif /* !__ASSEMBLY__ */
129
Vegard Nossum77ef50a2008-06-18 17:08:48 +0200130#endif /* ASM_X86__PAGE_32_H */