Xen Test Framework
arch
x86
include
arch
pagetable.h
Go to the documentation of this file.
1
#ifndef XTF_X86_PAGETABLE_H
2
#define XTF_X86_PAGETABLE_H
3
4
#include <
arch/mm.h
>
5
6
#if CONFIG_PAGING_LEVELS > 0
7
8
static
inline
paddr_t
pte_to_paddr
(
intpte_t
pte)
9
{
10
return
pte &
PADDR_MASK
&
PAGE_MASK
;
11
}
12
13
static
inline
intpte_t
pte_from_paddr
(
paddr_t
paddr,
uint64_t
flags)
14
{
15
return
((paddr & (
PADDR_MASK
&
PAGE_MASK
)) |
16
(flags & ~(
PADDR_MASK
&
PAGE_MASK
)));
17
}
18
19
static
inline
intpte_t
pte_from_gfn
(
unsigned
long
gfn,
uint64_t
flags)
20
{
21
return
pte_from_paddr
((
paddr_t
)gfn <<
PAGE_SHIFT
, flags);
22
}
23
24
static
inline
intpte_t
pte_from_virt
(
const
void
*va,
uint64_t
flags)
25
{
26
return
pte_from_paddr
((
paddr_t
)
virt_to_gfn
(va) <<
PAGE_SHIFT
, flags);
27
}
28
29
#else
/* CONFIG_PAGING_LEVELS > 0 */
30
31
/* Enough compatibility to compile in unpaged environments. */
32
paddr_t
pte_to_paddr
(
intpte_t
pte);
33
intpte_t
pte_from_paddr
(
paddr_t
paddr,
uint64_t
flags);
34
intpte_t
pte_from_gfn
(
unsigned
long
gfn,
uint64_t
flags);
35
intpte_t
pte_from_virt
(
const
void
*va,
uint64_t
flags);
36
37
#endif
38
39
#endif
/* XTF_X86_PAGETABLE_H */
40
41
/*
42
* Local variables:
43
* mode: C
44
* c-file-style: "BSD"
45
* c-basic-offset: 4
46
* tab-width: 4
47
* indent-tabs-mode: nil
48
* End:
49
*/
mm.h
virt_to_gfn
static unsigned long virt_to_gfn(const void *va)
Definition:
mm.h:100
paddr_t
uint64_t paddr_t
Definition:
page.h:96
PADDR_MASK
#define PADDR_MASK
Definition:
page.h:15
PAGE_SHIFT
#define PAGE_SHIFT
Definition:
page.h:10
intpte_t
unsigned long intpte_t
Definition:
page.h:152
PAGE_MASK
#define PAGE_MASK
Definition:
page.h:12
pte_from_paddr
intpte_t pte_from_paddr(paddr_t paddr, uint64_t flags)
pte_from_gfn
intpte_t pte_from_gfn(unsigned long gfn, uint64_t flags)
pte_from_virt
intpte_t pte_from_virt(const void *va, uint64_t flags)
pte_to_paddr
paddr_t pte_to_paddr(intpte_t pte)
uint64_t
__UINT64_TYPE__ uint64_t
Definition:
stdint.h:17
Generated by
1.9.4