Rev 1425 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1425 | Rev 1539 | ||
|---|---|---|---|
| Line 62... | Line 62... | ||
| 62 | * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e. serviced). |
62 | * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e. serviced). |
| 63 | */ |
63 | */ |
| 64 | int phys_page_fault(as_area_t *area, __address addr, pf_access_t access) |
64 | int phys_page_fault(as_area_t *area, __address addr, pf_access_t access) |
| 65 | { |
65 | { |
| 66 | __address base = area->backend_data.base; |
66 | __address base = area->backend_data.base; |
| 67 | count_t frames = area->backend_data.frames; |
- | |
| 68 | 67 | ||
| 69 | if (!as_area_check_access(area, access)) |
68 | if (!as_area_check_access(area, access)) |
| 70 | return AS_PF_FAULT; |
69 | return AS_PF_FAULT; |
| 71 | 70 | ||
| 72 | ASSERT(addr - area->base < frames * FRAME_SIZE); |
71 | ASSERT(addr - area->base < area->backend_data.frames * FRAME_SIZE); |
| 73 | page_mapping_insert(AS, addr, base + (addr - area->base), as_area_get_flags(area)); |
72 | page_mapping_insert(AS, addr, base + (addr - area->base), as_area_get_flags(area)); |
| 74 | if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1)) |
73 | if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1)) |
| 75 | panic("Could not insert used space.\n"); |
74 | panic("Could not insert used space.\n"); |
| 76 | 75 | ||
| 77 | return AS_PF_OK; |
76 | return AS_PF_OK; |