| 283 | } |
| 284 | |
| 285 | int |
| 286 | elf_cpu_load_file(linker_file_t lf) |
| 287 | { |
| 288 | |
| 289 | /* |
| 290 | * The pmap code does not do an icache sync upon establishing executable |
| 291 | * mappings in the kernel pmap. It's an optimization based on the fact |
| 292 | * that kernel memory allocations always have EXECUTABLE protection even |
| 293 | * when the memory isn't going to hold executable code. The only time |
| 294 | * kernel memory holding instructions does need a sync is after loading |
| 295 | * a kernel module, and that's when this function gets called. |
| 296 | * |
| 297 | * This syncs data and instruction caches after loading a module. We |
| 298 | * don't worry about the kernel itself (lf->id is 1) as locore.S did |
| 299 | * that on entry. Even if data cache maintenance was done by IO code, |
| 300 | * the relocation fixup process creates dirty cache entries that we must |
| 301 | * write back before doing icache sync. The instruction cache sync also |
| 302 | * invalidates the branch predictor cache on platforms that have one. |
| 303 | */ |
| 304 | if (lf->id == 1) |
| 305 | return (0); |
| 306 | dcache_wb_pou((vm_offset_t)lf->address, (vm_size_t)lf->size); |
| 307 | icache_inv_all(); |
| 308 | |
| 309 | #if defined(DDB) || defined(KDTRACE_HOOKS) || defined(STACK) |
| 310 | /* |
| 311 | * Inform the stack(9) code of the new module, so it can acquire its |
| 312 | * per-module unwind data. |
| 313 | */ |
| 314 | unwind_module_loaded(lf); |
| 315 | #endif |
| 316 | |
| 317 | return (0); |
| 318 | } |
| 319 | |
| 320 | int |
| 321 | elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused) |
no test coverage detected