Commit cd6795fc06
lib/std/os/linux/tls.zig
@@ -541,7 +541,19 @@ inline fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: linux.MAP, fd
@as(usize, @truncate(@as(u64, @bitCast(offset)) / linux.MMAP2_UNIT)),
});
} else {
- return @call(.always_inline, linux.syscall6, .{
+ // The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so
+ // it takes a single pointer to an array of arguments instead.
+ return if (native_arch == .s390x) @call(.always_inline, linux.syscall1, .{
+ .mmap,
+ @intFromPtr(&[_]usize{
+ @intFromPtr(address),
+ length,
+ prot,
+ @as(u32, @bitCast(flags)),
+ @as(usize, @bitCast(@as(isize, fd))),
+ @as(u64, @bitCast(offset)),
+ }),
+ }) else @call(.always_inline, linux.syscall6, .{
.mmap,
@intFromPtr(address),
length,
lib/std/os/linux.zig
@@ -904,7 +904,19 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: MAP, fd: i32, of
@truncate(@as(u64, @bitCast(offset)) / MMAP2_UNIT),
);
} else {
- return syscall6(
+ // The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so
+ // it takes a single pointer to an array of arguments instead.
+ return if (native_arch == .s390x) syscall1(
+ .mmap,
+ @intFromPtr(&[_]usize{
+ @intFromPtr(address),
+ length,
+ prot,
+ @as(u32, @bitCast(flags)),
+ @bitCast(@as(isize, fd)),
+ @as(u64, @bitCast(offset)),
+ }),
+ ) else syscall6(
.mmap,
@intFromPtr(address),
length,