Changeset 454f1da in mainline for kernel/generic/src/mm
- Timestamp:
- 2007-03-26T19:35:28Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d7daff
- Parents:
- 4638401
- Location:
- kernel/generic/src/mm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/backend_anon.c
r4638401 r454f1da 79 79 { 80 80 uintptr_t frame; 81 bool dirty = false; 81 82 82 83 if (!as_area_check_access(area, access)) … … 95 96 mutex_lock(&area->sh_info->lock); 96 97 frame = (uintptr_t) btree_search(&area->sh_info->pagemap, 97 98 ALIGN_DOWN(addr, PAGE_SIZE) - area->base, &leaf); 98 99 if (!frame) { 99 100 bool allocate = true; … … 114 115 frame = (uintptr_t) frame_alloc(ONE_FRAME, 0); 115 116 memsetb(PA2KA(frame), FRAME_SIZE, 0); 117 dirty = true; 116 118 117 119 /* … … 144 146 frame = (uintptr_t) frame_alloc(ONE_FRAME, 0); 145 147 memsetb(PA2KA(frame), FRAME_SIZE, 0); 148 dirty = true; 146 149 } 147 150 … … 155 158 panic("Could not insert used space.\n"); 156 159 160 #ifdef CONFIG_VIRT_IDX_DCACHE 161 if (dirty && PAGE_COLOR(PA2KA(frame)) != PAGE_COLOR(addr)) { 162 /* 163 * By writing to the frame using kernel virtual address, 164 * we have created an illegal virtual alias. We now have to 165 * invalidate cachelines belonging to addr on all processors 166 * so that they will be reloaded with the new content on next 167 * read. 168 */ 169 dcache_flush_frame(addr, frame); 170 dcache_shootdown_start(DCACHE_INVL_FRAME, PAGE_COLOR(addr), frame); 171 dcache_shootdown_finalize(); 172 } 173 #endif 174 157 175 return AS_PF_OK; 158 176 } … … 169 187 { 170 188 frame_free(frame); 171 #ifdef CONFIG_VIRT_IDX_DCACHE172 dcache_flush_frame(page, frame);173 #endif174 189 } 175 190 … … 218 233 frame_reference_add(pfn); 219 234 } 220 235 221 236 } 222 237 } -
kernel/generic/src/mm/backend_elf.c
r4638401 r454f1da 82 82 uintptr_t base, frame; 83 83 index_t i; 84 bool dirty = false; 84 85 85 86 if (!as_area_check_access(area, access)) … … 148 149 memcpy((void *) PA2KA(frame), 149 150 (void *) (base + i * FRAME_SIZE), FRAME_SIZE); 150 151 dirty = true; 152 151 153 if (area->sh_info) { 152 154 frame_reference_add(ADDR2PFN(frame)); … … 169 171 frame = (uintptr_t)frame_alloc(ONE_FRAME, 0); 170 172 memsetb(PA2KA(frame), FRAME_SIZE, 0); 173 dirty = true; 171 174 172 175 if (area->sh_info) { … … 189 192 memcpy((void *) PA2KA(frame), (void *) (base + i * FRAME_SIZE), 190 193 size); 194 dirty = true; 191 195 192 196 if (area->sh_info) { … … 205 209 if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1)) 206 210 panic("Could not insert used space.\n"); 211 212 #ifdef CONFIG_VIRT_IDX_DCACHE 213 if (dirty && PAGE_COLOR(PA2KA(frame)) != PAGE_COLOR(addr)) { 214 /* 215 * By writing to the frame using kernel virtual address, 216 * we have created an illegal virtual alias. We now have to 217 * invalidate cachelines belonging to addr on all processors 218 * so that they will be reloaded with the new content on next 219 * read. 220 */ 221 dcache_flush_frame(addr, frame); 222 dcache_shootdown_start(DCACHE_INVL_FRAME, PAGE_COLOR(addr), frame); 223 dcache_shootdown_finalize(); 224 } 225 #endif 207 226 208 227 return AS_PF_OK; … … 239 258 */ 240 259 frame_free(frame); 241 #ifdef CONFIG_VIRT_IDX_DCACHE242 dcache_flush_frame(page, frame);243 #endif244 260 } 245 261 } else { … … 248 264 * lower part is backed by the ELF image and the upper is 249 265 * anonymous). In any case, a frame needs to be freed. 250 */ 251 frame_free(frame); 252 #ifdef CONFIG_VIRT_IDX_DCACHE 253 dcache_flush_frame(page, frame); 254 #endif 266 */ 267 frame_free(frame); 255 268 } 256 269 }
Note:
See TracChangeset
for help on using the changeset viewer.