ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h @ 11221:7c9d7fc3dce5

[HVM] Fix SMBIOS entry point copy destination.
Spotted by Xiaowei Yang <xiaowei.yang@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Sat Aug 19 12:06:36 2006 +0100 (2006-08-19)
parents 9c953e1b6fad
children ade94aa072c5
line source
1 #ifndef _X86_64_PAGE_H
2 #define _X86_64_PAGE_H
4 #include <linux/config.h>
5 /* #include <linux/string.h> */
6 #ifndef __ASSEMBLY__
7 #include <linux/kernel.h>
8 #include <linux/types.h>
9 #include <asm/bug.h>
10 #endif
11 #include <xen/interface/xen.h>
12 #include <xen/foreign_page.h>
14 #define arch_free_page(_page,_order) \
15 ({ int foreign = PageForeign(_page); \
16 if (foreign) \
17 (PageForeignDestructor(_page))(_page); \
18 foreign; \
19 })
20 #define HAVE_ARCH_FREE_PAGE
22 #ifdef CONFIG_XEN_SCRUB_PAGES
23 #define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
24 #else
25 #define scrub_pages(_p,_n) ((void)0)
26 #endif
28 /* PAGE_SHIFT determines the page size */
29 #define PAGE_SHIFT 12
30 #ifdef __ASSEMBLY__
31 #define PAGE_SIZE (0x1 << PAGE_SHIFT)
32 #else
33 #define PAGE_SIZE (1UL << PAGE_SHIFT)
34 #endif
35 #define PAGE_MASK (~(PAGE_SIZE-1))
36 #define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK)
38 #define THREAD_ORDER 1
39 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
40 #define CURRENT_MASK (~(THREAD_SIZE-1))
42 #define EXCEPTION_STACK_ORDER 0
43 #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
45 #define DEBUG_STACK_ORDER EXCEPTION_STACK_ORDER
46 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
48 #define IRQSTACK_ORDER 2
49 #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
51 #define STACKFAULT_STACK 1
52 #define DOUBLEFAULT_STACK 2
53 #define NMI_STACK 3
54 #define DEBUG_STACK 4
55 #define MCE_STACK 5
56 #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
58 #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
59 #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
61 #define HPAGE_SHIFT PMD_SHIFT
62 #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
63 #define HPAGE_MASK (~(HPAGE_SIZE - 1))
64 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
66 #ifdef __KERNEL__
67 #ifndef __ASSEMBLY__
69 extern unsigned long end_pfn;
71 #include <asm/maddr.h>
73 void clear_page(void *);
74 void copy_page(void *, void *);
76 #define clear_user_page(page, vaddr, pg) clear_page(page)
77 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
79 #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
80 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
82 /*
83 * These are used to make use of C type-checking..
84 */
85 typedef struct { unsigned long pte; } pte_t;
86 typedef struct { unsigned long pmd; } pmd_t;
87 typedef struct { unsigned long pud; } pud_t;
88 typedef struct { unsigned long pgd; } pgd_t;
89 #define PTE_MASK PHYSICAL_PAGE_MASK
91 typedef struct { unsigned long pgprot; } pgprot_t;
93 #define pte_val(x) (((x).pte & 1) ? machine_to_phys((x).pte) : \
94 (x).pte)
95 #define pte_val_ma(x) ((x).pte)
97 static inline unsigned long pmd_val(pmd_t x)
98 {
99 unsigned long ret = x.pmd;
100 if (ret) ret = machine_to_phys(ret);
101 return ret;
102 }
104 static inline unsigned long pud_val(pud_t x)
105 {
106 unsigned long ret = x.pud;
107 if (ret) ret = machine_to_phys(ret);
108 return ret;
109 }
111 static inline unsigned long pgd_val(pgd_t x)
112 {
113 unsigned long ret = x.pgd;
114 if (ret) ret = machine_to_phys(ret);
115 return ret;
116 }
118 #define pgprot_val(x) ((x).pgprot)
120 static inline pte_t __pte(unsigned long x)
121 {
122 if (x & 1) x = phys_to_machine(x);
123 return ((pte_t) { (x) });
124 }
126 static inline pmd_t __pmd(unsigned long x)
127 {
128 if ((x & 1)) x = phys_to_machine(x);
129 return ((pmd_t) { (x) });
130 }
132 static inline pud_t __pud(unsigned long x)
133 {
134 if ((x & 1)) x = phys_to_machine(x);
135 return ((pud_t) { (x) });
136 }
138 static inline pgd_t __pgd(unsigned long x)
139 {
140 if ((x & 1)) x = phys_to_machine(x);
141 return ((pgd_t) { (x) });
142 }
144 #define __pgprot(x) ((pgprot_t) { (x) } )
146 #define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START)
147 #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
148 #define __START_KERNEL_map 0xffffffff80000000UL
149 #define __PAGE_OFFSET 0xffff880000000000UL
151 #else
152 #define __PHYSICAL_START CONFIG_PHYSICAL_START
153 #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
154 #define __START_KERNEL_map 0xffffffff80000000
155 #define __PAGE_OFFSET 0xffff880000000000
156 #endif /* !__ASSEMBLY__ */
158 #ifdef CONFIG_XEN_COMPAT_030002
159 #undef LOAD_OFFSET
160 #define LOAD_OFFSET 0
161 #endif /* CONFIG_XEN_COMPAT_030002 */
163 /* to align the pointer to the (next) page boundary */
164 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
166 /* See Documentation/x86_64/mm.txt for a description of the memory map. */
167 #define __PHYSICAL_MASK_SHIFT 46
168 #define __PHYSICAL_MASK ((1UL << __PHYSICAL_MASK_SHIFT) - 1)
169 #define __VIRTUAL_MASK_SHIFT 48
170 #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
172 #define KERNEL_TEXT_SIZE (40UL*1024*1024)
173 #define KERNEL_TEXT_START 0xffffffff80000000UL
175 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
177 /* Note: __pa(&symbol_visible_to_c) should be always replaced with __pa_symbol.
178 Otherwise you risk miscompilation. */
179 #define __pa(x) (((unsigned long)(x)>=__START_KERNEL_map)?(unsigned long)(x) - (unsigned long)__START_KERNEL_map:(unsigned long)(x) - PAGE_OFFSET)
180 /* __pa_symbol should be used for C visible symbols.
181 This seems to be the official gcc blessed way to do such arithmetic. */
182 #define __pa_symbol(x) \
183 ({unsigned long v; \
184 asm("" : "=r" (v) : "0" (x)); \
185 __pa(v); })
187 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
188 #define __boot_va(x) __va(x)
189 #define __boot_pa(x) __pa(x)
190 #ifdef CONFIG_FLATMEM
191 #define pfn_to_page(pfn) (mem_map + (pfn))
192 #define page_to_pfn(page) ((unsigned long)((page) - mem_map))
193 #define pfn_valid(pfn) ((pfn) < end_pfn)
194 #endif
196 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
197 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
198 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
200 #define VM_DATA_DEFAULT_FLAGS \
201 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
202 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
204 #define __HAVE_ARCH_GATE_AREA 1
206 #endif /* __KERNEL__ */
208 #include <asm-generic/page.h>
210 #endif /* _X86_64_PAGE_H */