ia64/xen-unstable

view xen/include/asm-x86/x86_64/page.h @ 6538:84ee014ebd41

Merge xen-vtx-unstable.hg
author adsharma@los-vmm.sc.intel.com
date Wed Aug 17 12:34:38 2005 -0800 (2005-08-17)
parents 23979fb12c49 69bf77e1b102
children 99914b54f7bf
line source
2 #ifndef __X86_64_PAGE_H__
3 #define __X86_64_PAGE_H__
5 #define L1_PAGETABLE_SHIFT 12
6 #define L2_PAGETABLE_SHIFT 21
7 #define L3_PAGETABLE_SHIFT 30
8 #define L4_PAGETABLE_SHIFT 39
9 #define PAGE_SHIFT L1_PAGETABLE_SHIFT
10 #define ROOT_PAGETABLE_SHIFT L4_PAGETABLE_SHIFT
12 #define PAGETABLE_ORDER 9
13 #define L1_PAGETABLE_ENTRIES (1<<PAGETABLE_ORDER)
14 #define L2_PAGETABLE_ENTRIES (1<<PAGETABLE_ORDER)
15 #define L3_PAGETABLE_ENTRIES (1<<PAGETABLE_ORDER)
16 #define L4_PAGETABLE_ENTRIES (1<<PAGETABLE_ORDER)
17 #define ROOT_PAGETABLE_ENTRIES L4_PAGETABLE_ENTRIES
19 #define __PAGE_OFFSET (0xFFFF830000000000)
21 /* These are architectural limits. Current CPUs support only 40-bit phys. */
22 #define PADDR_BITS 52
23 #define VADDR_BITS 48
24 #define PADDR_MASK ((1UL << PADDR_BITS)-1)
25 #define VADDR_MASK ((1UL << VADDR_BITS)-1)
27 #ifndef __ASSEMBLY__
29 #include <xen/config.h>
30 #include <asm/types.h>
32 /* read access (should only be used for debug printk's) */
33 typedef u64 intpte_t;
34 #define PRIpte "016lx"
36 typedef struct { intpte_t l1; } l1_pgentry_t;
37 typedef struct { intpte_t l2; } l2_pgentry_t;
38 typedef struct { intpte_t l3; } l3_pgentry_t;
39 typedef struct { intpte_t l4; } l4_pgentry_t;
40 typedef l4_pgentry_t root_pgentry_t;
42 #endif /* !__ASSEMBLY__ */
44 /* Given a virtual address, get an entry offset into a linear page table. */
45 #define l1_linear_offset(_a) (((_a) & VADDR_MASK) >> L1_PAGETABLE_SHIFT)
46 #define l2_linear_offset(_a) (((_a) & VADDR_MASK) >> L2_PAGETABLE_SHIFT)
48 #define is_guest_l1_slot(_s) (1)
49 #define is_guest_l2_slot(_t, _s) (1)
50 #define is_guest_l3_slot(_s) (1)
51 #define is_guest_l4_slot(_s) \
52 (((_s) < ROOT_PAGETABLE_FIRST_XEN_SLOT) || \
53 ((_s) > ROOT_PAGETABLE_LAST_XEN_SLOT))
55 #define root_get_pfn l4e_get_pfn
56 #define root_get_flags l4e_get_flags
57 #define root_get_intpte l4e_get_intpte
58 #define root_empty l4e_empty
59 #define root_from_paddr l4e_from_paddr
60 #define PGT_root_page_table PGT_l4_page_table
62 /*
63 * PTE pfn and flags:
64 * 40-bit pfn = (pte[51:12])
65 * 24-bit flags = (pte[63:52],pte[11:0])
66 */
68 /* Extract flags into 24-bit integer, or turn 24-bit flags into a pte mask. */
69 #define get_pte_flags(x) (((int)((x) >> 40) & ~0xFFF) | ((int)(x) & 0xFFF))
70 #define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 40) | ((x) & 0xFFF))
72 /* Bit 23 of a 24-bit flag mask. This corresponds to bit 63 of a pte.*/
73 #define _PAGE_NX (cpu_has_nx ? (1U<<23) : 0U)
75 #define L1_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PAT/GLOBAL */
76 #define L2_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* PSE/GLOBAL */
77 #define L3_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* must-be-zero */
78 #define L4_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* must-be-zero */
80 #define PAGE_HYPERVISOR (__PAGE_HYPERVISOR | _PAGE_GLOBAL)
81 #define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL)
83 #endif /* __X86_64_PAGE_H__ */
85 /*
86 * Local variables:
87 * mode: C
88 * c-set-style: "BSD"
89 * c-basic-offset: 4
90 * tab-width: 4
91 * indent-tabs-mode: nil
92 * End:
93 */