| 63 | static int arm32_drain_writebuf(struct thread *, void *); |
| 64 | |
| 65 | static int |
| 66 | sync_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 | |
| 98 | static int |
| 99 | arm32_sync_icache(struct thread *td, void *args) |
no test coverage detected