Commit 7f24993772

Suirad <suirad@users.noreply.github.com>
2023-02-04 07:42:43
Add support for mips64/mips64el
1 parent c1f7196
lib/std/os/linux/mips64.zig
@@ -0,0 +1,413 @@
+const std = @import("../../std.zig");
+const maxInt = std.math.maxInt;
+const linux = std.os.linux;
+const SYS = linux.SYS;
+const socklen_t = linux.socklen_t;
+const iovec = std.os.iovec;
+const iovec_const = std.os.iovec_const;
+const uid_t = linux.uid_t;
+const gid_t = linux.gid_t;
+const pid_t = linux.pid_t;
+const sockaddr = linux.sockaddr;
+const timespec = linux.timespec;
+
+pub fn syscall0(number: SYS) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+        : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn syscall_pipe(fd: *[2]i32) usize {
+    return asm volatile (
+        \\ .set noat
+        \\ .set noreorder
+        \\ syscall
+        \\ blez $7, 1f
+        \\ nop
+        \\ b 2f
+        \\ subu $2, $0, $2
+        \\ 1:
+        \\ sw $2, 0($4)
+        \\ sw $3, 4($4)
+        \\ 2:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(SYS.pipe)),
+          [fd] "{$4}" (fd),
+        : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn syscall1(number: SYS, arg1: usize) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+          [arg1] "{$4}" (arg1),
+        : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+          [arg1] "{$4}" (arg1),
+          [arg2] "{$5}" (arg2),
+        : "$1", "$3", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+          [arg1] "{$4}" (arg1),
+          [arg2] "{$5}" (arg2),
+          [arg3] "{$6}" (arg3),
+        : "$1", "$3", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+          [arg1] "{$4}" (arg1),
+          [arg2] "{$5}" (arg2),
+          [arg3] "{$6}" (arg3),
+          [arg4] "{$7}" (arg4),
+        : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+          [arg1] "{$4}" (arg1),
+          [arg2] "{$5}" (arg2),
+          [arg3] "{$6}" (arg3),
+          [arg4] "{$7}" (arg4),
+          [arg5] "{$8}" (arg5),
+        : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+// NOTE: The o32 calling convention requires the callee to reserve 16 bytes for
+// the first four arguments even though they're passed in $a0-$a3.
+
+pub fn syscall6(
+    number: SYS,
+    arg1: usize,
+    arg2: usize,
+    arg3: usize,
+    arg4: usize,
+    arg5: usize,
+    arg6: usize,
+) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+          [arg1] "{$4}" (arg1),
+          [arg2] "{$5}" (arg2),
+          [arg3] "{$6}" (arg3),
+          [arg4] "{$7}" (arg4),
+          [arg5] "{$8}" (arg5),
+          [arg6] "{$9}" (arg6),
+        : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn syscall7(
+    number: SYS,
+    arg1: usize,
+    arg2: usize,
+    arg3: usize,
+    arg4: usize,
+    arg5: usize,
+    arg6: usize,
+    arg7: usize,
+) usize {
+    return asm volatile (
+        \\ syscall
+        \\ blez $7, 1f
+        \\ dsubu $2, $0, $2
+        \\ 1:
+        : [ret] "={$2}" (-> usize),
+        : [number] "{$2}" (@enumToInt(number)),
+          [arg1] "{$4}" (arg1),
+          [arg2] "{$5}" (arg2),
+          [arg3] "{$6}" (arg3),
+          [arg4] "{$7}" (arg4),
+          [arg5] "{$8}" (arg5),
+          [arg6] "{$9}" (arg6),
+          [arg7] "{$10}" (arg7),
+        : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+const CloneFn = *const fn (arg: usize) callconv(.C) u8;
+
+/// This matches the libc clone function.
+pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
+
+pub fn restore() callconv(.Naked) void {
+    return asm volatile ("syscall"
+        :
+        : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn)),
+        : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub fn restore_rt() callconv(.Naked) void {
+    return asm volatile ("syscall"
+        :
+        : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn)),
+        : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory"
+    );
+}
+
+pub const O = struct {
+    pub const CREAT = 0o0400;
+    pub const EXCL = 0o02000;
+    pub const NOCTTY = 0o04000;
+    pub const TRUNC = 0o01000;
+    pub const APPEND = 0o0010;
+    pub const NONBLOCK = 0o0200;
+    pub const DSYNC = 0o0020;
+    pub const SYNC = 0o040020;
+    pub const RSYNC = 0o040020;
+    pub const DIRECTORY = 0o0200000;
+    pub const NOFOLLOW = 0o0400000;
+    pub const CLOEXEC = 0o02000000;
+
+    pub const ASYNC = 0o010000;
+    pub const DIRECT = 0o0100000;
+    pub const LARGEFILE = 0o020000;
+    pub const NOATIME = 0o01000000;
+    pub const PATH = 0o010000000;
+    pub const TMPFILE = 0o020200000;
+    pub const NDELAY = NONBLOCK;
+};
+
+pub const F = struct {
+    pub const DUPFD = 0;
+    pub const GETFD = 1;
+    pub const SETFD = 2;
+    pub const GETFL = 3;
+    pub const SETFL = 4;
+
+    pub const SETOWN = 24;
+    pub const GETOWN = 23;
+    pub const SETSIG = 10;
+    pub const GETSIG = 11;
+
+    pub const GETLK = 33;
+    pub const SETLK = 34;
+    pub const SETLKW = 35;
+
+    pub const RDLCK = 0;
+    pub const WRLCK = 1;
+    pub const UNLCK = 2;
+
+    pub const SETOWN_EX = 15;
+    pub const GETOWN_EX = 16;
+
+    pub const GETOWNER_UIDS = 17;
+};
+
+pub const LOCK = struct {
+    pub const SH = 1;
+    pub const EX = 2;
+    pub const UN = 8;
+    pub const NB = 4;
+};
+
+pub const MMAP2_UNIT = 4096;
+
+pub const MAP = struct {
+    pub const NORESERVE = 0x0400;
+    pub const GROWSDOWN = 0x1000;
+    pub const DENYWRITE = 0x2000;
+    pub const EXECUTABLE = 0x4000;
+    pub const LOCKED = 0x8000;
+    pub const @"32BIT" = 0x40;
+};
+
+pub const VDSO = struct {
+    pub const CGT_SYM = "__kernel_clock_gettime";
+    pub const CGT_VER = "LINUX_2.6.39";
+};
+
+pub const Flock = extern struct {
+    type: i16,
+    whence: i16,
+    __pad0: [4]u8,
+    start: off_t,
+    len: off_t,
+    pid: pid_t,
+    __unused: [4]u8,
+};
+
+pub const msghdr = extern struct {
+    name: ?*sockaddr,
+    namelen: socklen_t,
+    iov: [*]iovec,
+    iovlen: i32,
+    control: ?*anyopaque,
+    controllen: socklen_t,
+    flags: i32,
+};
+
+pub const msghdr_const = extern struct {
+    name: ?*const sockaddr,
+    namelen: socklen_t,
+    iov: [*]const iovec_const,
+    iovlen: i32,
+    control: ?*const anyopaque,
+    controllen: socklen_t,
+    flags: i32,
+};
+
+pub const blksize_t = i32;
+pub const nlink_t = u32;
+pub const time_t = i32;
+pub const mode_t = u32;
+pub const off_t = i64;
+pub const ino_t = u64;
+pub const dev_t = u64;
+pub const blkcnt_t = i64;
+
+// The `stat` definition used by the Linux kernel.
+pub const Stat = extern struct {
+    dev: u32,
+    __pad0: [3]u32, // Reserved for st_dev expansion
+    ino: ino_t,
+    mode: mode_t,
+    nlink: nlink_t,
+    uid: uid_t,
+    gid: gid_t,
+    rdev: u32,
+    __pad1: [3]u32,
+    size: off_t,
+    atim: timespec,
+    mtim: timespec,
+    ctim: timespec,
+    blksize: blksize_t,
+    __pad3: u32,
+    blocks: blkcnt_t,
+    __pad4: [14]usize,
+
+    pub fn atime(self: @This()) timespec {
+        return self.atim;
+    }
+
+    pub fn mtime(self: @This()) timespec {
+        return self.mtim;
+    }
+
+    pub fn ctime(self: @This()) timespec {
+        return self.ctim;
+    }
+};
+
+pub const timeval = extern struct {
+    tv_sec: isize,
+    tv_usec: isize,
+};
+
+pub const timezone = extern struct {
+    tz_minuteswest: i32,
+    tz_dsttime: i32,
+};
+
+pub const Elf_Symndx = u32;
+
+pub const rlimit_resource = enum(c_int) {
+    /// Per-process CPU limit, in seconds.
+    CPU,
+
+    /// Largest file that can be created, in bytes.
+    FSIZE,
+
+    /// Maximum size of data segment, in bytes.
+    DATA,
+
+    /// Maximum size of stack segment, in bytes.
+    STACK,
+
+    /// Largest core file that can be created, in bytes.
+    CORE,
+
+    /// Number of open files.
+    NOFILE,
+
+    /// Address space limit.
+    AS,
+
+    /// Largest resident set size, in bytes.
+    /// This affects swapping; processes that are exceeding their
+    /// resident set size will be more likely to have physical memory
+    /// taken from them.
+    RSS,
+
+    /// Number of processes.
+    NPROC,
+
+    /// Locked-in-memory address space.
+    MEMLOCK,
+
+    /// Maximum number of file locks.
+    LOCKS,
+
+    /// Maximum number of pending signals.
+    SIGPENDING,
+
+    /// Maximum bytes in POSIX message queues.
+    MSGQUEUE,
+
+    /// Maximum nice priority allowed to raise to.
+    /// Nice levels 19 .. -20 correspond to 0 .. 39
+    /// values of this resource limit.
+    NICE,
+
+    /// Maximum realtime priority allowed for non-priviledged
+    /// processes.
+    RTPRIO,
+
+    /// Maximum CPU time in µs that a process scheduled under a real-time
+    /// scheduling policy may consume without making a blocking system
+    /// call before being forcibly descheduled.
+    RTTIME,
+
+    _,
+};
lib/std/os/linux/syscalls.zig
@@ -2032,6 +2032,361 @@ pub const Mips = enum(usize) {
     set_mempolicy_home_node = Linux + 450,
 };
 
+pub const Mips64 = enum(usize) {
+    pub const Linux = 5000;
+
+    read = Linux + 0,
+    write = Linux + 1,
+    open = Linux + 2,
+    close = Linux + 3,
+    stat = Linux + 4,
+    fstat = Linux + 5,
+    lstat = Linux + 6,
+    poll = Linux + 7,
+    lseek = Linux + 8,
+    mmap = Linux + 9,
+    mprotect = Linux + 10,
+    munmap = Linux + 11,
+    brk = Linux + 12,
+    rt_sigaction = Linux + 13,
+    rt_sigprocmask = Linux + 14,
+    ioctl = Linux + 15,
+    pread64 = Linux + 16,
+    pwrite64 = Linux + 17,
+    readv = Linux + 18,
+    writev = Linux + 19,
+    access = Linux + 20,
+    pipe = Linux + 21,
+    select = Linux + 22,
+    sched_yield = Linux + 23,
+    mremap = Linux + 24,
+    msync = Linux + 25,
+    mincore = Linux + 26,
+    madvise = Linux + 27,
+    shmget = Linux + 28,
+    shmat = Linux + 29,
+    shmctl = Linux + 30,
+    dup = Linux + 31,
+    dup2 = Linux + 32,
+    pause = Linux + 33,
+    nanosleep = Linux + 34,
+    getitimer = Linux + 35,
+    alarm = Linux + 36,
+    setitimer = Linux + 37,
+    getpid = Linux + 38,
+    sendfile = Linux + 39,
+    socket = Linux + 40,
+    connect = Linux + 41,
+    accept = Linux + 42,
+    sendto = Linux + 43,
+    recvfrom = Linux + 44,
+    sendmsg = Linux + 45,
+    recvmsg = Linux + 46,
+    shutdown = Linux + 47,
+    bind = Linux + 48,
+    listen = Linux + 49,
+    getsockname = Linux + 50,
+    getpeername = Linux + 51,
+    socketpair = Linux + 52,
+    setsockopt = Linux + 53,
+    getsockopt = Linux + 54,
+    clone = Linux + 55,
+    fork = Linux + 56,
+    execve = Linux + 57,
+    exit = Linux + 58,
+    wait4 = Linux + 59,
+    kill = Linux + 60,
+    uname = Linux + 61,
+    semget = Linux + 62,
+    semop = Linux + 63,
+    semctl = Linux + 64,
+    shmdt = Linux + 65,
+    msgget = Linux + 66,
+    msgsnd = Linux + 67,
+    msgrcv = Linux + 68,
+    msgctl = Linux + 69,
+    fcntl = Linux + 70,
+    flock = Linux + 71,
+    fsync = Linux + 72,
+    fdatasync = Linux + 73,
+    truncate = Linux + 74,
+    ftruncate = Linux + 75,
+    getdents = Linux + 76,
+    getcwd = Linux + 77,
+    chdir = Linux + 78,
+    fchdir = Linux + 79,
+    rename = Linux + 80,
+    mkdir = Linux + 81,
+    rmdir = Linux + 82,
+    creat = Linux + 83,
+    link = Linux + 84,
+    unlink = Linux + 85,
+    symlink = Linux + 86,
+    readlink = Linux + 87,
+    chmod = Linux + 88,
+    fchmod = Linux + 89,
+    chown = Linux + 90,
+    fchown = Linux + 91,
+    lchown = Linux + 92,
+    umask = Linux + 93,
+    gettimeofday = Linux + 94,
+    getrlimit = Linux + 95,
+    getrusage = Linux + 96,
+    sysinfo = Linux + 97,
+    times = Linux + 98,
+    ptrace = Linux + 99,
+    getuid = Linux + 100,
+    syslog = Linux + 101,
+    getgid = Linux + 102,
+    setuid = Linux + 103,
+    setgid = Linux + 104,
+    geteuid = Linux + 105,
+    getegid = Linux + 106,
+    setpgid = Linux + 107,
+    getppid = Linux + 108,
+    getpgrp = Linux + 109,
+    setsid = Linux + 110,
+    setreuid = Linux + 111,
+    setregid = Linux + 112,
+    getgroups = Linux + 113,
+    setgroups = Linux + 114,
+    setresuid = Linux + 115,
+    getresuid = Linux + 116,
+    setresgid = Linux + 117,
+    getresgid = Linux + 118,
+    getpgid = Linux + 119,
+    setfsuid = Linux + 120,
+    setfsgid = Linux + 121,
+    getsid = Linux + 122,
+    capget = Linux + 123,
+    capset = Linux + 124,
+    rt_sigpending = Linux + 125,
+    rt_sigtimedwait = Linux + 126,
+    rt_sigqueueinfo = Linux + 127,
+    rt_sigsuspend = Linux + 128,
+    sigaltstack = Linux + 129,
+    utime = Linux + 130,
+    mknod = Linux + 131,
+    personality = Linux + 132,
+    ustat = Linux + 133,
+    statfs = Linux + 134,
+    fstatfs = Linux + 135,
+    sysfs = Linux + 136,
+    getpriority = Linux + 137,
+    setpriority = Linux + 138,
+    sched_setparam = Linux + 139,
+    sched_getparam = Linux + 140,
+    sched_setscheduler = Linux + 141,
+    sched_getscheduler = Linux + 142,
+    sched_get_priority_max = Linux + 143,
+    sched_get_priority_min = Linux + 144,
+    sched_rr_get_interval = Linux + 145,
+    mlock = Linux + 146,
+    munlock = Linux + 147,
+    mlockall = Linux + 148,
+    munlockall = Linux + 149,
+    vhangup = Linux + 150,
+    pivot_root = Linux + 151,
+    _sysctl = Linux + 152,
+    prctl = Linux + 153,
+    adjtimex = Linux + 154,
+    setrlimit = Linux + 155,
+    chroot = Linux + 156,
+    sync = Linux + 157,
+    acct = Linux + 158,
+    settimeofday = Linux + 159,
+    mount = Linux + 160,
+    umount2 = Linux + 161,
+    swapon = Linux + 162,
+    swapoff = Linux + 163,
+    reboot = Linux + 164,
+    sethostname = Linux + 165,
+    setdomainname = Linux + 166,
+    create_module = Linux + 167,
+    init_module = Linux + 168,
+    delete_module = Linux + 169,
+    get_kernel_syms = Linux + 170,
+    query_module = Linux + 171,
+    quotactl = Linux + 172,
+    nfsservctl = Linux + 173,
+    getpmsg = Linux + 174,
+    putpmsg = Linux + 175,
+    afs_syscall = Linux + 176,
+    reserved177 = Linux + 177,
+    gettid = Linux + 178,
+    readahead = Linux + 179,
+    setxattr = Linux + 180,
+    lsetxattr = Linux + 181,
+    fsetxattr = Linux + 182,
+    getxattr = Linux + 183,
+    lgetxattr = Linux + 184,
+    fgetxattr = Linux + 185,
+    listxattr = Linux + 186,
+    llistxattr = Linux + 187,
+    flistxattr = Linux + 188,
+    removexattr = Linux + 189,
+    lremovexattr = Linux + 190,
+    fremovexattr = Linux + 191,
+    tkill = Linux + 192,
+    reserved193 = Linux + 193,
+    futex = Linux + 194,
+    sched_setaffinity = Linux + 195,
+    sched_getaffinity = Linux + 196,
+    cacheflush = Linux + 197,
+    cachectl = Linux + 198,
+    sysmips = Linux + 199,
+    io_setup = Linux + 200,
+    io_destroy = Linux + 201,
+    io_getevents = Linux + 202,
+    io_submit = Linux + 203,
+    io_cancel = Linux + 204,
+    exit_group = Linux + 205,
+    lookup_dcookie = Linux + 206,
+    epoll_create = Linux + 207,
+    epoll_ctl = Linux + 208,
+    epoll_wait = Linux + 209,
+    remap_file_pages = Linux + 210,
+    rt_sigreturn = Linux + 211,
+    set_tid_address = Linux + 212,
+    restart_syscall = Linux + 213,
+    semtimedop = Linux + 214,
+    fadvise64 = Linux + 215,
+    timer_create = Linux + 216,
+    timer_settime = Linux + 217,
+    timer_gettime = Linux + 218,
+    timer_getoverrun = Linux + 219,
+    timer_delete = Linux + 220,
+    clock_settime = Linux + 221,
+    clock_gettime = Linux + 222,
+    clock_getres = Linux + 223,
+    clock_nanosleep = Linux + 224,
+    tgkill = Linux + 225,
+    utimes = Linux + 226,
+    mbind = Linux + 227,
+    get_mempolicy = Linux + 228,
+    set_mempolicy = Linux + 229,
+    mq_open = Linux + 230,
+    mq_unlink = Linux + 231,
+    mq_timedsend = Linux + 232,
+    mq_timedreceive = Linux + 233,
+    mq_notify = Linux + 234,
+    mq_getsetattr = Linux + 235,
+    vserver = Linux + 236,
+    waitid = Linux + 237,
+    add_key = Linux + 239,
+    request_key = Linux + 240,
+    keyctl = Linux + 241,
+    set_thread_area = Linux + 242,
+    inotify_init = Linux + 243,
+    inotify_add_watch = Linux + 244,
+    inotify_rm_watch = Linux + 245,
+    migrate_pages = Linux + 246,
+    openat = Linux + 247,
+    mkdirat = Linux + 248,
+    mknodat = Linux + 249,
+    fchownat = Linux + 250,
+    futimesat = Linux + 251,
+    newfstatat = Linux + 252,
+    unlinkat = Linux + 253,
+    renameat = Linux + 254,
+    linkat = Linux + 255,
+    symlinkat = Linux + 256,
+    readlinkat = Linux + 257,
+    fchmodat = Linux + 258,
+    faccessat = Linux + 259,
+    pselect6 = Linux + 260,
+    ppoll = Linux + 261,
+    unshare = Linux + 262,
+    splice = Linux + 263,
+    sync_file_range = Linux + 264,
+    tee = Linux + 265,
+    vmsplice = Linux + 266,
+    move_pages = Linux + 267,
+    set_robust_list = Linux + 268,
+    get_robust_list = Linux + 269,
+    kexec_load = Linux + 270,
+    getcpu = Linux + 271,
+    epoll_pwait = Linux + 272,
+    ioprio_set = Linux + 273,
+    ioprio_get = Linux + 274,
+    utimensat = Linux + 275,
+    signalfd = Linux + 276,
+    timerfd = Linux + 277,
+    eventfd = Linux + 278,
+    fallocate = Linux + 279,
+    timerfd_create = Linux + 280,
+    timerfd_settime = Linux + 281,
+    timerfd_gettime = Linux + 282,
+    signalfd4 = Linux + 283,
+    eventfd2 = Linux + 284,
+    epoll_create1 = Linux + 285,
+    dup3 = Linux + 286,
+    pipe2 = Linux + 287,
+    inotify_init1 = Linux + 288,
+    preadv = Linux + 289,
+    pwritev = Linux + 290,
+    rt_tgsigqueueinfo = Linux + 291,
+    perf_event_open = Linux + 292,
+    accept4 = Linux + 293,
+    recvmmsg = Linux + 294,
+    fanotify_init = Linux + 295,
+    fanotify_mark = Linux + 296,
+    prlimit64 = Linux + 297,
+    name_to_handle_at = Linux + 298,
+    open_by_handle_at = Linux + 299,
+    clock_adjtime = Linux + 300,
+    syncfs = Linux + 301,
+    sendmmsg = Linux + 302,
+    setns = Linux + 303,
+    process_vm_readv = Linux + 304,
+    process_vm_writev = Linux + 305,
+    kcmp = Linux + 306,
+    finit_module = Linux + 307,
+    getdents64 = Linux + 308,
+    sched_setattr = Linux + 309,
+    sched_getattr = Linux + 310,
+    renameat2 = Linux + 311,
+    seccomp = Linux + 312,
+    getrandom = Linux + 313,
+    memfd_create = Linux + 314,
+    bpf = Linux + 315,
+    execveat = Linux + 316,
+    userfaultfd = Linux + 317,
+    membarrier = Linux + 318,
+    mlock2 = Linux + 319,
+    copy_file_range = Linux + 320,
+    preadv2 = Linux + 321,
+    pwritev2 = Linux + 322,
+    pkey_mprotect = Linux + 323,
+    pkey_alloc = Linux + 324,
+    pkey_free = Linux + 325,
+    statx = Linux + 326,
+    rseq = Linux + 327,
+    io_pgetevents = Linux + 328,
+    pidfd_send_signal = Linux + 424,
+    io_uring_setup = Linux + 425,
+    io_uring_enter = Linux + 426,
+    io_uring_register = Linux + 427,
+    open_tree = Linux + 428,
+    move_mount = Linux + 429,
+    fsopen = Linux + 430,
+    fsconfig = Linux + 431,
+    fsmount = Linux + 432,
+    fspick = Linux + 433,
+    pidfd_open = Linux + 434,
+    clone3 = Linux + 435,
+    close_range = Linux + 436,
+    openat2 = Linux + 437,
+    pidfd_getfd = Linux + 438,
+    faccessat2 = Linux + 439,
+    process_madvise = Linux + 440,
+    epoll_pwait2 = Linux + 441,
+    mount_setattr = Linux + 442,
+    landlock_create_ruleset = Linux + 444,
+    landlock_add_rule = Linux + 445,
+    landlock_restrict_self = Linux + 446,
+};
+
 pub const PowerPC = enum(usize) {
     restart_syscall = 0,
     exit = 1,
lib/std/os/linux/tls.zig
@@ -48,7 +48,7 @@ const TLSVariant = enum {
 };
 
 const tls_variant = switch (native_arch) {
-    .arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI,
+    .arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI,
     .x86_64, .x86, .sparc64 => TLSVariant.VariantII,
     else => @compileError("undefined tls_variant for this architecture"),
 };
@@ -64,7 +64,7 @@ const tls_tcb_size = switch (native_arch) {
 
 // Controls if the TP points to the end of the TCB instead of its beginning
 const tls_tp_points_past_tcb = switch (native_arch) {
-    .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => true,
+    .riscv32, .riscv64, .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => true,
     else => false,
 };
 
@@ -72,12 +72,12 @@ const tls_tp_points_past_tcb = switch (native_arch) {
 // make the generated code more efficient
 
 const tls_tp_offset = switch (native_arch) {
-    .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => 0x7000,
+    .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => 0x7000,
     else => 0,
 };
 
 const tls_dtv_offset = switch (native_arch) {
-    .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => 0x8000,
+    .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => 0x8000,
     .riscv32, .riscv64 => 0x800,
     else => 0,
 };
@@ -156,7 +156,7 @@ pub fn setThreadPointer(addr: usize) void {
                 : [addr] "r" (addr),
             );
         },
-        .mips, .mipsel => {
+        .mips, .mipsel, .mips64, .mips64el => {
             const rc = std.os.linux.syscall1(.set_thread_area, addr);
             assert(rc == 0);
         },
lib/std/os/linux.zig
@@ -40,6 +40,7 @@ const arch_bits = switch (native_arch) {
     .riscv64 => @import("linux/riscv64.zig"),
     .sparc64 => @import("linux/sparc64.zig"),
     .mips, .mipsel => @import("linux/mips.zig"),
+    .mips64, .mips64el => @import("linux/mips64.zig"),
     .powerpc => @import("linux/powerpc.zig"),
     .powerpc64, .powerpc64le => @import("linux/powerpc64.zig"),
     else => struct {},
@@ -101,6 +102,7 @@ pub const SYS = switch (@import("builtin").cpu.arch) {
     .riscv64 => syscalls.RiscV64,
     .sparc64 => syscalls.Sparc64,
     .mips, .mipsel => syscalls.Mips,
+    .mips64, .mips64el => syscalls.Mips64,
     .powerpc => syscalls.PowerPC,
     .powerpc64, .powerpc64le => syscalls.PowerPC64,
     else => @compileError("The Zig Standard Library is missing syscall definitions for the target CPU architecture"),
lib/std/start.zig
@@ -327,7 +327,7 @@ fn _start() callconv(.Naked) noreturn {
                     : [argc] "={sp}" (-> [*]usize),
                 );
             },
-            .mips, .mipsel => {
+            .mips, .mipsel, .mips64, .mips64el => {
                 // The lr is already zeroed on entry, as specified by the ABI.
                 argc_argv_ptr = asm volatile (
                     \\ move $fp, $0
lib/c.zig
@@ -354,7 +354,7 @@ fn clone() callconv(.Naked) void {
                 \\    ecall
             );
         },
-        .mips, .mipsel => {
+        .mips, .mipsel, .mips64, .mips64el => {
             // __clone(func, stack, flags, arg, ptid, tls, ctid)
             //            3,     4,     5,   6,    7,   8,    9