Changes in kernel/generic/src/mm/backend_anon.c [59fb782:c142860] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/backend_anon.c
r59fb782 rc142860 59 59 static void anon_destroy(as_area_t *); 60 60 61 static bool anon_is_resizable(as_area_t *);62 static bool anon_is_shareable(as_area_t *);63 64 61 static int anon_page_fault(as_area_t *, uintptr_t, pf_access_t); 65 62 static void anon_frame_free(as_area_t *, uintptr_t, uintptr_t); … … 71 68 .destroy = anon_destroy, 72 69 73 .is_resizable = anon_is_resizable,74 .is_shareable = anon_is_shareable,75 76 70 .page_fault = anon_page_fault, 77 71 .frame_free = anon_frame_free, … … 80 74 bool anon_create(as_area_t *area) 81 75 { 82 if (area->flags & AS_AREA_LATE_RESERVE)83 return true;84 85 76 return reserve_try_alloc(area->pages); 86 77 } … … 88 79 bool anon_resize(as_area_t *area, size_t new_pages) 89 80 { 90 if (area->flags & AS_AREA_LATE_RESERVE)91 return true;92 93 81 if (new_pages > area->pages) 94 82 return reserve_try_alloc(new_pages - area->pages); … … 112 100 ASSERT(mutex_locked(&area->as->lock)); 113 101 ASSERT(mutex_locked(&area->lock)); 114 ASSERT(!(area->flags & AS_AREA_LATE_RESERVE));115 102 116 103 /* … … 152 139 void anon_destroy(as_area_t *area) 153 140 { 154 if (area->flags & AS_AREA_LATE_RESERVE)155 return;156 157 141 reserve_free(area->pages); 158 142 } 159 143 160 bool anon_is_resizable(as_area_t *area)161 {162 return true;163 }164 165 bool anon_is_shareable(as_area_t *area)166 {167 return !(area->flags & AS_AREA_LATE_RESERVE);168 }169 144 170 145 /** Service a page fault in the anonymous memory address space area. … … 173 148 * 174 149 * @param area Pointer to the address space area. 175 * @param upage Faulting virtual page.150 * @param addr Faulting virtual address. 176 151 * @param access Access mode that caused the fault (i.e. read/write/exec). 177 152 * … … 179 154 * serviced). 180 155 */ 181 int anon_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access) 182 { 156 int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access) 157 { 158 uintptr_t upage = ALIGN_DOWN(addr, PAGE_SIZE); 183 159 uintptr_t kpage; 184 160 uintptr_t frame; … … 186 162 ASSERT(page_table_locked(AS)); 187 163 ASSERT(mutex_locked(&area->lock)); 188 ASSERT(IS_ALIGNED(upage, PAGE_SIZE));189 164 190 165 if (!as_area_check_access(area, access)) … … 250 225 * the different causes 251 226 */ 252 253 if (area->flags & AS_AREA_LATE_RESERVE) {254 /*255 * Reserve the memory for this page now.256 */257 if (!reserve_try_alloc(1))258 return AS_PF_SILENT;259 }260 261 227 kpage = km_temporary_page_get(&frame, FRAME_NO_RESERVE); 262 228 memsetb((void *) kpage, PAGE_SIZE, 0); … … 289 255 ASSERT(mutex_locked(&area->lock)); 290 256 291 if (area->flags & AS_AREA_LATE_RESERVE) { 292 /* 293 * In case of the late reserve areas, physical memory will not 294 * be unreserved when the area is destroyed so we need to use 295 * the normal unreserving frame_free(). 296 */ 297 frame_free(frame); 298 } else { 299 /* 300 * The reserve will be given back when the area is destroyed or 301 * resized, so use the frame_free_noreserve() which does not 302 * manipulate the reserve or it would be given back twice. 303 */ 304 frame_free_noreserve(frame); 305 } 257 frame_free_noreserve(frame); 306 258 } 307 259
Note:
See TracChangeset
for help on using the changeset viewer.