Changeset 8c5e6c7 in mainline
- Timestamp:
- 2005-10-07T23:19:56Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cad5ce8
- Parents:
- 92e5431
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/include/mm/tlb.h
r92e5431 r8c5e6c7 49 49 unsigned c : 3; /* cache coherency attribute */ 50 50 unsigned pfn : 24; /* frame number */ 51 unsigned zero: 2;/* zero */51 unsigned : 2; /* zero */ 52 52 } __attribute__ ((packed)); 53 53 __u32 value; -
arch/mips32/src/mm/tlb.c
r92e5431 r8c5e6c7 45 45 46 46 static pte_t *find_mapping_and_check(__address badvaddr); 47 47 48 static void prepare_entry_lo(entry_lo_t *lo, bool g, bool v, bool d, int c, __address pfn); 49 static void prepare_entry_hi(entry_hi_t *hi, asid_t asid, __address addr); 48 50 49 51 /** Initialize TLB … … 85 87 { 86 88 entry_lo_t lo; 89 entry_hi_t hi; 87 90 __address badvaddr; 88 91 pte_t *pte; 89 92 90 // debug91 entry_hi_t hi;92 93 93 badvaddr = cp0_badvaddr_read(); 94 94 95 // debug96 hi.value = cp0_entry_hi_read();97 printf("TLB Refill: hi.vnp2=%X\n", hi.vpn2);98 99 95 spinlock_lock(&VM->lock); 96 100 97 pte = find_mapping_and_check(badvaddr); 101 98 if (!pte) … … 107 104 pte->a = 1; 108 105 106 prepare_entry_hi(&hi, VM->asid, badvaddr); 109 107 prepare_entry_lo(&lo, pte->g, pte->v, pte->d, pte->c, pte->pfn); 110 108 … … 112 110 * New entry is to be inserted into TLB 113 111 */ 112 cp0_entry_hi_write(hi.value); 114 113 if ((badvaddr/PAGE_SIZE) % 2 == 0) { 115 114 cp0_entry_lo0_write(lo.value); … … 141 140 __address badvaddr; 142 141 entry_lo_t lo; 142 entry_hi_t hi; 143 143 pte_t *pte; 144 144 … … 148 148 * Locate the faulting entry in TLB. 149 149 */ 150 hi.value = cp0_entry_hi_read(); 151 prepare_entry_hi(&hi, hi.asid, badvaddr); 152 cp0_entry_hi_write(hi.value); 150 153 tlbp(); 151 154 index.value = cp0_index_read(); … … 205 208 __address badvaddr; 206 209 entry_lo_t lo; 210 entry_hi_t hi; 207 211 pte_t *pte; 208 212 … … 212 216 * Locate the faulting entry in TLB. 213 217 */ 218 hi.value = cp0_entry_hi_read(); 219 prepare_entry_hi(&hi, hi.asid, badvaddr); 220 cp0_entry_hi_write(hi.value); 214 221 tlbp(); 215 222 index.value = cp0_index_read(); … … 379 386 void prepare_entry_lo(entry_lo_t *lo, bool g, bool v, bool d, int c, __address pfn) 380 387 { 388 lo->value = 0; 381 389 lo->g = g; 382 390 lo->v = v; … … 384 392 lo->c = c; 385 393 lo->pfn = pfn; 386 lo->zero = 0; 387 } 394 } 395 396 void prepare_entry_hi(entry_hi_t *hi, asid_t asid, __address addr) 397 { 398 hi->value = (((addr/PAGE_SIZE)/2)*PAGE_SIZE*2); 399 hi->asid = asid; 400 } -
test/mm/mapping1/test.c
r92e5431 r8c5e6c7 49 49 frame0 = frame_alloc(FRAME_KA); 50 50 frame1 = frame_alloc(FRAME_KA); 51 51 52 printf("Writing %L to physical address %P.\n", VALUE0, KA2PA(frame0)); 52 53 *((__u32 *) frame0) = VALUE0; 54 printf("Writing %L to physical address %P.\n", VALUE1, KA2PA(frame1)); 53 55 *((__u32 *) frame1) = VALUE1; 54 56 55 printf("Mapping %P to%P.\n", PAGE0, KA2PA(frame0));56 map_page_to_frame(PAGE0, KA2PA(frame0), PAGE_PRESENT , 0);57 printf("Mapping %P to%P.\n", PAGE1, KA2PA(frame1));58 map_page_to_frame(PAGE1, KA2PA(frame1), PAGE_PRESENT , 0);57 printf("Mapping virtual address %P to physical address %P.\n", PAGE0, KA2PA(frame0)); 58 map_page_to_frame(PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE, 0); 59 printf("Mapping virtual address %P to physical address %P.\n", PAGE1, KA2PA(frame1)); 60 map_page_to_frame(PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE, 0); 59 61 60 printf("Value at %P is %L.\n", PAGE0, v0 = *((__u32 *) PAGE0));61 printf("Value at %P is %L.\n", PAGE1, v1 = *((__u32 *) PAGE1));62 printf("Value at virtual address %P is %L.\n", PAGE0, v0 = *((__u32 *) PAGE0)); 63 printf("Value at virtual address %P is %L.\n", PAGE1, v1 = *((__u32 *) PAGE1)); 62 64 63 65 ASSERT(v0 == VALUE0); 64 66 ASSERT(v1 == VALUE1); 65 67 66 printf("Writing 0 to %P.\n", PAGE0);68 printf("Writing %X to virtual address %P.\n", 0, PAGE0); 67 69 *((__u32 *) PAGE0) = 0; 68 printf("Writing 0 to %P.\n", PAGE1);70 printf("Writing %X to virtual address %P.\n", 0, PAGE1); 69 71 *((__u32 *) PAGE1) = 0; 70 72 71 printf("Value at %P is %L.\n", PAGE0, v0 = *((__u32 *) PAGE0));72 printf("Value at %P is %L.\n", PAGE1, v1 = *((__u32 *) PAGE1));73 printf("Value at virtual address %P is %X.\n", PAGE0, v0 = *((__u32 *) PAGE0)); 74 printf("Value at virtual address %P is %X.\n", PAGE1, v1 = *((__u32 *) PAGE1)); 73 75 74 76 ASSERT(v0 == 0);
Note:
See TracChangeset
for help on using the changeset viewer.