From 82bcbfbe25df69652bc7cb3e5d66ae0886894488 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 21 Feb 2012 23:37:19 +0000 Subject: Clean up includes To use the standard hurd Makeconf rules and permit external dde_* build --- libddekit/ddekit/pgtab.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 libddekit/ddekit/pgtab.h (limited to 'libddekit/ddekit/pgtab.h') diff --git a/libddekit/ddekit/pgtab.h b/libddekit/ddekit/pgtab.h new file mode 100644 index 00000000..8964b713 --- /dev/null +++ b/libddekit/ddekit/pgtab.h @@ -0,0 +1,86 @@ +/* + * \brief Virtual page-table facility + * \author Thomas Friebel + * \author Christian Helmuth + * \date 2006-11-03 + */ + +#ifndef _ddekit_pgtab_h +#define _ddekit_pgtab_h + +#include "ddekit/types.h" + +/* FIXME Region types may be defined by pgtab users. Do we really need them + * here? */ +enum ddekit_pgtab_type +{ + PTE_TYPE_OTHER, PTE_TYPE_LARGE, PTE_TYPE_UMA, PTE_TYPE_CONTIG +}; + + +/** + * Set virtual->physical mapping for VM region + * + * \param virt virtual start address for region + * \param phys physical start address for region + * \param pages number of pages in region + * \param type pgtab type for region + */ +void ddekit_pgtab_set_region(void *virt, ddekit_addr_t phys, int pages, int type); + + +/** + * Set virtual->physical mapping for VM region given a specific size in bytes. + * + * Internally, DDEKit manages regions with pages. However, DDEs do not need to tangle + * with the underlying mechanism and therefore can use this function that takes care + * of translating a size to an amount of pages. + */ +void ddekit_pgtab_set_region_with_size(void *virt, ddekit_addr_t phys, int size, int type); + + +/** + * Clear virtual->physical mapping for VM region + * + * \param virt virtual start address for region + * \param type pgtab type for region + */ +void ddekit_pgtab_clear_region(void *virt, int type); + +/** + * Get physical address for virtual address + * + * \param virt virtual address + * + * \return physical address + */ +ddekit_addr_t ddekit_pgtab_get_physaddr(const void *virt); + +/** + * Get virtual address for physical address + * + * \param physical physical address + * + * \return virtual address + */ +ddekit_addr_t ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical); + +/** + * Get type of VM region. + * + * \param virt virtual address + + * \return VM region type + */ +int ddekit_pgtab_get_type(const void *virt); + +/** + * Get size of VM region. + * + * \param virt virtual address + * + * \return VM region size (in bytes) + */ +int ddekit_pgtab_get_size(const void *virt); + +#endif -- cgit v1.2.3