Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _X86_64_PAGE_H |
| 2 | #define _X86_64_PAGE_H |
| 3 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 4 | #define PAGETABLE_LEVELS 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 6 | #define THREAD_ORDER 1 |
| 7 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) |
Joe Perches | b20a461 | 2008-03-23 01:02:58 -0700 | [diff] [blame] | 8 | #define CURRENT_MASK (~(THREAD_SIZE - 1)) |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 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 | |
Andi Kleen | fbff3c2 | 2008-02-04 16:48:09 +0100 | [diff] [blame] | 26 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) |
| 27 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) |
| 28 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 29 | #define __PAGE_OFFSET _AC(0xffff810000000000, UL) |
| 30 | |
| 31 | #define __PHYSICAL_START CONFIG_PHYSICAL_START |
| 32 | #define __KERNEL_ALIGN 0x200000 |
| 33 | |
| 34 | /* |
| 35 | * Make sure kernel is aligned to 2MB address. Catching it at compile |
| 36 | * time is better. Change your config file and compile the kernel |
| 37 | * for a 2MB aligned address (CONFIG_PHYSICAL_START) |
| 38 | */ |
| 39 | #if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0 |
| 40 | #error "CONFIG_PHYSICAL_START must be a multiple of 2MB" |
| 41 | #endif |
| 42 | |
| 43 | #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) |
| 44 | #define __START_KERNEL_map _AC(0xffffffff80000000, UL) |
| 45 | |
| 46 | /* See Documentation/x86_64/mm.txt for a description of the memory map. */ |
| 47 | #define __PHYSICAL_MASK_SHIFT 46 |
| 48 | #define __VIRTUAL_MASK_SHIFT 48 |
| 49 | |
Ingo Molnar | 88f3aec | 2008-02-21 11:04:11 +0100 | [diff] [blame] | 50 | /* |
Ingo Molnar | 85eb69a | 2008-02-21 12:50:51 +0100 | [diff] [blame] | 51 | * Kernel image size is limited to 512 MB (see level2_kernel_pgt in |
Ingo Molnar | 88f3aec | 2008-02-21 11:04:11 +0100 | [diff] [blame] | 52 | * arch/x86/kernel/head_64.S), and it is mapped here: |
| 53 | */ |
Joe Perches | b20a461 | 2008-03-23 01:02:58 -0700 | [diff] [blame] | 54 | #define KERNEL_IMAGE_SIZE (512 * 1024 * 1024) |
Ingo Molnar | d4afe41 | 2008-02-21 13:39:30 +0100 | [diff] [blame] | 55 | #define KERNEL_IMAGE_START _AC(0xffffffff80000000, UL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | #ifndef __ASSEMBLY__ |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 58 | void clear_page(void *page); |
| 59 | void copy_page(void *to, void *from); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 61 | extern unsigned long end_pfn; |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 62 | extern unsigned long phys_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 64 | extern unsigned long __phys_addr(unsigned long); |
| 65 | #define __phys_reloc_hide(x) (x) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 67 | /* |
| 68 | * These are used to make use of C type-checking.. |
| 69 | */ |
| 70 | typedef unsigned long pteval_t; |
| 71 | typedef unsigned long pmdval_t; |
| 72 | typedef unsigned long pudval_t; |
| 73 | typedef unsigned long pgdval_t; |
| 74 | typedef unsigned long pgprotval_t; |
| 75 | typedef unsigned long phys_addr_t; |
| 76 | |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 77 | typedef struct page *pgtable_t; |
| 78 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 79 | typedef struct { pteval_t pte; } pte_t; |
| 80 | |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 81 | #define vmemmap ((struct page *)VMEMMAP_START) |
| 82 | |
Andi Kleen | cc61503 | 2008-03-12 03:53:28 +0100 | [diff] [blame] | 83 | extern unsigned long init_memory_mapping(unsigned long start, |
| 84 | unsigned long end); |
| 85 | |
Yinghai Lu | 1f75d7e | 2008-06-22 02:44:49 -0700 | [diff] [blame] | 86 | extern void initmem_init(unsigned long start_pfn, unsigned long end_pfn); |
Jeremy Fitzhardinge | 11b7c7d | 2008-01-30 13:32:44 +0100 | [diff] [blame] | 87 | #endif /* !__ASSEMBLY__ */ |
David Woodhouse | cd469e0 | 2006-04-27 15:48:08 +0100 | [diff] [blame] | 88 | |
Jeremy Fitzhardinge | 83a5101 | 2008-01-30 13:32:41 +0100 | [diff] [blame] | 89 | #ifdef CONFIG_FLATMEM |
| 90 | #define pfn_valid(pfn) ((pfn) < end_pfn) |
| 91 | #endif |
| 92 | |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | #endif /* _X86_64_PAGE_H */ |