aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-08-18 02:02:47 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-08-19 08:38:05 +0200
commitd79e2822b062b98dff6bfd2c4549ec065d9e43d2 (patch)
treef7735d7175a78ecfee12852078f34e2f0f81000c /lib
parent54e48f7b7dec96c8cdd1a0a0491554b118767817 (diff)
downloadzig-d79e2822b062b98dff6bfd2c4549ec065d9e43d2.tar.gz
zig-d79e2822b062b98dff6bfd2c4549ec065d9e43d2.zip
std.Thread: Implement freeAndExit() for sparc32.
Diffstat (limited to 'lib')
-rw-r--r--lib/std/Thread.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index 2ed6610bc0..12c22d69a8 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -1188,6 +1188,28 @@ const LinuxThreadImpl = struct {
[len] "r" (self.mapped.len),
: "memory"
),
+ .sparc => asm volatile (
+ \\ # See sparc64 comments below.
+ \\ 1:
+ \\ cmp %%fp, 0
+ \\ beq 2f
+ \\ nop
+ \\ ba 1b
+ \\ restore
+ \\ 2:
+ \\ mov 73, %%g1 # SYS_munmap
+ \\ mov %[ptr], %%o0
+ \\ mov %[len], %%o1
+ \\ t 0x3 # ST_FLUSH_WINDOWS
+ \\ t 0x10
+ \\ mov 1, %%g1 # SYS_exit
+ \\ mov 0, %%o0
+ \\ t 0x10
+ :
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
+ [len] "r" (self.mapped.len),
+ : "memory"
+ ),
.sparc64 => asm volatile (
\\ # SPARCs really don't like it when active stack frames
\\ # is unmapped (it will result in a segfault), so we