| ... | @@ -86,6 +86,26 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void { | ... | @@ -86,6 +86,26 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void { |
| 86 | const result = std.os.linux.syscall3(.cacheflush, start, end - start, flags); | 86 | const result = std.os.linux.syscall3(.cacheflush, start, end - start, flags); |
| 87 | std.debug.assert(result == 0); | 87 | std.debug.assert(result == 0); |
| 88 | exportIt(); | 88 | exportIt(); |
| | 89 | } else if (os == .netbsd and mips) { |
| | 90 | // Replace with https://github.com/ziglang/zig/issues/23904 in the future. |
| | 91 | const cfa: extern struct { |
| | 92 | va: usize, |
| | 93 | nbytes: usize, |
| | 94 | whichcache: u32, |
| | 95 | } = .{ |
| | 96 | .va = start, |
| | 97 | .nbytes = end - start, |
| | 98 | .whichcache = 3, // ICACHE | DCACHE |
| | 99 | }; |
| | 100 | asm volatile ( |
| | 101 | \\ syscall |
| | 102 | : |
| | 103 | : [_] "{$2}" (165), // nr = SYS_sysarch |
| | 104 | [_] "{$4}" (0), // op = MIPS_CACHEFLUSH |
| | 105 | [_] "{$5}" (&cfa), // args = &cfa |
| | 106 | : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| | 107 | ); |
| | 108 | exportIt(); |
| 89 | } else if (mips and os == .openbsd) { | 109 | } else if (mips and os == .openbsd) { |
| 90 | // TODO | 110 | // TODO |
| 91 | //cacheflush(start, (uintptr_t)end - (uintptr_t)start, BCACHE); | 111 | //cacheflush(start, (uintptr_t)end - (uintptr_t)start, BCACHE); |