78,6 → 78,7 |
int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access) |
{ |
uintptr_t frame; |
bool dirty = false; |
|
if (!as_area_check_access(area, access)) |
return AS_PF_FAULT; |
113,6 → 114,7 |
if (allocate) { |
frame = (uintptr_t) frame_alloc(ONE_FRAME, 0); |
memsetb(PA2KA(frame), FRAME_SIZE, 0); |
dirty = true; |
|
/* |
* Insert the address of the newly allocated |
143,6 → 145,7 |
*/ |
frame = (uintptr_t) frame_alloc(ONE_FRAME, 0); |
memsetb(PA2KA(frame), FRAME_SIZE, 0); |
dirty = true; |
} |
|
/* |
154,6 → 157,21 |
if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1)) |
panic("Could not insert used space.\n"); |
|
#ifdef CONFIG_VIRT_IDX_DCACHE |
if (dirty && PAGE_COLOR(PA2KA(frame)) != PAGE_COLOR(addr)) { |
/* |
* By writing to the frame using kernel virtual address, |
* we have created an illegal virtual alias. We now have to |
* invalidate cachelines belonging to addr on all processors |
* so that they will be reloaded with the new content on next |
* read. |
*/ |
dcache_flush_frame(addr, frame); |
dcache_shootdown_start(DCACHE_INVL_FRAME, PAGE_COLOR(addr), frame); |
dcache_shootdown_finalize(); |
} |
#endif |
|
return AS_PF_OK; |
} |
|
168,9 → 186,6 |
void anon_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame) |
{ |
frame_free(frame); |
#ifdef CONFIG_VIRT_IDX_DCACHE |
dcache_flush_frame(page, frame); |
#endif |
} |
|
/** Share the anonymous address space area. |