Rev 3827 | Rev 3833 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3827 | Rev 3830 | ||
|---|---|---|---|
| Line 64... | Line 64... | ||
| 64 | { |
64 | { |
| 65 | /* |
65 | /* |
| 66 | * Check if the mapping exists in page tables. |
66 | * Check if the mapping exists in page tables. |
| 67 | */ |
67 | */ |
| 68 | pte_t *pte = page_mapping_find(as, badvaddr); |
68 | pte_t *pte = page_mapping_find(as, badvaddr); |
| 69 | if ((pte) && (pte->p)) { |
69 | if ((pte) && (pte->present)) { |
| 70 | /* |
70 | /* |
| 71 | * Mapping found in page tables. |
71 | * Mapping found in page tables. |
| 72 | * Immediately succeed. |
72 | * Immediately succeed. |
| 73 | */ |
73 | */ |
| 74 | return pte; |
74 | return pte; |
| Line 86... | Line 86... | ||
| 86 | * The higher-level page fault handler succeeded, |
86 | * The higher-level page fault handler succeeded, |
| 87 | * The mapping ought to be in place. |
87 | * The mapping ought to be in place. |
| 88 | */ |
88 | */ |
| 89 | page_table_lock(as, lock); |
89 | page_table_lock(as, lock); |
| 90 | pte = page_mapping_find(as, badvaddr); |
90 | pte = page_mapping_find(as, badvaddr); |
| 91 | ASSERT((pte) && (pte->p)); |
91 | ASSERT((pte) && (pte->present)); |
| 92 | *pfrc = 0; |
92 | *pfrc = 0; |
| 93 | return pte; |
93 | return pte; |
| 94 | case AS_PF_DEFER: |
94 | case AS_PF_DEFER: |
| 95 | page_table_lock(as, lock); |
95 | page_table_lock(as, lock); |
| 96 | *pfrc = rc; |
96 | *pfrc = rc; |
| Line 124... | Line 124... | ||
| 124 | panic("%p: PHT Refill Exception at %p (%s<-%s).", badvaddr, |
124 | panic("%p: PHT Refill Exception at %p (%s<-%s).", badvaddr, |
| 125 | istate->pc, symbol, sym2); |
125 | istate->pc, symbol, sym2); |
| 126 | } |
126 | } |
| 127 | 127 | ||
| 128 | 128 | ||
| 129 | static void pht_insert(const uintptr_t vaddr, const pfn_t pfn) |
129 | static void pht_insert(const uintptr_t vaddr, const pte_t *pte) |
| 130 | { |
130 | { |
| 131 | uint32_t page = (vaddr >> 12) & 0xffff; |
131 | uint32_t page = (vaddr >> 12) & 0xffff; |
| 132 | uint32_t api = (vaddr >> 22) & 0x3f; |
132 | uint32_t api = (vaddr >> 22) & 0x3f; |
| 133 | 133 | ||
| 134 | uint32_t vsid; |
134 | uint32_t vsid; |
| Line 187... | Line 187... | ||
| 187 | 187 | ||
| 188 | phte[base + i].v = 1; |
188 | phte[base + i].v = 1; |
| 189 | phte[base + i].vsid = vsid; |
189 | phte[base + i].vsid = vsid; |
| 190 | phte[base + i].h = h; |
190 | phte[base + i].h = h; |
| 191 | phte[base + i].api = api; |
191 | phte[base + i].api = api; |
| 192 | phte[base + i].rpn = pfn; |
192 | phte[base + i].rpn = pte->pfn; |
| 193 | phte[base + i].r = 0; |
193 | phte[base + i].r = 0; |
| 194 | phte[base + i].c = 0; |
194 | phte[base + i].c = 0; |
| - | 195 | phte[base + i].wimg = (pte->page_cache_disable ? WIMG_NO_CACHE : 0); |
|
| 195 | phte[base + i].pp = 2; // FIXME |
196 | phte[base + i].pp = 2; // FIXME |
| 196 | } |
197 | } |
| 197 | 198 | ||
| 198 | 199 | ||
| 199 | static void pht_real_insert(const uintptr_t vaddr, const pfn_t pfn) |
200 | static void pht_real_insert(const uintptr_t vaddr, const pfn_t pfn) |
| Line 261... | Line 262... | ||
| 261 | phte_physical[base + i].h = h; |
262 | phte_physical[base + i].h = h; |
| 262 | phte_physical[base + i].api = api; |
263 | phte_physical[base + i].api = api; |
| 263 | phte_physical[base + i].rpn = pfn; |
264 | phte_physical[base + i].rpn = pfn; |
| 264 | phte_physical[base + i].r = 0; |
265 | phte_physical[base + i].r = 0; |
| 265 | phte_physical[base + i].c = 0; |
266 | phte_physical[base + i].c = 0; |
| - | 267 | phte_physical[base + i].wimg = 0; |
|
| 266 | phte_physical[base + i].pp = 2; // FIXME |
268 | phte_physical[base + i].pp = 2; // FIXME |
| 267 | } |
269 | } |
| 268 | 270 | ||
| 269 | 271 | ||
| 270 | /** Process Instruction/Data Storage Interrupt |
272 | /** Process Instruction/Data Storage Interrupt |
| Line 316... | Line 318... | ||
| 316 | default: |
318 | default: |
| 317 | panic("Unexpected pfrc (%d).", pfrc); |
319 | panic("Unexpected pfrc (%d).", pfrc); |
| 318 | } |
320 | } |
| 319 | } |
321 | } |
| 320 | 322 | ||
| 321 | pte->a = 1; /* Record access to PTE */ |
323 | pte->accessed = 1; /* Record access to PTE */ |
| 322 | pht_insert(badvaddr, pte->pfn); |
324 | pht_insert(badvaddr, pte); |
| 323 | 325 | ||
| 324 | page_table_unlock(as, lock); |
326 | page_table_unlock(as, lock); |
| 325 | return; |
327 | return; |
| 326 | 328 | ||
| 327 | fail: |
329 | fail: |