aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorDavid Rubin <daviru007@icloud.com>2024-07-26 14:03:20 -0700
committerDavid Rubin <daviru007@icloud.com>2024-07-26 14:53:50 -0700
commitc20def73af49bac435d21cd058e7b9612ef3d2a5 (patch)
tree6e2378eeea681b17f263ec899a232afc5c87474d /lib/std
parenta7498a6a53b2aa50274aa425c91e2e449a736cf4 (diff)
downloadzig-c20def73af49bac435d21cd058e7b9612ef3d2a5.tar.gz
zig-c20def73af49bac435d21cd058e7b9612ef3d2a5.zip
riscv: workarounds for riscv threading
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/Thread.zig2
-rw-r--r--lib/std/heap/PageAllocator.zig14
2 files changed, 1 insertions, 15 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index c3802cc1fe..8775b9a52e 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -385,7 +385,7 @@ pub fn yield() YieldError!void {
}
/// State to synchronize detachment of spawner thread to spawned thread
-const Completion = std.atomic.Value(enum(u8) {
+const Completion = std.atomic.Value(enum(if (builtin.zig_backend == .stage2_riscv64) u32 else u8) {
running,
detached,
completed,
diff --git a/lib/std/heap/PageAllocator.zig b/lib/std/heap/PageAllocator.zig
index 92c8ca6b28..4188c25528 100644
--- a/lib/std/heap/PageAllocator.zig
+++ b/lib/std/heap/PageAllocator.zig
@@ -34,20 +34,6 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 {
return @ptrCast(addr);
}
- if (builtin.zig_backend == .stage2_riscv64) {
- const aligned_len = mem.alignForward(usize, n, mem.page_size);
- const slice = posix.mmap(
- null,
- aligned_len,
- posix.PROT.READ | posix.PROT.WRITE,
- .{ .TYPE = .PRIVATE, .ANONYMOUS = true },
- -1,
- 0,
- ) catch return null;
- assert(mem.isAligned(@intFromPtr(slice.ptr), mem.page_size));
- return slice.ptr;
- }
-
const aligned_len = mem.alignForward(usize, n, mem.page_size);
const hint = @atomicLoad(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, .unordered);
const slice = posix.mmap(