mirror of
https://github.com/ziglang/zig.git
synced 2025-12-31 18:43:18 +00:00
std.os.linux: Fix mmap() syscall invocation for s390x.
The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so it takes a single pointer to an array of arguments instead.
This commit is contained in:
parent
07c943598d
commit
cd6795fc06
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user