Subversion Repositories HelenOS-historic

Rev

Rev 814 | Rev 832 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 814 Rev 826
Line 36... Line 36...
36
#include <typedefs.h>
36
#include <typedefs.h>
37
#include <arch/asm.h>
37
#include <arch/asm.h>
38
#include <memstr.h>
38
#include <memstr.h>
39
 
39
 
40
static void pt_mapping_insert(as_t *as, __address page, __address frame, int flags);
40
static void pt_mapping_insert(as_t *as, __address page, __address frame, int flags);
-
 
41
static void pt_mapping_remove(as_t *as, __address page);
41
static pte_t *pt_mapping_find(as_t *as, __address page);
42
static pte_t *pt_mapping_find(as_t *as, __address page);
42
 
43
 
43
page_mapping_operations_t pt_mapping_operations = {
44
page_mapping_operations_t pt_mapping_operations = {
44
    .mapping_insert = pt_mapping_insert,
45
    .mapping_insert = pt_mapping_insert,
-
 
46
    .mapping_remove = pt_mapping_remove,
45
    .mapping_find = pt_mapping_find
47
    .mapping_find = pt_mapping_find
46
};
48
};
47
 
49
 
48
/** Map page to frame using hierarchical page tables.
50
/** Map page to frame using hierarchical page tables.
49
 *
51
 *
Line 93... Line 95...
93
 
95
 
94
    SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame);
96
    SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame);
95
    SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags);
97
    SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags);
96
}
98
}
97
 
99
 
-
 
100
/** Remove mapping of page from hierarchical page tables.
-
 
101
 *
-
 
102
 * Remove any mapping of 'page' within address space 'as'.
-
 
103
 * TLB shootdown should follow in order to make effects of
-
 
104
 * this call visible.
-
 
105
 *
-
 
106
 * The address space must be locked and interrupts must be disabled.
-
 
107
 *
-
 
108
 * @param as Address space to wich page belongs.
-
 
109
 * @param page Virtual address of the page to be demapped.
-
 
110
 */
-
 
111
void pt_mapping_remove(as_t *as, __address page)
-
 
112
{
-
 
113
    pte_t *ptl0, *ptl1, *ptl2, *ptl3;
-
 
114
 
-
 
115
    ptl0 = (pte_t *) PA2KA((__address) as->page_table);
-
 
116
 
-
 
117
    if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
-
 
118
        return;
-
 
119
 
-
 
120
    ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
-
 
121
 
-
 
122
    if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
-
 
123
        return;
-
 
124
 
-
 
125
    ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
-
 
126
 
-
 
127
    if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
-
 
128
        return;
-
 
129
 
-
 
130
    ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
-
 
131
 
-
 
132
    /* Destroy the mapping. Setting to PAGE_NOT_PRESENT is not sufficient. */
-
 
133
    memsetb((__address) &ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0);
-
 
134
}
-
 
135
 
98
/** Find mapping for virtual page in hierarchical page tables.
136
/** Find mapping for virtual page in hierarchical page tables.
99
 *
137
 *
100
 * Find mapping for virtual page.
138
 * Find mapping for virtual page.
101
 *
139
 *
102
 * The address space must be locked and interrupts must be disabled.
140
 * The address space must be locked and interrupts must be disabled.