| author | |
| committer | |
| log | 7f249937727fd58b66c00b53338e99bd8bf45e5b |
| tree | 6670c8d2cd19e3f32884b72f9e7041be5bf67adf |
| parent | c1f71963a9b8c913acee0fc167e0a4ecdecd2890 |
6 files changed, 777 insertions(+), 7 deletions(-)
lib/c.zig+1-1| ... | ... | @@ -354,7 +354,7 @@ fn clone() callconv(.Naked) void { |
| 354 | 354 | \\ ecall |
| 355 | 355 | ); |
| 356 | 356 | }, |
| 357 | .mips, .mipsel => { | |
| 357 | .mips, .mipsel, .mips64, .mips64el => { | |
| 358 | 358 | // __clone(func, stack, flags, arg, ptid, tls, ctid) |
| 359 | 359 | // 3, 4, 5, 6, 7, 8, 9 |
| 360 | 360 |
lib/std/os/linux.zig+2| ... | ... | @@ -40,6 +40,7 @@ const arch_bits = switch (native_arch) { |
| 40 | 40 | .riscv64 => @import("linux/riscv64.zig"), |
| 41 | 41 | .sparc64 => @import("linux/sparc64.zig"), |
| 42 | 42 | .mips, .mipsel => @import("linux/mips.zig"), |
| 43 | .mips64, .mips64el => @import("linux/mips64.zig"), | |
| 43 | 44 | .powerpc => @import("linux/powerpc.zig"), |
| 44 | 45 | .powerpc64, .powerpc64le => @import("linux/powerpc64.zig"), |
| 45 | 46 | else => struct {}, |
| ... | ... | @@ -101,6 +102,7 @@ pub const SYS = switch (@import("builtin").cpu.arch) { |
| 101 | 102 | .riscv64 => syscalls.RiscV64, |
| 102 | 103 | .sparc64 => syscalls.Sparc64, |
| 103 | 104 | .mips, .mipsel => syscalls.Mips, |
| 105 | .mips64, .mips64el => syscalls.Mips64, | |
| 104 | 106 | .powerpc => syscalls.PowerPC, |
| 105 | 107 | .powerpc64, .powerpc64le => syscalls.PowerPC64, |
| 106 | 108 | else => @compileError("The Zig Standard Library is missing syscall definitions for the target CPU architecture"), |
lib/std/os/linux/mips64.zig created+413| ... | ... | @@ -0,0 +1,413 @@ |
| 1 | const std = @import("../../std.zig"); | |
| 2 | const maxInt = std.math.maxInt; | |
| 3 | const linux = std.os.linux; | |
| 4 | const SYS = linux.SYS; | |
| 5 | const socklen_t = linux.socklen_t; | |
| 6 | const iovec = std.os.iovec; | |
| 7 | const iovec_const = std.os.iovec_const; | |
| 8 | const uid_t = linux.uid_t; | |
| 9 | const gid_t = linux.gid_t; | |
| 10 | const pid_t = linux.pid_t; | |
| 11 | const sockaddr = linux.sockaddr; | |
| 12 | const timespec = linux.timespec; | |
| 13 | ||
| 14 | pub fn syscall0(number: SYS) usize { | |
| 15 | return asm volatile ( | |
| 16 | \\ syscall | |
| 17 | \\ blez $7, 1f | |
| 18 | \\ dsubu $2, $0, $2 | |
| 19 | \\ 1: | |
| 20 | : [ret] "={$2}" (-> usize), | |
| 21 | : [number] "{$2}" (@enumToInt(number)), | |
| 22 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 23 | ); | |
| 24 | } | |
| 25 | ||
| 26 | pub fn syscall_pipe(fd: *[2]i32) usize { | |
| 27 | return asm volatile ( | |
| 28 | \\ .set noat | |
| 29 | \\ .set noreorder | |
| 30 | \\ syscall | |
| 31 | \\ blez $7, 1f | |
| 32 | \\ nop | |
| 33 | \\ b 2f | |
| 34 | \\ subu $2, $0, $2 | |
| 35 | \\ 1: | |
| 36 | \\ sw $2, 0($4) | |
| 37 | \\ sw $3, 4($4) | |
| 38 | \\ 2: | |
| 39 | : [ret] "={$2}" (-> usize), | |
| 40 | : [number] "{$2}" (@enumToInt(SYS.pipe)), | |
| 41 | [fd] "{$4}" (fd), | |
| 42 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 43 | ); | |
| 44 | } | |
| 45 | ||
| 46 | pub fn syscall1(number: SYS, arg1: usize) usize { | |
| 47 | return asm volatile ( | |
| 48 | \\ syscall | |
| 49 | \\ blez $7, 1f | |
| 50 | \\ dsubu $2, $0, $2 | |
| 51 | \\ 1: | |
| 52 | : [ret] "={$2}" (-> usize), | |
| 53 | : [number] "{$2}" (@enumToInt(number)), | |
| 54 | [arg1] "{$4}" (arg1), | |
| 55 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 56 | ); | |
| 57 | } | |
| 58 | ||
| 59 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | |
| 60 | return asm volatile ( | |
| 61 | \\ syscall | |
| 62 | \\ blez $7, 1f | |
| 63 | \\ dsubu $2, $0, $2 | |
| 64 | \\ 1: | |
| 65 | : [ret] "={$2}" (-> usize), | |
| 66 | : [number] "{$2}" (@enumToInt(number)), | |
| 67 | [arg1] "{$4}" (arg1), | |
| 68 | [arg2] "{$5}" (arg2), | |
| 69 | : "$1", "$3", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 70 | ); | |
| 71 | } | |
| 72 | ||
| 73 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | |
| 74 | return asm volatile ( | |
| 75 | \\ syscall | |
| 76 | \\ blez $7, 1f | |
| 77 | \\ dsubu $2, $0, $2 | |
| 78 | \\ 1: | |
| 79 | : [ret] "={$2}" (-> usize), | |
| 80 | : [number] "{$2}" (@enumToInt(number)), | |
| 81 | [arg1] "{$4}" (arg1), | |
| 82 | [arg2] "{$5}" (arg2), | |
| 83 | [arg3] "{$6}" (arg3), | |
| 84 | : "$1", "$3", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 85 | ); | |
| 86 | } | |
| 87 | ||
| 88 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | |
| 89 | return asm volatile ( | |
| 90 | \\ syscall | |
| 91 | \\ blez $7, 1f | |
| 92 | \\ dsubu $2, $0, $2 | |
| 93 | \\ 1: | |
| 94 | : [ret] "={$2}" (-> usize), | |
| 95 | : [number] "{$2}" (@enumToInt(number)), | |
| 96 | [arg1] "{$4}" (arg1), | |
| 97 | [arg2] "{$5}" (arg2), | |
| 98 | [arg3] "{$6}" (arg3), | |
| 99 | [arg4] "{$7}" (arg4), | |
| 100 | : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 101 | ); | |
| 102 | } | |
| 103 | ||
| 104 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | |
| 105 | return asm volatile ( | |
| 106 | \\ syscall | |
| 107 | \\ blez $7, 1f | |
| 108 | \\ dsubu $2, $0, $2 | |
| 109 | \\ 1: | |
| 110 | : [ret] "={$2}" (-> usize), | |
| 111 | : [number] "{$2}" (@enumToInt(number)), | |
| 112 | [arg1] "{$4}" (arg1), | |
| 113 | [arg2] "{$5}" (arg2), | |
| 114 | [arg3] "{$6}" (arg3), | |
| 115 | [arg4] "{$7}" (arg4), | |
| 116 | [arg5] "{$8}" (arg5), | |
| 117 | : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 118 | ); | |
| 119 | } | |
| 120 | ||
| 121 | // NOTE: The o32 calling convention requires the callee to reserve 16 bytes for | |
| 122 | // the first four arguments even though they're passed in $a0-$a3. | |
| 123 | ||
| 124 | pub fn syscall6( | |
| 125 | number: SYS, | |
| 126 | arg1: usize, | |
| 127 | arg2: usize, | |
| 128 | arg3: usize, | |
| 129 | arg4: usize, | |
| 130 | arg5: usize, | |
| 131 | arg6: usize, | |
| 132 | ) usize { | |
| 133 | return asm volatile ( | |
| 134 | \\ syscall | |
| 135 | \\ blez $7, 1f | |
| 136 | \\ dsubu $2, $0, $2 | |
| 137 | \\ 1: | |
| 138 | : [ret] "={$2}" (-> usize), | |
| 139 | : [number] "{$2}" (@enumToInt(number)), | |
| 140 | [arg1] "{$4}" (arg1), | |
| 141 | [arg2] "{$5}" (arg2), | |
| 142 | [arg3] "{$6}" (arg3), | |
| 143 | [arg4] "{$7}" (arg4), | |
| 144 | [arg5] "{$8}" (arg5), | |
| 145 | [arg6] "{$9}" (arg6), | |
| 146 | : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 147 | ); | |
| 148 | } | |
| 149 | ||
| 150 | pub fn syscall7( | |
| 151 | number: SYS, | |
| 152 | arg1: usize, | |
| 153 | arg2: usize, | |
| 154 | arg3: usize, | |
| 155 | arg4: usize, | |
| 156 | arg5: usize, | |
| 157 | arg6: usize, | |
| 158 | arg7: usize, | |
| 159 | ) usize { | |
| 160 | return asm volatile ( | |
| 161 | \\ syscall | |
| 162 | \\ blez $7, 1f | |
| 163 | \\ dsubu $2, $0, $2 | |
| 164 | \\ 1: | |
| 165 | : [ret] "={$2}" (-> usize), | |
| 166 | : [number] "{$2}" (@enumToInt(number)), | |
| 167 | [arg1] "{$4}" (arg1), | |
| 168 | [arg2] "{$5}" (arg2), | |
| 169 | [arg3] "{$6}" (arg3), | |
| 170 | [arg4] "{$7}" (arg4), | |
| 171 | [arg5] "{$8}" (arg5), | |
| 172 | [arg6] "{$9}" (arg6), | |
| 173 | [arg7] "{$10}" (arg7), | |
| 174 | : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 175 | ); | |
| 176 | } | |
| 177 | ||
| 178 | const CloneFn = *const fn (arg: usize) callconv(.C) u8; | |
| 179 | ||
| 180 | /// This matches the libc clone function. | |
| 181 | pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | |
| 182 | ||
| 183 | pub fn restore() callconv(.Naked) void { | |
| 184 | return asm volatile ("syscall" | |
| 185 | : | |
| 186 | : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn)), | |
| 187 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 188 | ); | |
| 189 | } | |
| 190 | ||
| 191 | pub fn restore_rt() callconv(.Naked) void { | |
| 192 | return asm volatile ("syscall" | |
| 193 | : | |
| 194 | : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn)), | |
| 195 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | |
| 196 | ); | |
| 197 | } | |
| 198 | ||
| 199 | pub const O = struct { | |
| 200 | pub const CREAT = 0o0400; | |
| 201 | pub const EXCL = 0o02000; | |
| 202 | pub const NOCTTY = 0o04000; | |
| 203 | pub const TRUNC = 0o01000; | |
| 204 | pub const APPEND = 0o0010; | |
| 205 | pub const NONBLOCK = 0o0200; | |
| 206 | pub const DSYNC = 0o0020; | |
| 207 | pub const SYNC = 0o040020; | |
| 208 | pub const RSYNC = 0o040020; | |
| 209 | pub const DIRECTORY = 0o0200000; | |
| 210 | pub const NOFOLLOW = 0o0400000; | |
| 211 | pub const CLOEXEC = 0o02000000; | |
| 212 | ||
| 213 | pub const ASYNC = 0o010000; | |
| 214 | pub const DIRECT = 0o0100000; | |
| 215 | pub const LARGEFILE = 0o020000; | |
| 216 | pub const NOATIME = 0o01000000; | |
| 217 | pub const PATH = 0o010000000; | |
| 218 | pub const TMPFILE = 0o020200000; | |
| 219 | pub const NDELAY = NONBLOCK; | |
| 220 | }; | |
| 221 | ||
| 222 | pub const F = struct { | |
| 223 | pub const DUPFD = 0; | |
| 224 | pub const GETFD = 1; | |
| 225 | pub const SETFD = 2; | |
| 226 | pub const GETFL = 3; | |
| 227 | pub const SETFL = 4; | |
| 228 | ||
| 229 | pub const SETOWN = 24; | |
| 230 | pub const GETOWN = 23; | |
| 231 | pub const SETSIG = 10; | |
| 232 | pub const GETSIG = 11; | |
| 233 | ||
| 234 | pub const GETLK = 33; | |
| 235 | pub const SETLK = 34; | |
| 236 | pub const SETLKW = 35; | |
| 237 | ||
| 238 | pub const RDLCK = 0; | |
| 239 | pub const WRLCK = 1; | |
| 240 | pub const UNLCK = 2; | |
| 241 | ||
| 242 | pub const SETOWN_EX = 15; | |
| 243 | pub const GETOWN_EX = 16; | |
| 244 | ||
| 245 | pub const GETOWNER_UIDS = 17; | |
| 246 | }; | |
| 247 | ||
| 248 | pub const LOCK = struct { | |
| 249 | pub const SH = 1; | |
| 250 | pub const EX = 2; | |
| 251 | pub const UN = 8; | |
| 252 | pub const NB = 4; | |
| 253 | }; | |
| 254 | ||
| 255 | pub const MMAP2_UNIT = 4096; | |
| 256 | ||
| 257 | pub const MAP = struct { | |
| 258 | pub const NORESERVE = 0x0400; | |
| 259 | pub const GROWSDOWN = 0x1000; | |
| 260 | pub const DENYWRITE = 0x2000; | |
| 261 | pub const EXECUTABLE = 0x4000; | |
| 262 | pub const LOCKED = 0x8000; | |
| 263 | pub const @"32BIT" = 0x40; | |
| 264 | }; | |
| 265 | ||
| 266 | pub const VDSO = struct { | |
| 267 | pub const CGT_SYM = "__kernel_clock_gettime"; | |
| 268 | pub const CGT_VER = "LINUX_2.6.39"; | |
| 269 | }; | |
| 270 | ||
| 271 | pub const Flock = extern struct { | |
| 272 | type: i16, | |
| 273 | whence: i16, | |
| 274 | __pad0: [4]u8, | |
| 275 | start: off_t, | |
| 276 | len: off_t, | |
| 277 | pid: pid_t, | |
| 278 | __unused: [4]u8, | |
| 279 | }; | |
| 280 | ||
| 281 | pub const msghdr = extern struct { | |
| 282 | name: ?*sockaddr, | |
| 283 | namelen: socklen_t, | |
| 284 | iov: [*]iovec, | |
| 285 | iovlen: i32, | |
| 286 | control: ?*anyopaque, | |
| 287 | controllen: socklen_t, | |
| 288 | flags: i32, | |
| 289 | }; | |
| 290 | ||
| 291 | pub const msghdr_const = extern struct { | |
| 292 | name: ?*const sockaddr, | |
| 293 | namelen: socklen_t, | |
| 294 | iov: [*]const iovec_const, | |
| 295 | iovlen: i32, | |
| 296 | control: ?*const anyopaque, | |
| 297 | controllen: socklen_t, | |
| 298 | flags: i32, | |
| 299 | }; | |
| 300 | ||
| 301 | pub const blksize_t = i32; | |
| 302 | pub const nlink_t = u32; | |
| 303 | pub const time_t = i32; | |
| 304 | pub const mode_t = u32; | |
| 305 | pub const off_t = i64; | |
| 306 | pub const ino_t = u64; | |
| 307 | pub const dev_t = u64; | |
| 308 | pub const blkcnt_t = i64; | |
| 309 | ||
| 310 | // The `stat` definition used by the Linux kernel. | |
| 311 | pub const Stat = extern struct { | |
| 312 | dev: u32, | |
| 313 | __pad0: [3]u32, // Reserved for st_dev expansion | |
| 314 | ino: ino_t, | |
| 315 | mode: mode_t, | |
| 316 | nlink: nlink_t, | |
| 317 | uid: uid_t, | |
| 318 | gid: gid_t, | |
| 319 | rdev: u32, | |
| 320 | __pad1: [3]u32, | |
| 321 | size: off_t, | |
| 322 | atim: timespec, | |
| 323 | mtim: timespec, | |
| 324 | ctim: timespec, | |
| 325 | blksize: blksize_t, | |
| 326 | __pad3: u32, | |
| 327 | blocks: blkcnt_t, | |
| 328 | __pad4: [14]usize, | |
| 329 | ||
| 330 | pub fn atime(self: @This()) timespec { | |
| 331 | return self.atim; | |
| 332 | } | |
| 333 | ||
| 334 | pub fn mtime(self: @This()) timespec { | |
| 335 | return self.mtim; | |
| 336 | } | |
| 337 | ||
| 338 | pub fn ctime(self: @This()) timespec { | |
| 339 | return self.ctim; | |
| 340 | } | |
| 341 | }; | |
| 342 | ||
| 343 | pub const timeval = extern struct { | |
| 344 | tv_sec: isize, | |
| 345 | tv_usec: isize, | |
| 346 | }; | |
| 347 | ||
| 348 | pub const timezone = extern struct { | |
| 349 | tz_minuteswest: i32, | |
| 350 | tz_dsttime: i32, | |
| 351 | }; | |
| 352 | ||
| 353 | pub const Elf_Symndx = u32; | |
| 354 | ||
| 355 | pub const rlimit_resource = enum(c_int) { | |
| 356 | /// Per-process CPU limit, in seconds. | |
| 357 | CPU, | |
| 358 | ||
| 359 | /// Largest file that can be created, in bytes. | |
| 360 | FSIZE, | |
| 361 | ||
| 362 | /// Maximum size of data segment, in bytes. | |
| 363 | DATA, | |
| 364 | ||
| 365 | /// Maximum size of stack segment, in bytes. | |
| 366 | STACK, | |
| 367 | ||
| 368 | /// Largest core file that can be created, in bytes. | |
| 369 | CORE, | |
| 370 | ||
| 371 | /// Number of open files. | |
| 372 | NOFILE, | |
| 373 | ||
| 374 | /// Address space limit. | |
| 375 | AS, | |
| 376 | ||
| 377 | /// Largest resident set size, in bytes. | |
| 378 | /// This affects swapping; processes that are exceeding their | |
| 379 | /// resident set size will be more likely to have physical memory | |
| 380 | /// taken from them. | |
| 381 | RSS, | |
| 382 | ||
| 383 | /// Number of processes. | |
| 384 | NPROC, | |
| 385 | ||
| 386 | /// Locked-in-memory address space. | |
| 387 | MEMLOCK, | |
| 388 | ||
| 389 | /// Maximum number of file locks. | |
| 390 | LOCKS, | |
| 391 | ||
| 392 | /// Maximum number of pending signals. | |
| 393 | SIGPENDING, | |
| 394 | ||
| 395 | /// Maximum bytes in POSIX message queues. | |
| 396 | MSGQUEUE, | |
| 397 | ||
| 398 | /// Maximum nice priority allowed to raise to. | |
| 399 | /// Nice levels 19 .. -20 correspond to 0 .. 39 | |
| 400 | /// values of this resource limit. | |
| 401 | NICE, | |
| 402 | ||
| 403 | /// Maximum realtime priority allowed for non-priviledged | |
| 404 | /// processes. | |
| 405 | RTPRIO, | |
| 406 | ||
| 407 | /// Maximum CPU time in µs that a process scheduled under a real-time | |
| 408 | /// scheduling policy may consume without making a blocking system | |
| 409 | /// call before being forcibly descheduled. | |
| 410 | RTTIME, | |
| 411 | ||
| 412 | _, | |
| 413 | }; |
lib/std/os/linux/syscalls.zig+355| ... | ... | @@ -2032,6 +2032,361 @@ pub const Mips = enum(usize) { |
| 2032 | 2032 | set_mempolicy_home_node = Linux + 450, |
| 2033 | 2033 | }; |
| 2034 | 2034 | |
| 2035 | pub const Mips64 = enum(usize) { | |
| 2036 | pub const Linux = 5000; | |
| 2037 | ||
| 2038 | read = Linux + 0, | |
| 2039 | write = Linux + 1, | |
| 2040 | open = Linux + 2, | |
| 2041 | close = Linux + 3, | |
| 2042 | stat = Linux + 4, | |
| 2043 | fstat = Linux + 5, | |
| 2044 | lstat = Linux + 6, | |
| 2045 | poll = Linux + 7, | |
| 2046 | lseek = Linux + 8, | |
| 2047 | mmap = Linux + 9, | |
| 2048 | mprotect = Linux + 10, | |
| 2049 | munmap = Linux + 11, | |
| 2050 | brk = Linux + 12, | |
| 2051 | rt_sigaction = Linux + 13, | |
| 2052 | rt_sigprocmask = Linux + 14, | |
| 2053 | ioctl = Linux + 15, | |
| 2054 | pread64 = Linux + 16, | |
| 2055 | pwrite64 = Linux + 17, | |
| 2056 | readv = Linux + 18, | |
| 2057 | writev = Linux + 19, | |
| 2058 | access = Linux + 20, | |
| 2059 | pipe = Linux + 21, | |
| 2060 | select = Linux + 22, | |
| 2061 | sched_yield = Linux + 23, | |
| 2062 | mremap = Linux + 24, | |
| 2063 | msync = Linux + 25, | |
| 2064 | mincore = Linux + 26, | |
| 2065 | madvise = Linux + 27, | |
| 2066 | shmget = Linux + 28, | |
| 2067 | shmat = Linux + 29, | |
| 2068 | shmctl = Linux + 30, | |
| 2069 | dup = Linux + 31, | |
| 2070 | dup2 = Linux + 32, | |
| 2071 | pause = Linux + 33, | |
| 2072 | nanosleep = Linux + 34, | |
| 2073 | getitimer = Linux + 35, | |
| 2074 | alarm = Linux + 36, | |
| 2075 | setitimer = Linux + 37, | |
| 2076 | getpid = Linux + 38, | |
| 2077 | sendfile = Linux + 39, | |
| 2078 | socket = Linux + 40, | |
| 2079 | connect = Linux + 41, | |
| 2080 | accept = Linux + 42, | |
| 2081 | sendto = Linux + 43, | |
| 2082 | recvfrom = Linux + 44, | |
| 2083 | sendmsg = Linux + 45, | |
| 2084 | recvmsg = Linux + 46, | |
| 2085 | shutdown = Linux + 47, | |
| 2086 | bind = Linux + 48, | |
| 2087 | listen = Linux + 49, | |
| 2088 | getsockname = Linux + 50, | |
| 2089 | getpeername = Linux + 51, | |
| 2090 | socketpair = Linux + 52, | |
| 2091 | setsockopt = Linux + 53, | |
| 2092 | getsockopt = Linux + 54, | |
| 2093 | clone = Linux + 55, | |
| 2094 | fork = Linux + 56, | |
| 2095 | execve = Linux + 57, | |
| 2096 | exit = Linux + 58, | |
| 2097 | wait4 = Linux + 59, | |
| 2098 | kill = Linux + 60, | |
| 2099 | uname = Linux + 61, | |
| 2100 | semget = Linux + 62, | |
| 2101 | semop = Linux + 63, | |
| 2102 | semctl = Linux + 64, | |
| 2103 | shmdt = Linux + 65, | |
| 2104 | msgget = Linux + 66, | |
| 2105 | msgsnd = Linux + 67, | |
| 2106 | msgrcv = Linux + 68, | |
| 2107 | msgctl = Linux + 69, | |
| 2108 | fcntl = Linux + 70, | |
| 2109 | flock = Linux + 71, | |
| 2110 | fsync = Linux + 72, | |
| 2111 | fdatasync = Linux + 73, | |
| 2112 | truncate = Linux + 74, | |
| 2113 | ftruncate = Linux + 75, | |
| 2114 | getdents = Linux + 76, | |
| 2115 | getcwd = Linux + 77, | |
| 2116 | chdir = Linux + 78, | |
| 2117 | fchdir = Linux + 79, | |
| 2118 | rename = Linux + 80, | |
| 2119 | mkdir = Linux + 81, | |
| 2120 | rmdir = Linux + 82, | |
| 2121 | creat = Linux + 83, | |
| 2122 | link = Linux + 84, | |
| 2123 | unlink = Linux + 85, | |
| 2124 | symlink = Linux + 86, | |
| 2125 | readlink = Linux + 87, | |
| 2126 | chmod = Linux + 88, | |
| 2127 | fchmod = Linux + 89, | |
| 2128 | chown = Linux + 90, | |
| 2129 | fchown = Linux + 91, | |
| 2130 | lchown = Linux + 92, | |
| 2131 | umask = Linux + 93, | |
| 2132 | gettimeofday = Linux + 94, | |
| 2133 | getrlimit = Linux + 95, | |
| 2134 | getrusage = Linux + 96, | |
| 2135 | sysinfo = Linux + 97, | |
| 2136 | times = Linux + 98, | |
| 2137 | ptrace = Linux + 99, | |
| 2138 | getuid = Linux + 100, | |
| 2139 | syslog = Linux + 101, | |
| 2140 | getgid = Linux + 102, | |
| 2141 | setuid = Linux + 103, | |
| 2142 | setgid = Linux + 104, | |
| 2143 | geteuid = Linux + 105, | |
| 2144 | getegid = Linux + 106, | |
| 2145 | setpgid = Linux + 107, | |
| 2146 | getppid = Linux + 108, | |
| 2147 | getpgrp = Linux + 109, | |
| 2148 | setsid = Linux + 110, | |
| 2149 | setreuid = Linux + 111, | |
| 2150 | setregid = Linux + 112, | |
| 2151 | getgroups = Linux + 113, | |
| 2152 | setgroups = Linux + 114, | |
| 2153 | setresuid = Linux + 115, | |
| 2154 | getresuid = Linux + 116, | |
| 2155 | setresgid = Linux + 117, | |
| 2156 | getresgid = Linux + 118, | |
| 2157 | getpgid = Linux + 119, | |
| 2158 | setfsuid = Linux + 120, | |
| 2159 | setfsgid = Linux + 121, | |
| 2160 | getsid = Linux + 122, | |
| 2161 | capget = Linux + 123, | |
| 2162 | capset = Linux + 124, | |
| 2163 | rt_sigpending = Linux + 125, | |
| 2164 | rt_sigtimedwait = Linux + 126, | |
| 2165 | rt_sigqueueinfo = Linux + 127, | |
| 2166 | rt_sigsuspend = Linux + 128, | |
| 2167 | sigaltstack = Linux + 129, | |
| 2168 | utime = Linux + 130, | |
| 2169 | mknod = Linux + 131, | |
| 2170 | personality = Linux + 132, | |
| 2171 | ustat = Linux + 133, | |
| 2172 | statfs = Linux + 134, | |
| 2173 | fstatfs = Linux + 135, | |
| 2174 | sysfs = Linux + 136, | |
| 2175 | getpriority = Linux + 137, | |
| 2176 | setpriority = Linux + 138, | |
| 2177 | sched_setparam = Linux + 139, | |
| 2178 | sched_getparam = Linux + 140, | |
| 2179 | sched_setscheduler = Linux + 141, | |
| 2180 | sched_getscheduler = Linux + 142, | |
| 2181 | sched_get_priority_max = Linux + 143, | |
| 2182 | sched_get_priority_min = Linux + 144, | |
| 2183 | sched_rr_get_interval = Linux + 145, | |
| 2184 | mlock = Linux + 146, | |
| 2185 | munlock = Linux + 147, | |
| 2186 | mlockall = Linux + 148, | |
| 2187 | munlockall = Linux + 149, | |
| 2188 | vhangup = Linux + 150, | |
| 2189 | pivot_root = Linux + 151, | |
| 2190 | _sysctl = Linux + 152, | |
| 2191 | prctl = Linux + 153, | |
| 2192 | adjtimex = Linux + 154, | |
| 2193 | setrlimit = Linux + 155, | |
| 2194 | chroot = Linux + 156, | |
| 2195 | sync = Linux + 157, | |
| 2196 | acct = Linux + 158, | |
| 2197 | settimeofday = Linux + 159, | |
| 2198 | mount = Linux + 160, | |
| 2199 | umount2 = Linux + 161, | |
| 2200 | swapon = Linux + 162, | |
| 2201 | swapoff = Linux + 163, | |
| 2202 | reboot = Linux + 164, | |
| 2203 | sethostname = Linux + 165, | |
| 2204 | setdomainname = Linux + 166, | |
| 2205 | create_module = Linux + 167, | |
| 2206 | init_module = Linux + 168, | |
| 2207 | delete_module = Linux + 169, | |
| 2208 | get_kernel_syms = Linux + 170, | |
| 2209 | query_module = Linux + 171, | |
| 2210 | quotactl = Linux + 172, | |
| 2211 | nfsservctl = Linux + 173, | |
| 2212 | getpmsg = Linux + 174, | |
| 2213 | putpmsg = Linux + 175, | |
| 2214 | afs_syscall = Linux + 176, | |
| 2215 | reserved177 = Linux + 177, | |
| 2216 | gettid = Linux + 178, | |
| 2217 | readahead = Linux + 179, | |
| 2218 | setxattr = Linux + 180, | |
| 2219 | lsetxattr = Linux + 181, | |
| 2220 | fsetxattr = Linux + 182, | |
| 2221 | getxattr = Linux + 183, | |
| 2222 | lgetxattr = Linux + 184, | |
| 2223 | fgetxattr = Linux + 185, | |
| 2224 | listxattr = Linux + 186, | |
| 2225 | llistxattr = Linux + 187, | |
| 2226 | flistxattr = Linux + 188, | |
| 2227 | removexattr = Linux + 189, | |
| 2228 | lremovexattr = Linux + 190, | |
| 2229 | fremovexattr = Linux + 191, | |
| 2230 | tkill = Linux + 192, | |
| 2231 | reserved193 = Linux + 193, | |
| 2232 | futex = Linux + 194, | |
| 2233 | sched_setaffinity = Linux + 195, | |
| 2234 | sched_getaffinity = Linux + 196, | |
| 2235 | cacheflush = Linux + 197, | |
| 2236 | cachectl = Linux + 198, | |
| 2237 | sysmips = Linux + 199, | |
| 2238 | io_setup = Linux + 200, | |
| 2239 | io_destroy = Linux + 201, | |
| 2240 | io_getevents = Linux + 202, | |
| 2241 | io_submit = Linux + 203, | |
| 2242 | io_cancel = Linux + 204, | |
| 2243 | exit_group = Linux + 205, | |
| 2244 | lookup_dcookie = Linux + 206, | |
| 2245 | epoll_create = Linux + 207, | |
| 2246 | epoll_ctl = Linux + 208, | |
| 2247 | epoll_wait = Linux + 209, | |
| 2248 | remap_file_pages = Linux + 210, | |
| 2249 | rt_sigreturn = Linux + 211, | |
| 2250 | set_tid_address = Linux + 212, | |
| 2251 | restart_syscall = Linux + 213, | |
| 2252 | semtimedop = Linux + 214, | |
| 2253 | fadvise64 = Linux + 215, | |
| 2254 | timer_create = Linux + 216, | |
| 2255 | timer_settime = Linux + 217, | |
| 2256 | timer_gettime = Linux + 218, | |
| 2257 | timer_getoverrun = Linux + 219, | |
| 2258 | timer_delete = Linux + 220, | |
| 2259 | clock_settime = Linux + 221, | |
| 2260 | clock_gettime = Linux + 222, | |
| 2261 | clock_getres = Linux + 223, | |
| 2262 | clock_nanosleep = Linux + 224, | |
| 2263 | tgkill = Linux + 225, | |
| 2264 | utimes = Linux + 226, | |
| 2265 | mbind = Linux + 227, | |
| 2266 | get_mempolicy = Linux + 228, | |
| 2267 | set_mempolicy = Linux + 229, | |
| 2268 | mq_open = Linux + 230, | |
| 2269 | mq_unlink = Linux + 231, | |
| 2270 | mq_timedsend = Linux + 232, | |
| 2271 | mq_timedreceive = Linux + 233, | |
| 2272 | mq_notify = Linux + 234, | |
| 2273 | mq_getsetattr = Linux + 235, | |
| 2274 | vserver = Linux + 236, | |
| 2275 | waitid = Linux + 237, | |
| 2276 | add_key = Linux + 239, | |
| 2277 | request_key = Linux + 240, | |
| 2278 | keyctl = Linux + 241, | |
| 2279 | set_thread_area = Linux + 242, | |
| 2280 | inotify_init = Linux + 243, | |
| 2281 | inotify_add_watch = Linux + 244, | |
| 2282 | inotify_rm_watch = Linux + 245, | |
| 2283 | migrate_pages = Linux + 246, | |
| 2284 | openat = Linux + 247, | |
| 2285 | mkdirat = Linux + 248, | |
| 2286 | mknodat = Linux + 249, | |
| 2287 | fchownat = Linux + 250, | |
| 2288 | futimesat = Linux + 251, | |
| 2289 | newfstatat = Linux + 252, | |
| 2290 | unlinkat = Linux + 253, | |
| 2291 | renameat = Linux + 254, | |
| 2292 | linkat = Linux + 255, | |
| 2293 | symlinkat = Linux + 256, | |
| 2294 | readlinkat = Linux + 257, | |
| 2295 | fchmodat = Linux + 258, | |
| 2296 | faccessat = Linux + 259, | |
| 2297 | pselect6 = Linux + 260, | |
| 2298 | ppoll = Linux + 261, | |
| 2299 | unshare = Linux + 262, | |
| 2300 | splice = Linux + 263, | |
| 2301 | sync_file_range = Linux + 264, | |
| 2302 | tee = Linux + 265, | |
| 2303 | vmsplice = Linux + 266, | |
| 2304 | move_pages = Linux + 267, | |
| 2305 | set_robust_list = Linux + 268, | |
| 2306 | get_robust_list = Linux + 269, | |
| 2307 | kexec_load = Linux + 270, | |
| 2308 | getcpu = Linux + 271, | |
| 2309 | epoll_pwait = Linux + 272, | |
| 2310 | ioprio_set = Linux + 273, | |
| 2311 | ioprio_get = Linux + 274, | |
| 2312 | utimensat = Linux + 275, | |
| 2313 | signalfd = Linux + 276, | |
| 2314 | timerfd = Linux + 277, | |
| 2315 | eventfd = Linux + 278, | |
| 2316 | fallocate = Linux + 279, | |
| 2317 | timerfd_create = Linux + 280, | |
| 2318 | timerfd_settime = Linux + 281, | |
| 2319 | timerfd_gettime = Linux + 282, | |
| 2320 | signalfd4 = Linux + 283, | |
| 2321 | eventfd2 = Linux + 284, | |
| 2322 | epoll_create1 = Linux + 285, | |
| 2323 | dup3 = Linux + 286, | |
| 2324 | pipe2 = Linux + 287, | |
| 2325 | inotify_init1 = Linux + 288, | |
| 2326 | preadv = Linux + 289, | |
| 2327 | pwritev = Linux + 290, | |
| 2328 | rt_tgsigqueueinfo = Linux + 291, | |
| 2329 | perf_event_open = Linux + 292, | |
| 2330 | accept4 = Linux + 293, | |
| 2331 | recvmmsg = Linux + 294, | |
| 2332 | fanotify_init = Linux + 295, | |
| 2333 | fanotify_mark = Linux + 296, | |
| 2334 | prlimit64 = Linux + 297, | |
| 2335 | name_to_handle_at = Linux + 298, | |
| 2336 | open_by_handle_at = Linux + 299, | |
| 2337 | clock_adjtime = Linux + 300, | |
| 2338 | syncfs = Linux + 301, | |
| 2339 | sendmmsg = Linux + 302, | |
| 2340 | setns = Linux + 303, | |
| 2341 | process_vm_readv = Linux + 304, | |
| 2342 | process_vm_writev = Linux + 305, | |
| 2343 | kcmp = Linux + 306, | |
| 2344 | finit_module = Linux + 307, | |
| 2345 | getdents64 = Linux + 308, | |
| 2346 | sched_setattr = Linux + 309, | |
| 2347 | sched_getattr = Linux + 310, | |
| 2348 | renameat2 = Linux + 311, | |
| 2349 | seccomp = Linux + 312, | |
| 2350 | getrandom = Linux + 313, | |
| 2351 | memfd_create = Linux + 314, | |
| 2352 | bpf = Linux + 315, | |
| 2353 | execveat = Linux + 316, | |
| 2354 | userfaultfd = Linux + 317, | |
| 2355 | membarrier = Linux + 318, | |
| 2356 | mlock2 = Linux + 319, | |
| 2357 | copy_file_range = Linux + 320, | |
| 2358 | preadv2 = Linux + 321, | |
| 2359 | pwritev2 = Linux + 322, | |
| 2360 | pkey_mprotect = Linux + 323, | |
| 2361 | pkey_alloc = Linux + 324, | |
| 2362 | pkey_free = Linux + 325, | |
| 2363 | statx = Linux + 326, | |
| 2364 | rseq = Linux + 327, | |
| 2365 | io_pgetevents = Linux + 328, | |
| 2366 | pidfd_send_signal = Linux + 424, | |
| 2367 | io_uring_setup = Linux + 425, | |
| 2368 | io_uring_enter = Linux + 426, | |
| 2369 | io_uring_register = Linux + 427, | |
| 2370 | open_tree = Linux + 428, | |
| 2371 | move_mount = Linux + 429, | |
| 2372 | fsopen = Linux + 430, | |
| 2373 | fsconfig = Linux + 431, | |
| 2374 | fsmount = Linux + 432, | |
| 2375 | fspick = Linux + 433, | |
| 2376 | pidfd_open = Linux + 434, | |
| 2377 | clone3 = Linux + 435, | |
| 2378 | close_range = Linux + 436, | |
| 2379 | openat2 = Linux + 437, | |
| 2380 | pidfd_getfd = Linux + 438, | |
| 2381 | faccessat2 = Linux + 439, | |
| 2382 | process_madvise = Linux + 440, | |
| 2383 | epoll_pwait2 = Linux + 441, | |
| 2384 | mount_setattr = Linux + 442, | |
| 2385 | landlock_create_ruleset = Linux + 444, | |
| 2386 | landlock_add_rule = Linux + 445, | |
| 2387 | landlock_restrict_self = Linux + 446, | |
| 2388 | }; | |
| 2389 | ||
| 2035 | 2390 | pub const PowerPC = enum(usize) { |
| 2036 | 2391 | restart_syscall = 0, |
| 2037 | 2392 | exit = 1, |
lib/std/os/linux/tls.zig+5-5| ... | ... | @@ -48,7 +48,7 @@ const TLSVariant = enum { |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | const tls_variant = switch (native_arch) { |
| 51 | .arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI, | |
| 51 | .arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI, | |
| 52 | 52 | .x86_64, .x86, .sparc64 => TLSVariant.VariantII, |
| 53 | 53 | else => @compileError("undefined tls_variant for this architecture"), |
| 54 | 54 | }; |
| ... | ... | @@ -64,7 +64,7 @@ const tls_tcb_size = switch (native_arch) { |
| 64 | 64 | |
| 65 | 65 | // Controls if the TP points to the end of the TCB instead of its beginning |
| 66 | 66 | const tls_tp_points_past_tcb = switch (native_arch) { |
| 67 | .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => true, | |
| 67 | .riscv32, .riscv64, .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => true, | |
| 68 | 68 | else => false, |
| 69 | 69 | }; |
| 70 | 70 | |
| ... | ... | @@ -72,12 +72,12 @@ const tls_tp_points_past_tcb = switch (native_arch) { |
| 72 | 72 | // make the generated code more efficient |
| 73 | 73 | |
| 74 | 74 | const tls_tp_offset = switch (native_arch) { |
| 75 | .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => 0x7000, | |
| 75 | .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => 0x7000, | |
| 76 | 76 | else => 0, |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | 79 | const tls_dtv_offset = switch (native_arch) { |
| 80 | .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => 0x8000, | |
| 80 | .mips, .mipsel, .mips64, .mips64el, .powerpc, .powerpc64, .powerpc64le => 0x8000, | |
| 81 | 81 | .riscv32, .riscv64 => 0x800, |
| 82 | 82 | else => 0, |
| 83 | 83 | }; |
| ... | ... | @@ -156,7 +156,7 @@ pub fn setThreadPointer(addr: usize) void { |
| 156 | 156 | : [addr] "r" (addr), |
| 157 | 157 | ); |
| 158 | 158 | }, |
| 159 | .mips, .mipsel => { | |
| 159 | .mips, .mipsel, .mips64, .mips64el => { | |
| 160 | 160 | const rc = std.os.linux.syscall1(.set_thread_area, addr); |
| 161 | 161 | assert(rc == 0); |
| 162 | 162 | }, |
lib/std/start.zig+1-1| ... | ... | @@ -327,7 +327,7 @@ fn _start() callconv(.Naked) noreturn { |
| 327 | 327 | : [argc] "={sp}" (-> [*]usize), |
| 328 | 328 | ); |
| 329 | 329 | }, |
| 330 | .mips, .mipsel => { | |
| 330 | .mips, .mipsel, .mips64, .mips64el => { | |
| 331 | 331 | // The lr is already zeroed on entry, as specified by the ABI. |
| 332 | 332 | argc_argv_ptr = asm volatile ( |
| 333 | 333 | \\ move $fp, $0 |