source: trunk/packages/xen-common/xen-common/xen/include/asm-x86/x86_32/page-2level.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 1.7 KB
Line 
1#ifndef __X86_32_PAGE_2LEVEL_H__
2#define __X86_32_PAGE_2LEVEL_H__
3
4#define L1_PAGETABLE_SHIFT      12
5#define L2_PAGETABLE_SHIFT      22
6#define PAGE_SHIFT              L1_PAGETABLE_SHIFT
7#define ROOT_PAGETABLE_SHIFT    L2_PAGETABLE_SHIFT
8
9#define PAGETABLE_ORDER         10
10#define L1_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
11#define L2_PAGETABLE_ENTRIES    (1<<PAGETABLE_ORDER)
12#define ROOT_PAGETABLE_ENTRIES  L2_PAGETABLE_ENTRIES
13
14#define PADDR_BITS              32
15#define PADDR_MASK              (~0UL)
16
17#ifndef __ASSEMBLY__
18
19#include <asm/types.h>
20
21/* read access (should only be used for debug printk's) */
22typedef u32 intpte_t;
23#define PRIpte "08x"
24
25typedef struct { intpte_t l1; } l1_pgentry_t;
26typedef struct { intpte_t l2; } l2_pgentry_t;
27typedef l2_pgentry_t root_pgentry_t;
28
29#endif /* !__ASSEMBLY__ */
30
31#define pte_read_atomic(ptep)       (*(ptep))
32#define pte_write_atomic(ptep, pte) (*(ptep) = (pte))
33#define pte_write(ptep, pte)        (*(ptep) = (pte))
34
35/* root table */
36#define root_get_pfn              l2e_get_pfn
37#define root_get_flags            l2e_get_flags
38#define root_get_intpte           l2e_get_intpte
39#define root_empty                l2e_empty
40#define root_from_paddr           l2e_from_paddr
41#define PGT_root_page_table       PGT_l2_page_table
42
43/* misc */
44#define is_guest_l1_slot(_s)    (1)
45#define is_guest_l2_slot(_d, _t,_s) ((_s) < L2_PAGETABLE_FIRST_XEN_SLOT)
46
47/*
48 * PTE pfn and flags:
49 *  20-bit pfn   = (pte[31:12])
50 *  12-bit flags = (pte[11:0])
51 */
52
53#define _PAGE_NX_BIT            0U
54#define _PAGE_NX                0U
55
56/* Extract flags into 12-bit integer, or turn 12-bit flags into a pte mask. */
57#define get_pte_flags(x) ((int)(x) & 0xFFF)
58#define put_pte_flags(x) ((intpte_t)((x) & 0xFFF))
59
60#endif /* __X86_32_PAGE_2LEVEL_H__ */
Note: See TracBrowser for help on using the repository browser.