opendir change: refinement
[minix.git] / include / ddekit / pgtab.h
blobe0de23dea96926c3b9451028115782d5c2417a18
1 /*
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>
5 * \date 2006-11-03
6 */
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
16 * here? */
17 enum ddekit_pgtab_type
19 PTE_TYPE_OTHER, PTE_TYPE_LARGE, PTE_TYPE_UMA, PTE_TYPE_CONTIG
23 /**
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,
32 int type);
35 /**
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,
43 int size, int type);
46 /**
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);
54 /**
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);
63 /**
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);
72 /**
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);
81 /**
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);
90 #endif