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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #ifdef __KERNEL__ |
| 5 | #ifndef __ASSEMBLY__ |
| 6 | |
Andi Kleen | b9aac10 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 7 | extern unsigned long end_pfn; |
Thomas Gleixner | a89518b | 2008-01-30 13:30:17 +0100 | [diff] [blame] | 8 | extern unsigned long end_pfn_map; |
Andi Kleen | b9aac10 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 9 | |
Randy Dunlap | 6b4b05b | 2008-01-30 13:31:09 +0100 | [diff] [blame] | 10 | void clear_page(void *page); |
| 11 | void copy_page(void *to, void *from); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
Randy Dunlap | 6b4b05b | 2008-01-30 13:31:09 +0100 | [diff] [blame] | 13 | struct page; |
| 14 | |
| 15 | static void inline clear_user_page(void *page, unsigned long vaddr, |
| 16 | struct page *pg) |
| 17 | { |
| 18 | clear_page(page); |
| 19 | } |
| 20 | |
| 21 | static void inline copy_user_page(void *to, void *from, unsigned long vaddr, |
| 22 | struct page *topage) |
| 23 | { |
| 24 | copy_page(to, from); |
| 25 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
Mel Gorman | 769848c | 2007-07-17 04:03:05 -0700 | [diff] [blame] | 27 | #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ |
| 28 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
| 30 | /* |
| 31 | * These are used to make use of C type-checking.. |
| 32 | */ |
| 33 | typedef struct { unsigned long pte; } pte_t; |
| 34 | typedef struct { unsigned long pmd; } pmd_t; |
| 35 | typedef struct { unsigned long pud; } pud_t; |
| 36 | typedef struct { unsigned long pgd; } pgd_t; |
| 37 | #define PTE_MASK PHYSICAL_PAGE_MASK |
| 38 | |
| 39 | typedef struct { unsigned long pgprot; } pgprot_t; |
| 40 | |
Vivek Goyal | 1ab60e0 | 2007-05-02 19:27:07 +0200 | [diff] [blame] | 41 | extern unsigned long phys_base; |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #define pte_val(x) ((x).pte) |
| 44 | #define pmd_val(x) ((x).pmd) |
| 45 | #define pud_val(x) ((x).pud) |
| 46 | #define pgd_val(x) ((x).pgd) |
| 47 | #define pgprot_val(x) ((x).pgprot) |
| 48 | |
| 49 | #define __pte(x) ((pte_t) { (x) } ) |
| 50 | #define __pmd(x) ((pmd_t) { (x) } ) |
| 51 | #define __pud(x) ((pud_t) { (x) } ) |
| 52 | #define __pgd(x) ((pgd_t) { (x) } ) |
| 53 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
| 54 | |
Vivek Goyal | 9d291e7 | 2007-05-02 19:27:06 +0200 | [diff] [blame] | 55 | #endif /* !__ASSEMBLY__ */ |
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__ |
| 58 | |
| 59 | #include <asm/bug.h> |
| 60 | |
Linus Torvalds | e3ebadd | 2007-05-07 08:44:24 -0700 | [diff] [blame] | 61 | extern unsigned long __phys_addr(unsigned long); |
| 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #endif /* __ASSEMBLY__ */ |
| 64 | |
Linus Torvalds | e3ebadd | 2007-05-07 08:44:24 -0700 | [diff] [blame] | 65 | #define __pa(x) __phys_addr((unsigned long)(x)) |
| 66 | #define __pa_symbol(x) __phys_addr((unsigned long)(x)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) |
Linus Torvalds | e3ebadd | 2007-05-07 08:44:24 -0700 | [diff] [blame] | 69 | #define __boot_va(x) __va(x) |
| 70 | #define __boot_pa(x) __pa(x) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
| 72 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
| 73 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
| 74 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
| 75 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | #define __HAVE_ARCH_GATE_AREA 1 |
Christoph Lameter | 0889eba | 2007-10-16 01:24:15 -0700 | [diff] [blame] | 77 | #define vmemmap ((struct page *)VMEMMAP_START) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
KAMEZAWA Hiroyuki | dc8ecb4 | 2006-03-27 01:15:34 -0800 | [diff] [blame] | 79 | #include <asm-generic/memory_model.h> |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 80 | #include <asm-generic/page.h> |
| 81 | |
David Woodhouse | cd469e0 | 2006-04-27 15:48:08 +0100 | [diff] [blame] | 82 | #endif /* __KERNEL__ */ |
| 83 | |
Jeremy Fitzhardinge | 83a5101 | 2008-01-30 13:32:41 +0100 | [diff] [blame^] | 84 | #ifdef CONFIG_FLATMEM |
| 85 | #define pfn_valid(pfn) ((pfn) < end_pfn) |
| 86 | #endif |
| 87 | |
| 88 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | #endif /* _X86_64_PAGE_H */ |