Rev 1398 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1398 | Rev 1411 | ||
|---|---|---|---|
| Line 51... | Line 51... | ||
| 51 | * if lock is true. |
51 | * if lock is true. |
| 52 | * |
52 | * |
| 53 | * @param as Address space. |
53 | * @param as Address space. |
| 54 | * @param lock Lock/unlock the address space. |
54 | * @param lock Lock/unlock the address space. |
| 55 | * @param badvaddr Faulting virtual address. |
55 | * @param badvaddr Faulting virtual address. |
| - | 56 | * @param access Access mode that caused the fault. |
|
| 56 | * @param istate Pointer to interrupted state. |
57 | * @param istate Pointer to interrupted state. |
| 57 | * @param pfrc Pointer to variable where as_page_fault() return code will be stored. |
58 | * @param pfrc Pointer to variable where as_page_fault() return code will be stored. |
| 58 | * @return PTE on success, NULL otherwise. |
59 | * @return PTE on success, NULL otherwise. |
| 59 | * |
60 | * |
| 60 | */ |
61 | */ |
| 61 | static pte_t *find_mapping_and_check(as_t *as, bool lock, __address badvaddr, istate_t *istate, int *pfcr) |
62 | static pte_t *find_mapping_and_check(as_t *as, bool lock, __address badvaddr, int access, |
| - | 63 | istate_t *istate, int *pfcr) |
|
| 62 | { |
64 | { |
| 63 | /* |
65 | /* |
| 64 | * Check if the mapping exists in page tables. |
66 | * Check if the mapping exists in page tables. |
| 65 | */ |
67 | */ |
| 66 | pte_t *pte = page_mapping_find(as, badvaddr); |
68 | pte_t *pte = page_mapping_find(as, badvaddr); |
| Line 76... | Line 78... | ||
| 76 | /* |
78 | /* |
| 77 | * Mapping not found in page tables. |
79 | * Mapping not found in page tables. |
| 78 | * Resort to higher-level page fault handler. |
80 | * Resort to higher-level page fault handler. |
| 79 | */ |
81 | */ |
| 80 | page_table_unlock(as, lock); |
82 | page_table_unlock(as, lock); |
| 81 | switch (rc = as_page_fault(badvaddr, istate)) { |
83 | switch (rc = as_page_fault(badvaddr, access, istate)) { |
| 82 | case AS_PF_OK: |
84 | case AS_PF_OK: |
| 83 | /* |
85 | /* |
| 84 | * The higher-level page fault handler succeeded, |
86 | * The higher-level page fault handler succeeded, |
| 85 | * The mapping ought to be in place. |
87 | * The mapping ought to be in place. |
| 86 | */ |
88 | */ |
| Line 209... | Line 211... | ||
| 209 | } else |
211 | } else |
| 210 | badvaddr = istate->pc; |
212 | badvaddr = istate->pc; |
| 211 | 213 | ||
| 212 | page_table_lock(as, lock); |
214 | page_table_lock(as, lock); |
| 213 | 215 | ||
| 214 | pte = find_mapping_and_check(as, lock, badvaddr, istate, &pfcr); |
216 | pte = find_mapping_and_check(as, lock, badvaddr, PF_ACCESS_READ /* FIXME */, istate, &pfcr); |
| 215 | if (!pte) { |
217 | if (!pte) { |
| 216 | switch (pfcr) { |
218 | switch (pfcr) { |
| 217 | case AS_PF_FAULT: |
219 | case AS_PF_FAULT: |
| 218 | goto fail; |
220 | goto fail; |
| 219 | break; |
221 | break; |