Changeset 2057572 in mainline for kernel/arch/sparc64/src/mm/tsb.c
- Timestamp:
- 2007-03-27T23:40:25Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 399ece9
- Parents:
- 8d37a06
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/mm/tsb.c
r8d37a06 r2057572 35 35 #include <arch/mm/tsb.h> 36 36 #include <arch/mm/tlb.h> 37 #include <arch/mm/page.h> 37 38 #include <arch/barrier.h> 38 39 #include <mm/as.h> … … 41 42 #include <debug.h> 42 43 43 #define TSB_INDEX_MASK ((1 << (21 + 1 + TSB_SIZE -PAGE_WIDTH)) - 1)44 #define TSB_INDEX_MASK ((1 << (21 + 1 + TSB_SIZE - MMU_PAGE_WIDTH)) - 1) 44 45 45 46 /** Invalidate portion of TSB. … … 60 61 ASSERT(as->arch.itsb && as->arch.dtsb); 61 62 62 i0 = (page >> PAGE_WIDTH) & TSB_INDEX_MASK;63 cnt = min(pages , ITSB_ENTRY_COUNT);63 i0 = (page >> MMU_PAGE_WIDTH) & TSB_INDEX_MASK; 64 cnt = min(pages * MMU_PAGES_PER_PAGE, ITSB_ENTRY_COUNT); 64 65 65 66 for (i = 0; i < cnt; i++) { 66 67 as->arch.itsb[(i0 + i) & (ITSB_ENTRY_COUNT - 1)].tag.invalid = 67 68 true; 68 69 as->arch.dtsb[(i0 + i) & (DTSB_ENTRY_COUNT - 1)].tag.invalid = 69 70 true; 70 71 } 71 72 } … … 73 74 /** Copy software PTE to ITSB. 74 75 * 75 * @param t Software PTE. 76 * @param t Software PTE. 77 * @param index Zero if lower 8K-subpage, one if higher 8K subpage. 76 78 */ 77 void itsb_pte_copy(pte_t *t )79 void itsb_pte_copy(pte_t *t, index_t index) 78 80 { 79 81 as_t *as; 80 82 tsb_entry_t *tsb; 83 index_t entry; 81 84 82 85 as = t->as; 83 tsb = &as->arch.itsb[(t->page >> PAGE_WIDTH) & TSB_INDEX_MASK]; 86 entry = ((t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK; 87 tsb = &as->arch.itsb[entry]; 84 88 85 89 /* … … 96 100 97 101 tsb->tag.context = as->asid; 98 tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT; 102 tsb->tag.va_tag = (t->page + (index << MMU_PAGE_WIDTH)) >> 103 VA_TAG_PAGE_SHIFT; 99 104 tsb->data.value = 0; 100 105 tsb->data.size = PAGESIZE_8K; 101 tsb->data.pfn = t->frame >> FRAME_WIDTH;106 tsb->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index; 102 107 tsb->data.cp = t->c; 103 108 tsb->data.p = t->k; /* p as privileged */ … … 111 116 /** Copy software PTE to DTSB. 112 117 * 113 * @param t Software PTE. 114 * @param ro If true, the mapping is copied read-only. 118 * @param t Software PTE. 119 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage. 120 * @param ro If true, the mapping is copied read-only. 115 121 */ 116 void dtsb_pte_copy(pte_t *t, bool ro)122 void dtsb_pte_copy(pte_t *t, index_t index, bool ro) 117 123 { 118 124 as_t *as; 119 125 tsb_entry_t *tsb; 126 index_t entry; 120 127 121 128 as = t->as; 122 tsb = &as->arch.dtsb[(t->page >> PAGE_WIDTH) & TSB_INDEX_MASK]; 129 entry = ((t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK; 130 tsb = &as->arch.dtsb[entry]; 123 131 124 132 /* … … 135 143 136 144 tsb->tag.context = as->asid; 137 tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT; 145 tsb->tag.va_tag = (t->page + (index << MMU_PAGE_WIDTH)) >> 146 VA_TAG_PAGE_SHIFT; 138 147 tsb->data.value = 0; 139 148 tsb->data.size = PAGESIZE_8K; 140 tsb->data.pfn = t->frame >> FRAME_WIDTH;149 tsb->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index; 141 150 tsb->data.cp = t->c; 142 151 #ifdef CONFIG_VIRT_IDX_DCACHE
Note:
See TracChangeset
for help on using the changeset viewer.