Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / ddekit / pgtab.h @ 13

History | View | Annotate | Download (2.06 KB)

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
 */
7

    
8
#ifndef _DDEKIT_PGTAB_H
9
#define _DDEKIT_PGTAB_H
10

    
11
#include <ddekit/ddekit.h>
12

    
13
#include <ddekit/types.h>
14

    
15
/* FIXME Region types may be defined by pgtab users. Do we really need them
16
 * here? */
17
enum ddekit_pgtab_type
18
{
19
        PTE_TYPE_OTHER, PTE_TYPE_LARGE, PTE_TYPE_UMA, PTE_TYPE_CONTIG
20
};
21

    
22

    
23
/**
24
 * Set virtual->physical mapping for VM region
25
 *
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
30
 */
31
void ddekit_pgtab_set_region(void *virt, ddekit_addr_t phys, int pages,
32
        int type);
33

    
34

    
35
/**
36
 * Set virtual->physical mapping for VM region given a specific size in bytes.
37
 *
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.
41
 */
42
void ddekit_pgtab_set_region_with_size(void *virt, ddekit_addr_t phys,
43
        int size, int type);
44

    
45

    
46
/**
47
 * Clear virtual->physical mapping for VM region
48
 *
49
 * \param virt      virtual start address for region
50
 * \param type      pgtab type for region
51
 */
52
void ddekit_pgtab_clear_region(void *virt, int type);
53

    
54
/**
55
 * Get physical address for virtual address
56
 *
57
 * \param virt     virtual address
58
 *
59
 * \return physical address
60
 */
61
ddekit_addr_t ddekit_pgtab_get_physaddr(const void *virt);
62

    
63
/**
64
 * Get virtual address for physical address
65
 *
66
 * \param physical  physical address
67
 *
68
 * \return virtual address
69
 */
70
ddekit_addr_t ddekit_pgtab_get_virtaddr(const ddekit_addr_t physical);
71

    
72
/**
73
 * Get type of VM region.
74
 *
75
 * \param virt      virtual address
76

77
 * \return VM region type
78
 */
79
int ddekit_pgtab_get_type(const void *virt);
80

    
81
/**
82
 * Get size of VM region.
83
 *
84
 * \param virt      virtual address
85
 *
86
 * \return VM region size (in bytes)
87
 */
88
int ddekit_pgtab_get_size(const void *virt);
89

    
90
#endif