ia64/xen-unstable

view xen/arch/x86/mm/shadow/page-guest32.h @ 13915:a00b8d3800a8

[XEN] Snapshot PAE l3es when they are shadowed.
We don't update the shadows so we mustn't look at the guest l3es
or we'll be confused by them if they change.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Wed Feb 14 14:46:18 2007 +0000 (2007-02-14)
parents fab84f9c0ce6
children
line source
2 #ifndef __X86_PAGE_GUEST_H__
3 #define __X86_PAGE_GUEST_H__
5 #ifndef __ASSEMBLY__
6 # include <asm/types.h>
7 #endif
9 #define PAGETABLE_ORDER_32 10
10 #define L1_PAGETABLE_ENTRIES_32 (1<<PAGETABLE_ORDER_32)
11 #define L2_PAGETABLE_ENTRIES_32 (1<<PAGETABLE_ORDER_32)
12 #define ROOT_PAGETABLE_ENTRIES_32 L2_PAGETABLE_ENTRIES_32
15 #define L1_PAGETABLE_SHIFT_32 12
16 #define L2_PAGETABLE_SHIFT_32 22
18 /* Extract flags into 12-bit integer, or turn 12-bit flags into a pte mask. */
20 #ifndef __ASSEMBLY__
22 typedef u32 intpte_32_t;
24 typedef struct { intpte_32_t l1; } l1_pgentry_32_t;
25 typedef struct { intpte_32_t l2; } l2_pgentry_32_t;
26 typedef l2_pgentry_t root_pgentry_32_t;
27 #endif
29 #define get_pte_flags_32(x) ((u32)(x) & 0xFFF)
30 #define put_pte_flags_32(x) ((intpte_32_t)(x))
32 /* Get pte access flags (unsigned int). */
33 #define l1e_get_flags_32(x) (get_pte_flags_32((x).l1))
34 #define l2e_get_flags_32(x) (get_pte_flags_32((x).l2))
36 #define l1e_get_paddr_32(x) \
37 ((paddr_t)(((x).l1 & (PADDR_MASK&PAGE_MASK))))
38 #define l2e_get_paddr_32(x) \
39 ((paddr_t)(((x).l2 & (PADDR_MASK&PAGE_MASK))))
41 /* Construct an empty pte. */
42 #define l1e_empty_32() ((l1_pgentry_32_t) { 0 })
43 #define l2e_empty_32() ((l2_pgentry_32_t) { 0 })
45 /* Construct a pte from a pfn and access flags. */
46 #define l1e_from_pfn_32(pfn, flags) \
47 ((l1_pgentry_32_t) { ((intpte_32_t)(pfn) << PAGE_SHIFT) | put_pte_flags_32(flags) })
48 #define l2e_from_pfn_32(pfn, flags) \
49 ((l2_pgentry_32_t) { ((intpte_32_t)(pfn) << PAGE_SHIFT) | put_pte_flags_32(flags) })
51 /* Construct a pte from a physical address and access flags. */
52 #ifndef __ASSEMBLY__
53 static inline l1_pgentry_32_t l1e_from_paddr_32(paddr_t pa, unsigned int flags)
54 {
55 ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
56 return (l1_pgentry_32_t) { pa | put_pte_flags_32(flags) };
57 }
58 static inline l2_pgentry_32_t l2e_from_paddr_32(paddr_t pa, unsigned int flags)
59 {
60 ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0);
61 return (l2_pgentry_32_t) { pa | put_pte_flags_32(flags) };
62 }
63 #endif /* !__ASSEMBLY__ */
66 /* Construct a pte from a page pointer and access flags. */
67 #define l1e_from_page_32(page, flags) (l1e_from_pfn_32(page_to_mfn(page),(flags)))
68 #define l2e_from_page_32(page, flags) (l2e_from_pfn_32(page_to_mfn(page),(flags)))
70 /* Add extra flags to an existing pte. */
71 #define l1e_add_flags_32(x, flags) ((x).l1 |= put_pte_flags_32(flags))
72 #define l2e_add_flags_32(x, flags) ((x).l2 |= put_pte_flags_32(flags))
74 /* Remove flags from an existing pte. */
75 #define l1e_remove_flags_32(x, flags) ((x).l1 &= ~put_pte_flags_32(flags))
76 #define l2e_remove_flags_32(x, flags) ((x).l2 &= ~put_pte_flags_32(flags))
78 /* Check if a pte's page mapping or significant access flags have changed. */
79 #define l1e_has_changed_32(x,y,flags) \
80 ( !!(((x).l1 ^ (y).l1) & ((PADDR_MASK&PAGE_MASK)|put_pte_flags_32(flags))) )
81 #define l2e_has_changed_32(x,y,flags) \
82 ( !!(((x).l2 ^ (y).l2) & ((PADDR_MASK&PAGE_MASK)|put_pte_flags_32(flags))) )
84 /* Given a virtual address, get an entry offset into a page table. */
85 #define l1_table_offset_32(a) \
86 (((a) >> L1_PAGETABLE_SHIFT_32) & (L1_PAGETABLE_ENTRIES_32 - 1))
87 #define l2_table_offset_32(a) \
88 (((a) >> L2_PAGETABLE_SHIFT_32) & (L2_PAGETABLE_ENTRIES_32 - 1))
90 #endif /* __X86_PAGE_GUEST_H__ */
92 /*
93 * Local variables:
94 * mode: C
95 * c-set-style: "BSD"
96 * c-basic-offset: 4
97 * tab-width: 4
98 * indent-tabs-mode: nil
99 * End:
100 */