blob: ebf977a809a8e9a1efcb7ae23553bc7e9c25ca13 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _X86_64_PAGE_H
2#define _X86_64_PAGE_H
3
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +01004#define PAGETABLE_LEVELS 4
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +01006#define THREAD_ORDER 1
7#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
8#define CURRENT_MASK (~(THREAD_SIZE-1))
9
10#define EXCEPTION_STACK_ORDER 0
11#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
12
13#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
14#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
15
16#define IRQSTACK_ORDER 2
17#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
18
19#define STACKFAULT_STACK 1
20#define DOUBLEFAULT_STACK 2
21#define NMI_STACK 3
22#define DEBUG_STACK 4
23#define MCE_STACK 5
24#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
25
26#define __PAGE_OFFSET _AC(0xffff810000000000, UL)
27
28#define __PHYSICAL_START CONFIG_PHYSICAL_START
29#define __KERNEL_ALIGN 0x200000
30
31/*
32 * Make sure kernel is aligned to 2MB address. Catching it at compile
33 * time is better. Change your config file and compile the kernel
34 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
35 */
36#if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
37#error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
38#endif
39
40#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
41#define __START_KERNEL_map _AC(0xffffffff80000000, UL)
42
43/* See Documentation/x86_64/mm.txt for a description of the memory map. */
44#define __PHYSICAL_MASK_SHIFT 46
45#define __VIRTUAL_MASK_SHIFT 48
46
47#define KERNEL_TEXT_SIZE (40*1024*1024)
48#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#ifndef __ASSEMBLY__
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010051void clear_page(void *page);
52void copy_page(void *to, void *from);
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010054extern unsigned long end_pfn;
55extern unsigned long end_pfn_map;
56extern unsigned long phys_base;
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010058extern unsigned long __phys_addr(unsigned long);
59#define __phys_reloc_hide(x) (x)
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Jeremy Fitzhardinge11b7c7d2008-01-30 13:32:44 +010061/*
62 * These are used to make use of C type-checking..
63 */
64typedef unsigned long pteval_t;
65typedef unsigned long pmdval_t;
66typedef unsigned long pudval_t;
67typedef unsigned long pgdval_t;
68typedef unsigned long pgprotval_t;
69typedef unsigned long phys_addr_t;
70
71typedef struct { pteval_t pte; } pte_t;
72
73#define native_pte_val(x) ((x).pte)
74#define native_make_pte(x) ((pte_t) { (x) } )
75
76#define vmemmap ((struct page *)VMEMMAP_START)
77
78#endif /* !__ASSEMBLY__ */
David Woodhousecd469e02006-04-27 15:48:08 +010079
Jeremy Fitzhardinge83a51012008-01-30 13:32:41 +010080#ifdef CONFIG_FLATMEM
81#define pfn_valid(pfn) ((pfn) < end_pfn)
82#endif
83
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#endif /* _X86_64_PAGE_H */