MCPcopy Create free account
hub / github.com/F-Stack/f-stack / elf_cpu_load_file

Function elf_cpu_load_file

freebsd/arm/arm/elf_machdep.c:285–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285int
286elf_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
320int
321elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)

Callers 3

link_elf_load_fileFunction · 0.50

Calls 3

dcache_wb_pouFunction · 0.85
icache_inv_allFunction · 0.85
unwind_module_loadedFunction · 0.85

Tested by

no test coverage detected