riscv: workarounds for riscv threading

This commit is contained in:
David Rubin 2024-07-26 14:03:20 -07:00
parent a7498a6a53
commit c20def73af
No known key found for this signature in database
GPG Key ID: A4390FEB5F00C0A5
2 changed files with 1 additions and 15 deletions

View File

@ -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,

View File

@ -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(