mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
compiler-rt: Implement __clear_cache() for mips-netbsd
This commit is contained in:
parent
5209e7e458
commit
9a1e754a58
1 changed files with 20 additions and 0 deletions
|
|
@ -86,6 +86,26 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void {
|
|||
const result = std.os.linux.syscall3(.cacheflush, start, end - start, flags);
|
||||
std.debug.assert(result == 0);
|
||||
exportIt();
|
||||
} else if (os == .netbsd and mips) {
|
||||
// Replace with https://github.com/ziglang/zig/issues/23904 in the future.
|
||||
const cfa: extern struct {
|
||||
va: usize,
|
||||
nbytes: usize,
|
||||
whichcache: u32,
|
||||
} = .{
|
||||
.va = start,
|
||||
.nbytes = end - start,
|
||||
.whichcache = 3, // ICACHE | DCACHE
|
||||
};
|
||||
asm volatile (
|
||||
\\ syscall
|
||||
:
|
||||
: [_] "{$2}" (165), // nr = SYS_sysarch
|
||||
[_] "{$4}" (0), // op = MIPS_CACHEFLUSH
|
||||
[_] "{$5}" (&cfa), // args = &cfa
|
||||
: "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
|
||||
);
|
||||
exportIt();
|
||||
} else if (mips and os == .openbsd) {
|
||||
// TODO
|
||||
//cacheflush(start, (uintptr_t)end - (uintptr_t)start, BCACHE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue