2 * \brief Virtual page-table facility
3 * \author Thomas Friebel <tf13@os.inf.tu-dresden.de>
4 * \author Christian Helmuth <ch12@os.inf.tu-dresden.de>
8 #ifndef _DDEKIT_PGTAB_H
9 #define _DDEKIT_PGTAB_H
11 #include <ddekit/ddekit.h>
13 #include <ddekit/types.h>
15 /* FIXME Region types may be defined by pgtab users. Do we really need them
17 enum ddekit_pgtab_type
19 PTE_TYPE_OTHER
, PTE_TYPE_LARGE
, PTE_TYPE_UMA
, PTE_TYPE_CONTIG
24 * Set virtual->physical mapping for VM region
26 * \param virt virtual start address for region
27 * \param phys physical start address for region
28 * \param pages number of pages in region
29 * \param type pgtab type for region
31 void ddekit_pgtab_set_region(void *virt
, ddekit_addr_t phys
, int pages
,
36 * Set virtual->physical mapping for VM region given a specific size in bytes.
38 * Internally, DDEKit manages regions with pages. However, DDEs do not need to tangle
39 * with the underlying mechanism and therefore can use this function that takes care
40 * of translating a size to an amount of pages.
42 void ddekit_pgtab_set_region_with_size(void *virt
, ddekit_addr_t phys
,
47 * Clear virtual->physical mapping for VM region
49 * \param virt virtual start address for region
50 * \param type pgtab type for region
52 void ddekit_pgtab_clear_region(void *virt
, int type
);
55 * Get physical address for virtual address
57 * \param virt virtual address
59 * \return physical address
61 ddekit_addr_t
ddekit_pgtab_get_physaddr(const void *virt
);
64 * Get virtual address for physical address
66 * \param physical physical address
68 * \return virtual address
70 ddekit_addr_t
ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical
);
73 * Get type of VM region.
75 * \param virt virtual address
77 * \return VM region type
79 int ddekit_pgtab_get_type(const void *virt
);
82 * Get size of VM region.
84 * \param virt virtual address
86 * \return VM region size (in bytes)
88 int ddekit_pgtab_get_size(const void *virt
);