Rev 599 | Rev 618 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 599 | Rev 612 | ||
---|---|---|---|
Line 66... | Line 66... | ||
66 | 66 | ||
67 | for (i = 0; i < TLB_ENTRY_COUNT; i++) { |
67 | for (i = 0; i < TLB_ENTRY_COUNT; i++) { |
68 | cp0_index_write(i); |
68 | cp0_index_write(i); |
69 | tlbwi(); |
69 | tlbwi(); |
70 | } |
70 | } |
- | 71 | ||
71 | 72 | ||
72 | /* |
73 | /* |
73 | * The kernel is going to make use of some wired |
74 | * The kernel is going to make use of some wired |
74 | * entries (e.g. mapping kernel stacks in kseg3). |
75 | * entries (e.g. mapping kernel stacks in kseg3). |
75 | */ |
76 | */ |
Line 115... | Line 116... | ||
115 | } |
116 | } |
116 | else { |
117 | else { |
117 | cp0_entry_lo0_write(0); |
118 | cp0_entry_lo0_write(0); |
118 | cp0_entry_lo1_write(lo.value); |
119 | cp0_entry_lo1_write(lo.value); |
119 | } |
120 | } |
- | 121 | cp0_pagemask_write(TLB_PAGE_MASK_16K); |
|
120 | tlbwr(); |
122 | tlbwr(); |
121 | 123 | ||
122 | spinlock_unlock(&VM->lock); |
124 | spinlock_unlock(&VM->lock); |
123 | return; |
125 | return; |
124 | 126 | ||
Line 183... | Line 185... | ||
183 | */ |
185 | */ |
184 | if ((badvaddr/PAGE_SIZE) % 2 == 0) |
186 | if ((badvaddr/PAGE_SIZE) % 2 == 0) |
185 | cp0_entry_lo0_write(lo.value); |
187 | cp0_entry_lo0_write(lo.value); |
186 | else |
188 | else |
187 | cp0_entry_lo1_write(lo.value); |
189 | cp0_entry_lo1_write(lo.value); |
- | 190 | cp0_pagemask_write(TLB_PAGE_MASK_16K); |
|
188 | tlbwi(); |
191 | tlbwi(); |
189 | 192 | ||
190 | spinlock_unlock(&VM->lock); |
193 | spinlock_unlock(&VM->lock); |
191 | return; |
194 | return; |
192 | 195 | ||
Line 258... | Line 261... | ||
258 | */ |
261 | */ |
259 | if ((badvaddr/PAGE_SIZE) % 2 == 0) |
262 | if ((badvaddr/PAGE_SIZE) % 2 == 0) |
260 | cp0_entry_lo0_write(lo.value); |
263 | cp0_entry_lo0_write(lo.value); |
261 | else |
264 | else |
262 | cp0_entry_lo1_write(lo.value); |
265 | cp0_entry_lo1_write(lo.value); |
- | 266 | cp0_pagemask_write(TLB_PAGE_MASK_16K); |
|
263 | tlbwi(); |
267 | tlbwi(); |
264 | 268 | ||
265 | spinlock_unlock(&VM->lock); |
269 | spinlock_unlock(&VM->lock); |
266 | return; |
270 | return; |
267 | 271 | ||
Line 366... | Line 370... | ||
366 | } |
370 | } |
367 | 371 | ||
368 | /** Print contents of TLB. */ |
372 | /** Print contents of TLB. */ |
369 | void tlb_print(void) |
373 | void tlb_print(void) |
370 | { |
374 | { |
- | 375 | page_mask_t mask; |
|
371 | entry_lo_t lo0, lo1; |
376 | entry_lo_t lo0, lo1; |
372 | entry_hi_t hi; |
377 | entry_hi_t hi; |
373 | int i; |
378 | int i; |
374 | 379 | ||
375 | printf("TLB:\n"); |
380 | printf("TLB:\n"); |
376 | for (i = 0; i < TLB_ENTRY_COUNT; i++) { |
381 | for (i = 0; i < TLB_ENTRY_COUNT; i++) { |
377 | cp0_index_write(i); |
382 | cp0_index_write(i); |
378 | tlbr(); |
383 | tlbr(); |
379 | 384 | ||
- | 385 | mask.value = cp0_pagemask_read(); |
|
380 | hi.value = cp0_entry_hi_read(); |
386 | hi.value = cp0_entry_hi_read(); |
381 | lo0.value = cp0_entry_lo0_read(); |
387 | lo0.value = cp0_entry_lo0_read(); |
382 | lo1.value = cp0_entry_lo1_read(); |
388 | lo1.value = cp0_entry_lo1_read(); |
383 | 389 | ||
384 | printf("%d: asid=%d, vpn2=%d\tg[0]=%d, v[0]=%d, d[0]=%d, c[0]=%B, pfn[0]=%d\n" |
390 | printf("%d: asid=%d, vpn2=%d, mask=%d\tg[0]=%d, v[0]=%d, d[0]=%d, c[0]=%B, pfn[0]=%d\n" |
385 | "\t\t\tg[1]=%d, v[1]=%d, d[1]=%d, c[1]=%B, pfn[1]=%d\n", |
391 | "\t\t\t\tg[1]=%d, v[1]=%d, d[1]=%d, c[1]=%B, pfn[1]=%d\n", |
386 | i, hi.asid, hi.vpn2, lo0.g, lo0.v, lo0.d, lo0.c, lo0.pfn, |
392 | i, hi.asid, hi.vpn2, mask.mask, lo0.g, lo0.v, lo0.d, lo0.c, lo0.pfn, |
387 | lo1.g, lo1.v, lo1.d, lo1.c, lo1.pfn); |
393 | lo1.g, lo1.v, lo1.d, lo1.c, lo1.pfn); |
388 | } |
394 | } |
389 | } |
395 | } |
390 | 396 | ||
391 | /** Invalidate all TLB entries. */ |
397 | /** Invalidate all TLB entries. */ |