Xen Test Framework
page-pse.h
Go to the documentation of this file.
1 
6 #ifndef XTF_X86_PAGE_PSE_H
7 #define XTF_X86_PAGE_PSE_H
8 
9 #include <xtf/types.h>
10 
11 #include <arch/page.h>
12 
14 #define PSE_PTE_SIZE 4
15 
16 #define PSE_PTE_ORDER 2
17 
19 #define PSE_PT_ORDER 10
20 
23 #define PSE_L1_PT_ENTRIES (PAGE_SIZE / PSE_PTE_SIZE)
24 #define PSE_L2_PT_ENTRIES (PAGE_SIZE / PSE_PTE_SIZE)
25 
27 #define PSE_L1_PT_SHIFT 12
28 #define PSE_L2_PT_SHIFT 22
29 
30 #ifndef __ASSEMBLY__
31 
34 #define PSE_PRIpte "08"PRIx32
35 
36 static inline unsigned int pse_l1_table_offset(unsigned long linear)
37 {
38  return (linear >> PSE_L1_PT_SHIFT) & (PSE_L1_PT_ENTRIES - 1);
39 }
40 static inline unsigned int pse_l2_table_offset(unsigned long linear)
41 {
42  return (linear >> PSE_L2_PT_SHIFT) & (PSE_L2_PT_ENTRIES - 1);
43 }
44 
45 static inline uint32_t fold_pse36(uint64_t val)
46 {
47  return (val & ~(0x1ffULL << 13)) | ((val & (0x1ffULL << 32)) >> (32 - 13));
48 }
49 
50 static inline uint64_t unfold_pse36(uint32_t val)
51 {
52  return (val & ~(0x1ffULL << 13)) | ((val & (0x1ffULL << 13)) << (32 - 13));
53 }
54 
55 #endif /* __ASSEMBLY__ */
56 #endif /* XTF_X86_PAGE_PSE_H */
57 
58 /*
59  * Local variables:
60  * mode: C
61  * c-file-style: "BSD"
62  * c-basic-offset: 4
63  * tab-width: 4
64  * indent-tabs-mode: nil
65  * End:
66  */
Common declarations for all tests.
static unsigned int pse_l1_table_offset(unsigned long linear)
Definition: page-pse.h:36
uint32_t pse_intpte_t
Integer representation of a PTE.
Definition: page-pse.h:33
#define PSE_L2_PT_ENTRIES
Definition: page-pse.h:24
static uint64_t unfold_pse36(uint32_t val)
Definition: page-pse.h:50
#define PSE_L2_PT_SHIFT
Definition: page-pse.h:28
static unsigned int pse_l2_table_offset(unsigned long linear)
Definition: page-pse.h:40
static uint32_t fold_pse36(uint64_t val)
Definition: page-pse.h:45
#define PSE_L1_PT_SHIFT
Definition: page-pse.h:27
__UINT64_TYPE__ uint64_t
Definition: stdint.h:17
__UINT32_TYPE__ uint32_t
Definition: stdint.h:16
#define PSE_L1_PT_ENTRIES
All PSE pagetables contain 1024 entries.
Definition: page-pse.h:23