direct-io.hg

view linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level.h @ 11509:2e6c10dc7c0b

[POWERPC][XEN] make sure put_domain() is called in case of allocate_rma() failuer

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Tue Sep 12 10:53:46 2006 -0400 (2006-09-12)
parents 9c953e1b6fad
children 4fad820a2233
line source
1 #ifndef _I386_PGTABLE_2LEVEL_H
2 #define _I386_PGTABLE_2LEVEL_H
4 #include <asm-generic/pgtable-nopmd.h>
6 #define pte_ERROR(e) \
7 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
8 #define pgd_ERROR(e) \
9 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
11 /*
12 * Certain architectures need to do special things when PTEs
13 * within a page table are directly modified. Thus, the following
14 * hook is made available.
15 */
16 #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
18 #define set_pte_at(_mm,addr,ptep,pteval) do { \
19 if (((_mm) != current->mm && (_mm) != &init_mm) || \
20 HYPERVISOR_update_va_mapping((addr), (pteval), 0)) \
21 set_pte((ptep), (pteval)); \
22 } while (0)
24 #define set_pte_at_sync(_mm,addr,ptep,pteval) do { \
25 if (((_mm) != current->mm && (_mm) != &init_mm) || \
26 HYPERVISOR_update_va_mapping((addr), (pteval), UVMF_INVLPG)) { \
27 set_pte((ptep), (pteval)); \
28 xen_invlpg((addr)); \
29 } \
30 } while (0)
32 #define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval)
34 #define set_pmd(pmdptr, pmdval) xen_l2_entry_update((pmdptr), (pmdval))
36 #define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
37 #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
39 #define ptep_get_and_clear(mm,addr,xp) __pte_ma(xchg(&(xp)->pte_low, 0))
40 #define pte_same(a, b) ((a).pte_low == (b).pte_low)
41 #define pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT)
42 #define pte_pfn(_pte) mfn_to_local_pfn(pte_mfn(_pte))
44 #define pte_page(_pte) pfn_to_page(pte_pfn(_pte))
46 #define pte_none(x) (!(x).pte_low)
47 #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
48 #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
50 /*
51 * All present user pages are user-executable:
52 */
53 static inline int pte_exec(pte_t pte)
54 {
55 return pte_user(pte);
56 }
58 /*
59 * All present pages are kernel-executable:
60 */
61 static inline int pte_exec_kernel(pte_t pte)
62 {
63 return 1;
64 }
66 /*
67 * Bits 0, 6 and 7 are taken, split up the 29 bits of offset
68 * into this range:
69 */
70 #define PTE_FILE_MAX_BITS 29
72 #define pte_to_pgoff(pte) \
73 ((((pte).pte_low >> 1) & 0x1f ) + (((pte).pte_low >> 8) << 5 ))
75 #define pgoff_to_pte(off) \
76 ((pte_t) { (((off) & 0x1f) << 1) + (((off) >> 5) << 8) + _PAGE_FILE })
78 /* Encode and de-code a swap entry */
79 #define __swp_type(x) (((x).val >> 1) & 0x1f)
80 #define __swp_offset(x) ((x).val >> 8)
81 #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
82 #define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low })
83 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
85 #endif /* _I386_PGTABLE_2LEVEL_H */