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

Function sync_icache

freebsd/arm/arm/sys_machdep.c:65–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63static int arm32_drain_writebuf(struct thread *, void *);
64
65static int
66sync_icache(uintptr_t addr, size_t len)
67{
68 size_t size;
69 vm_offset_t rv;
70
71 /* Align starting address to cacheline size */
72 len += addr & cpuinfo.dcache_line_mask;
73 addr &= ~cpuinfo.dcache_line_mask;
74
75 /* Break whole range to pages. */
76 do {
77 size = PAGE_SIZE - (addr & PAGE_MASK);
78 size = min(size, len);
79 rv = dcache_wb_pou_checked(addr, size);
80 if (rv == 1) /* see dcache_wb_pou_checked() */
81 rv = icache_inv_pou_checked(addr, size);
82 if (rv != 1) {
83 if (!useracc((void *)addr, size, VM_PROT_READ)) {
84 /* Invalid access */
85 return (rv);
86 }
87 /* Valid but unmapped page - skip it. */
88 }
89 len -= size;
90 addr += size;
91 } while (len > 0);
92
93 /* Invalidate branch predictor buffer. */
94 bpb_inv_all();
95 return (1);
96}
97
98static int
99arm32_sync_icache(struct thread *td, void *args)

Callers 1

arm32_sync_icacheFunction · 0.85

Calls 3

minFunction · 0.85
bpb_inv_allFunction · 0.85
useraccFunction · 0.50

Tested by

no test coverage detected