aboutsummaryrefslogtreecommitdiff
path: root/src/lib/rethooks.zig
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-07-17 22:32:03 +0200
committerHimbeer <himbeer@disroot.org>2024-07-17 22:32:03 +0200
commitce729578bd4fbf4108ebcdeda8186d606d1c803e (patch)
tree33413f3cbb84f977fad53eeef055e811062ff630 /src/lib/rethooks.zig
parentb084e65f9f5d63b968081ecf82bf5d64d7d9f613 (diff)
syscall: Replace terminate() with /process/self/terminate VFS hook
Diffstat (limited to 'src/lib/rethooks.zig')
-rw-r--r--src/lib/rethooks.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/rethooks.zig b/src/lib/rethooks.zig
index bad4d55..e81125a 100644
--- a/src/lib/rethooks.zig
+++ b/src/lib/rethooks.zig
@@ -3,9 +3,16 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pub fn terminate() linksection(".rethooks") callconv(.Naked) noreturn {
- // Syscall #100011 is "terminate".
+ // Syscall #100001 is "open".
+ // Use the "/process/self/terminate" hook to terminate the thread.
asm volatile (
- \\ li a7, 100011
+ \\ mv a0, a2
+ \\ mv a1, a3
+ \\ mv t0, a0
+ \\ li a7, 100001
\\ ecall
+ :
+ : [path_c] "{t0}" ("/process/self/terminate\x00".ptr),
+ : "a0", "a2", "a3", "a7"
);
}