| ... | ... | @@ -533,9 +533,10 @@ fn getauxvalImpl(index: usize) callconv(.c) usize { |
| 533 | 533 | // Some architectures (and some syscalls) require 64bit parameters to be passed |
| 534 | 534 | // in a even-aligned register pair. |
| 535 | 535 | const require_aligned_register_pair = |
| 536 | | builtin.cpu.arch.isPowerPC32() or |
| 536 | builtin.cpu.arch.isArm() or |
| 537 | builtin.cpu.arch == .hexagon or |
| 537 | 538 | builtin.cpu.arch.isMIPS32() or |
| 538 | | builtin.cpu.arch.isArm(); |
| 539 | builtin.cpu.arch.isPowerPC32(); |
| 539 | 540 | |
| 540 | 541 | // Split a 64bit value into a {LSB,MSB} pair. |
| 541 | 542 | // The LE/BE variants specify the endianness to assume. |
| ... | ... | @@ -640,7 +641,7 @@ pub fn futimens(fd: i32, times: ?*const [2]timespec) usize { |
| 640 | 641 | |
| 641 | 642 | pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: ?*const [2]timespec, flags: u32) usize { |
| 642 | 643 | return syscall4( |
| 643 | | if (@hasField(SYS, "utimensat")) .utimensat else .utimensat_time64, |
| 644 | if (@hasField(SYS, "utimensat") and native_arch != .hexagon) .utimensat else .utimensat_time64, |
| 644 | 645 | @as(usize, @bitCast(@as(isize, dirfd))), |
| 645 | 646 | @intFromPtr(path), |
| 646 | 647 | @intFromPtr(times), |
| ... | ... | @@ -688,7 +689,7 @@ pub const futex_param4 = extern union { |
| 688 | 689 | /// defines which of the subsequent paramters are relevant. |
| 689 | 690 | pub fn futex(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, val2timeout: futex_param4, uaddr2: ?*const anyopaque, val3: u32) usize { |
| 690 | 691 | return syscall6( |
| 691 | | if (@hasField(SYS, "futex")) .futex else .futex_time64, |
| 692 | if (@hasField(SYS, "futex") and native_arch != .hexagon) .futex else .futex_time64, |
| 692 | 693 | @intFromPtr(uaddr), |
| 693 | 694 | @as(u32, @bitCast(futex_op)), |
| 694 | 695 | val, |
| ... | ... | @@ -702,7 +703,7 @@ pub fn futex(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, val2timeout: |
| 702 | 703 | /// futex_op that ignores the remaining arguments (e.g., FUTUX_OP.WAKE). |
| 703 | 704 | pub fn futex_3arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32) usize { |
| 704 | 705 | return syscall3( |
| 705 | | if (@hasField(SYS, "futex")) .futex else .futex_time64, |
| 706 | if (@hasField(SYS, "futex") and native_arch != .hexagon) .futex else .futex_time64, |
| 706 | 707 | @intFromPtr(uaddr), |
| 707 | 708 | @as(u32, @bitCast(futex_op)), |
| 708 | 709 | val, |
| ... | ... | @@ -713,7 +714,7 @@ pub fn futex_3arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32) usize { |
| 713 | 714 | /// futex_op that ignores the remaining arguments (e.g., FUTEX_OP.WAIT). |
| 714 | 715 | pub fn futex_4arg(uaddr: *const anyopaque, futex_op: FUTEX_OP, val: u32, timeout: ?*const timespec) usize { |
| 715 | 716 | return syscall4( |
| 716 | | if (@hasField(SYS, "futex")) .futex else .futex_time64, |
| 717 | if (@hasField(SYS, "futex") and native_arch != .hexagon) .futex else .futex_time64, |
| 717 | 718 | @intFromPtr(uaddr), |
| 718 | 719 | @as(u32, @bitCast(futex_op)), |
| 719 | 720 | val, |
| ... | ... | @@ -1093,7 +1094,7 @@ pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize { |
| 1093 | 1094 | |
| 1094 | 1095 | pub fn ppoll(fds: [*]pollfd, n: nfds_t, timeout: ?*timespec, sigmask: ?*const sigset_t) usize { |
| 1095 | 1096 | return syscall5( |
| 1096 | | if (@hasField(SYS, "ppoll")) .ppoll else .ppoll_time64, |
| 1097 | if (@hasField(SYS, "ppoll") and native_arch != .hexagon) .ppoll else .ppoll_time64, |
| 1097 | 1098 | @intFromPtr(fds), |
| 1098 | 1099 | n, |
| 1099 | 1100 | @intFromPtr(timeout), |
| ... | ... | @@ -1627,7 +1628,7 @@ pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { |
| 1627 | 1628 | } |
| 1628 | 1629 | } |
| 1629 | 1630 | return syscall2( |
| 1630 | | if (@hasField(SYS, "clock_gettime")) .clock_gettime else .clock_gettime64, |
| 1631 | if (@hasField(SYS, "clock_gettime") and native_arch != .hexagon) .clock_gettime else .clock_gettime64, |
| 1631 | 1632 | @intFromEnum(clk_id), |
| 1632 | 1633 | @intFromPtr(tp), |
| 1633 | 1634 | ); |
| ... | ... | @@ -1645,7 +1646,7 @@ fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.c) usize { |
| 1645 | 1646 | |
| 1646 | 1647 | pub fn clock_getres(clk_id: i32, tp: *timespec) usize { |
| 1647 | 1648 | return syscall2( |
| 1648 | | if (@hasField(SYS, "clock_getres")) .clock_getres else .clock_getres_time64, |
| 1649 | if (@hasField(SYS, "clock_getres") and native_arch != .hexagon) .clock_getres else .clock_getres_time64, |
| 1649 | 1650 | @as(usize, @bitCast(@as(isize, clk_id))), |
| 1650 | 1651 | @intFromPtr(tp), |
| 1651 | 1652 | ); |
| ... | ... | @@ -1653,7 +1654,7 @@ pub fn clock_getres(clk_id: i32, tp: *timespec) usize { |
| 1653 | 1654 | |
| 1654 | 1655 | pub fn clock_settime(clk_id: i32, tp: *const timespec) usize { |
| 1655 | 1656 | return syscall2( |
| 1656 | | if (@hasField(SYS, "clock_settime")) .clock_settime else .clock_settime64, |
| 1657 | if (@hasField(SYS, "clock_settime") and native_arch != .hexagon) .clock_settime else .clock_settime64, |
| 1657 | 1658 | @as(usize, @bitCast(@as(isize, clk_id))), |
| 1658 | 1659 | @intFromPtr(tp), |
| 1659 | 1660 | ); |
| ... | ... | @@ -1661,7 +1662,7 @@ pub fn clock_settime(clk_id: i32, tp: *const timespec) usize { |
| 1661 | 1662 | |
| 1662 | 1663 | pub fn clock_nanosleep(clockid: clockid_t, flags: TIMER, request: *const timespec, remain: ?*timespec) usize { |
| 1663 | 1664 | return syscall4( |
| 1664 | | if (@hasField(SYS, "clock_nanosleep")) .clock_nanosleep else .clock_nanosleep_time64, |
| 1665 | if (@hasField(SYS, "clock_nanosleep") and native_arch != .hexagon) .clock_nanosleep else .clock_nanosleep_time64, |
| 1665 | 1666 | @intFromEnum(clockid), |
| 1666 | 1667 | @as(u32, @bitCast(flags)), |
| 1667 | 1668 | @intFromPtr(request), |
| ... | ... | @@ -2071,7 +2072,7 @@ pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize { |
| 2071 | 2072 | |
| 2072 | 2073 | pub fn recvmmsg(fd: i32, msgvec: ?[*]mmsghdr, vlen: u32, flags: u32, timeout: ?*timespec) usize { |
| 2073 | 2074 | return syscall5( |
| 2074 | | if (@hasField(SYS, "recvmmsg")) .recvmmsg else .recvmmsg_time64, |
| 2075 | if (@hasField(SYS, "recvmmsg") and native_arch != .hexagon) .recvmmsg else .recvmmsg_time64, |
| 2075 | 2076 | @as(usize, @bitCast(@as(isize, fd))), |
| 2076 | 2077 | @intFromPtr(msgvec), |
| 2077 | 2078 | vlen, |
| ... | ... | @@ -2421,7 +2422,7 @@ pub const itimerspec = extern struct { |
| 2421 | 2422 | |
| 2422 | 2423 | pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize { |
| 2423 | 2424 | return syscall2( |
| 2424 | | if (@hasField(SYS, "timerfd_gettime")) .timerfd_gettime else .timerfd_gettime64, |
| 2425 | if (@hasField(SYS, "timerfd_gettime") and native_arch != .hexagon) .timerfd_gettime else .timerfd_gettime64, |
| 2425 | 2426 | @bitCast(@as(isize, fd)), |
| 2426 | 2427 | @intFromPtr(curr_value), |
| 2427 | 2428 | ); |
| ... | ... | @@ -2429,7 +2430,7 @@ pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize { |
| 2429 | 2430 | |
| 2430 | 2431 | pub fn timerfd_settime(fd: i32, flags: TFD.TIMER, new_value: *const itimerspec, old_value: ?*itimerspec) usize { |
| 2431 | 2432 | return syscall4( |
| 2432 | | if (@hasField(SYS, "timerfd_settime")) .timerfd_settime else .timerfd_settime64, |
| 2433 | if (@hasField(SYS, "timerfd_settime") and native_arch != .hexagon) .timerfd_settime else .timerfd_settime64, |
| 2433 | 2434 | @bitCast(@as(isize, fd)), |
| 2434 | 2435 | @as(u32, @bitCast(flags)), |
| 2435 | 2436 | @intFromPtr(new_value), |
| ... | ... | @@ -2632,7 +2633,7 @@ pub fn process_vm_writev(pid: pid_t, local: []const iovec_const, remote: []const |
| 2632 | 2633 | } |
| 2633 | 2634 | |
| 2634 | 2635 | pub fn fadvise(fd: fd_t, offset: i64, len: i64, advice: usize) usize { |
| 2635 | | if (comptime native_arch.isArm() or native_arch.isPowerPC32()) { |
| 2636 | if (comptime native_arch.isArm() or native_arch == .hexagon or native_arch.isPowerPC32()) { |
| 2636 | 2637 | // These architectures reorder the arguments so that a register is not skipped to align the |
| 2637 | 2638 | // register number that `offset` is passed in. |
| 2638 | 2639 | |
| ... | ... | @@ -8367,7 +8368,7 @@ pub const kernel_timespec = extern struct { |
| 8367 | 8368 | }; |
| 8368 | 8369 | |
| 8369 | 8370 | // https://github.com/ziglang/zig/issues/4726#issuecomment-2190337877 |
| 8370 | | pub const timespec = if (native_arch == .riscv32) kernel_timespec else extern struct { |
| 8371 | pub const timespec = if (native_arch == .hexagon or native_arch == .riscv32) kernel_timespec else extern struct { |
| 8371 | 8372 | sec: isize, |
| 8372 | 8373 | nsec: isize, |
| 8373 | 8374 | }; |