| author | |
| committer | |
| log | 7534ac736727c69c7314fdf194ef6a0ec30216a7 |
| tree | 0351f45b66a2fb4e3aa69938c1b74c6b96fb6741 |
| parent | 6e6df110279701807fcf8c7fe8a9be71a66ae070 |
| signature |
This adds support to std, primarily for linux, to support the Alpha architecture.
closes #30940
closes #309268 files changed, 1039 insertions(+), 4 deletions(-)
lib/std/Thread.zig+2-2| ... | @@ -1217,8 +1217,8 @@ const LinuxThreadImpl = struct { | ... | @@ -1217,8 +1217,8 @@ const LinuxThreadImpl = struct { |
| 1217 | \\ ldi $16, 0 | 1217 | \\ ldi $16, 0 |
| 1218 | \\ callsys | 1218 | \\ callsys |
| 1219 | : | 1219 | : |
| 1220 | : [ptr] "{r16}" (@intFromPtr(self.mapped.ptr)), | 1220 | : [ptr] "{$16}" (@intFromPtr(self.mapped.ptr)), |
| 1221 | [len] "{r17}" (self.mapped.len), | 1221 | [len] "{$17}" (self.mapped.len), |
| 1222 | ), | 1222 | ), |
| 1223 | .hexagon => asm volatile ( | 1223 | .hexagon => asm volatile ( |
| 1224 | \\ r6 = #215 // SYS_munmap | 1224 | \\ r6 = #215 // SYS_munmap |
lib/std/debug/Dwarf.zig+3| ... | @@ -1436,6 +1436,7 @@ pub fn compactUnwindToDwarfRegNumber(unwind_reg_number: u3) !u16 { | ... | @@ -1436,6 +1436,7 @@ pub fn compactUnwindToDwarfRegNumber(unwind_reg_number: u3) !u16 { |
| 1436 | pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 { | 1436 | pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 { |
| 1437 | return switch (arch) { | 1437 | return switch (arch) { |
| 1438 | .aarch64, .aarch64_be => 32, | 1438 | .aarch64, .aarch64_be => 32, |
| 1439 | .alpha => 64, | ||
| 1439 | .arc, .arceb => 160, | 1440 | .arc, .arceb => 160, |
| 1440 | .arm, .armeb, .thumb, .thumbeb => 15, | 1441 | .arm, .armeb, .thumb, .thumbeb => 15, |
| 1441 | .csky => 64, | 1442 | .csky => 64, |
| ... | @@ -1460,6 +1461,7 @@ pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 { | ... | @@ -1460,6 +1461,7 @@ pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 { |
| 1460 | pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 { | 1461 | pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 { |
| 1461 | return switch (arch) { | 1462 | return switch (arch) { |
| 1462 | .aarch64, .aarch64_be => 29, | 1463 | .aarch64, .aarch64_be => 29, |
| 1464 | .alpha => 15, | ||
| 1463 | .arc, .arceb => 27, | 1465 | .arc, .arceb => 27, |
| 1464 | .arm, .armeb, .thumb, .thumbeb => 11, | 1466 | .arm, .armeb, .thumb, .thumbeb => 11, |
| 1465 | .csky => 14, | 1467 | .csky => 14, |
| ... | @@ -1484,6 +1486,7 @@ pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 { | ... | @@ -1484,6 +1486,7 @@ pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 { |
| 1484 | pub fn spRegNum(arch: std.Target.Cpu.Arch) u16 { | 1486 | pub fn spRegNum(arch: std.Target.Cpu.Arch) u16 { |
| 1485 | return switch (arch) { | 1487 | return switch (arch) { |
| 1486 | .aarch64, .aarch64_be => 31, | 1488 | .aarch64, .aarch64_be => 31, |
| 1489 | .alpha => 30, | ||
| 1487 | .arc, .arceb => 28, | 1490 | .arc, .arceb => 28, |
| 1488 | .arm, .armeb, .thumb, .thumbeb => 13, | 1491 | .arm, .armeb, .thumb, .thumbeb => 13, |
| 1489 | .csky => 14, | 1492 | .csky => 14, |
lib/std/debug/cpu_context.zig+74| ... | @@ -5,6 +5,7 @@ pub const Native = if (@hasDecl(root, "debug") and @hasDecl(root.debug, "CpuCont | ... | @@ -5,6 +5,7 @@ pub const Native = if (@hasDecl(root, "debug") and @hasDecl(root.debug, "CpuCont |
| 5 | root.debug.CpuContext | 5 | root.debug.CpuContext |
| 6 | else switch (native_arch) { | 6 | else switch (native_arch) { |
| 7 | .aarch64, .aarch64_be => Aarch64, | 7 | .aarch64, .aarch64_be => Aarch64, |
| 8 | .alpha => Alpha, | ||
| 8 | .arc, .arceb => Arc, | 9 | .arc, .arceb => Arc, |
| 9 | .arm, .armeb, .thumb, .thumbeb => Arm, | 10 | .arm, .armeb, .thumb, .thumbeb => Arm, |
| 10 | .csky => Csky, | 11 | .csky => Csky, |
| ... | @@ -103,6 +104,10 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { | ... | @@ -103,6 +104,10 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { |
| 103 | .sp = uc.mcontext.sp, | 104 | .sp = uc.mcontext.sp, |
| 104 | .pc = uc.mcontext.pc, | 105 | .pc = uc.mcontext.pc, |
| 105 | }, | 106 | }, |
| 107 | .alpha => .{ | ||
| 108 | .r = uc.mcontext.r, | ||
| 109 | .pc = uc.mcontext.pc, | ||
| 110 | }, | ||
| 106 | .csky => .{ | 111 | .csky => .{ |
| 107 | .r = uc.mcontext.r0_13 ++ | 112 | .r = uc.mcontext.r0_13 ++ |
| 108 | [_]u32{ uc.mcontext.r14, uc.mcontext.r15 } ++ | 113 | [_]u32{ uc.mcontext.r14, uc.mcontext.r15 } ++ |
| ... | @@ -293,6 +298,75 @@ const Aarch64 = extern struct { | ... | @@ -293,6 +298,75 @@ const Aarch64 = extern struct { |
| 293 | } | 298 | } |
| 294 | }; | 299 | }; |
| 295 | 300 | ||
| 301 | const Alpha = extern struct { | ||
| 302 | /// The numbered general-purpose registers R0 - R31. | ||
| 303 | r: [32]u64, | ||
| 304 | pc: u64, | ||
| 305 | |||
| 306 | pub inline fn current() Alpha { | ||
| 307 | var ctx: Alpha = undefined; | ||
| 308 | asm volatile ( | ||
| 309 | \\ stq $0 , 0x000($0) | ||
| 310 | \\ stq $1 , 0x008($0) | ||
| 311 | \\ stq $2 , 0x010($0) | ||
| 312 | \\ stq $3 , 0x018($0) | ||
| 313 | \\ stq $4 , 0x020($0) | ||
| 314 | \\ stq $5 , 0x028($0) | ||
| 315 | \\ stq $6 , 0x030($0) | ||
| 316 | \\ stq $7 , 0x038($0) | ||
| 317 | \\ stq $8 , 0x040($0) | ||
| 318 | \\ stq $9 , 0x048($0) | ||
| 319 | \\ stq $10, 0x050($0) | ||
| 320 | \\ stq $11, 0x058($0) | ||
| 321 | \\ stq $12, 0x060($0) | ||
| 322 | \\ stq $13, 0x068($0) | ||
| 323 | \\ stq $14, 0x070($0) | ||
| 324 | \\ stq $15, 0x078($0) | ||
| 325 | \\ stq $16, 0x080($0) | ||
| 326 | \\ stq $17, 0x088($0) | ||
| 327 | \\ stq $18, 0x090($0) | ||
| 328 | \\ stq $19, 0x098($0) | ||
| 329 | \\ stq $20, 0x0a0($0) | ||
| 330 | \\ stq $21, 0x0a8($0) | ||
| 331 | \\ stq $22, 0x0b0($0) | ||
| 332 | \\ stq $23, 0x0b8($0) | ||
| 333 | \\ stq $24, 0x0c0($0) | ||
| 334 | \\ stq $25, 0x0c8($0) | ||
| 335 | \\ stq $26, 0x0d0($0) | ||
| 336 | \\ stq $27, 0x0d8($0) | ||
| 337 | \\ stq $28, 0x0e0($0) | ||
| 338 | \\ stq $29, 0x0e8($0) | ||
| 339 | \\ stq $30, 0x0f0($0) | ||
| 340 | \\ | ||
| 341 | \\ br $1, 1f | ||
| 342 | \\1: | ||
| 343 | \\ stq $1, 0x100($0) | ||
| 344 | : | ||
| 345 | : [ctx] "{r0}" (&ctx), | ||
| 346 | : .{ .r1 = true, .memory = true }); | ||
| 347 | return ctx; | ||
| 348 | } | ||
| 349 | |||
| 350 | pub fn getFp(ctx: *const Alpha) u64 { | ||
| 351 | return ctx.r[15]; | ||
| 352 | } | ||
| 353 | pub fn getPc(ctx: *const Alpha) u64 { | ||
| 354 | return ctx.pc; | ||
| 355 | } | ||
| 356 | |||
| 357 | pub fn dwarfRegisterBytes(ctx: *Aarch64, register_num: u16) DwarfRegisterError![]u8 { | ||
| 358 | switch (register_num) { | ||
| 359 | 0...31 => return @ptrCast(&ctx.r[register_num]), | ||
| 360 | 64 => return @ptrCast(&ctx.pc), | ||
| 361 | |||
| 362 | 32...63 => return error.UnsupportedRegister, // f0 - f31 | ||
| 363 | 66 => return error.UnsupportedRegister, // uniq | ||
| 364 | |||
| 365 | else => return error.InvalidRegister, | ||
| 366 | } | ||
| 367 | } | ||
| 368 | }; | ||
| 369 | |||
| 296 | /// This is an `extern struct` so that inline assembly in `current` can use field offsets. | 370 | /// This is an `extern struct` so that inline assembly in `current` can use field offsets. |
| 297 | const Arc = extern struct { | 371 | const Arc = extern struct { |
| 298 | /// The numbered general-purpose registers r0 - r31. | 372 | /// The numbered general-purpose registers r0 - r31. |
lib/std/os/linux.zig+98-1| ... | @@ -31,6 +31,7 @@ test { | ... | @@ -31,6 +31,7 @@ test { |
| 31 | 31 | ||
| 32 | const arch_bits = switch (native_arch) { | 32 | const arch_bits = switch (native_arch) { |
| 33 | .aarch64, .aarch64_be => @import("linux/aarch64.zig"), | 33 | .aarch64, .aarch64_be => @import("linux/aarch64.zig"), |
| 34 | .alpha => @import("linux/alpha.zig"), | ||
| 34 | .arc, .arceb => @import("linux/arc.zig"), | 35 | .arc, .arceb => @import("linux/arc.zig"), |
| 35 | .arm, .armeb, .thumb, .thumbeb => @import("linux/arm.zig"), | 36 | .arm, .armeb, .thumb, .thumbeb => @import("linux/arm.zig"), |
| 36 | .hexagon => @import("linux/hexagon.zig"), | 37 | .hexagon => @import("linux/hexagon.zig"), |
| ... | @@ -124,6 +125,7 @@ pub const syscalls = @import("linux/syscalls.zig"); | ... | @@ -124,6 +125,7 @@ pub const syscalls = @import("linux/syscalls.zig"); |
| 124 | pub const SYS = switch (native_arch) { | 125 | pub const SYS = switch (native_arch) { |
| 125 | .arc, .arceb => syscalls.Arc, | 126 | .arc, .arceb => syscalls.Arc, |
| 126 | .aarch64, .aarch64_be => syscalls.Arm64, | 127 | .aarch64, .aarch64_be => syscalls.Arm64, |
| 128 | .alpha => syscalls.Alpha, | ||
| 127 | .arm, .armeb, .thumb, .thumbeb => syscalls.Arm, | 129 | .arm, .armeb, .thumb, .thumbeb => syscalls.Arm, |
| 128 | .csky => syscalls.CSky, | 130 | .csky => syscalls.CSky, |
| 129 | .hexagon => syscalls.Hexagon, | 131 | .hexagon => syscalls.Hexagon, |
| ... | @@ -311,6 +313,30 @@ pub const MAP = switch (native_arch) { | ... | @@ -311,6 +313,30 @@ pub const MAP = switch (native_arch) { |
| 311 | UNINITIALIZED: bool = false, | 313 | UNINITIALIZED: bool = false, |
| 312 | _: u5 = 0, | 314 | _: u5 = 0, |
| 313 | }, | 315 | }, |
| 316 | .alpha => packed struct(u32) { | ||
| 317 | TYPE: MAP_TYPE, | ||
| 318 | ANONYMOUS: bool = false, | ||
| 319 | _3: u1 = 0, | ||
| 320 | _4: u1 = 0, | ||
| 321 | _5: u1 = 0, | ||
| 322 | FIXED: bool = false, | ||
| 323 | _7: u1 = 0, | ||
| 324 | _8: u1 = 0, | ||
| 325 | _9: u1 = 0, | ||
| 326 | GROWSDOWN: bool = false, | ||
| 327 | DENYWRITE: bool = false, | ||
| 328 | EXECUTABLE: bool = false, | ||
| 329 | LOCKED: bool = false, | ||
| 330 | NORESERVE: bool = false, | ||
| 331 | POPULATE: bool = false, | ||
| 332 | NONBLOCK: bool = false, | ||
| 333 | STACK: bool = false, | ||
| 334 | HUGHETLB: bool = false, | ||
| 335 | FIXED_NOREPLACE: bool = false, | ||
| 336 | _19: u4 = 0, | ||
| 337 | _20: u1 = 0, | ||
| 338 | _: u5 = 0, | ||
| 339 | }, | ||
| 314 | else => @compileError("missing std.os.linux.MAP constants for this architecture"), | 340 | else => @compileError("missing std.os.linux.MAP constants for this architecture"), |
| 315 | }; | 341 | }; |
| 316 | 342 | ||
| ... | @@ -520,6 +546,29 @@ pub const O = switch (native_arch) { | ... | @@ -520,6 +546,29 @@ pub const O = switch (native_arch) { |
| 520 | PATH: bool = false, | 546 | PATH: bool = false, |
| 521 | _22: u10 = 0, | 547 | _22: u10 = 0, |
| 522 | }, | 548 | }, |
| 549 | .alpha => packed struct(u32) { | ||
| 550 | ACCMODE: ACCMODE = .RDONLY, | ||
| 551 | NONBLOCK: bool = false, | ||
| 552 | APPEND: bool = false, | ||
| 553 | _4: u5 = 0, | ||
| 554 | CREAT: bool = false, | ||
| 555 | TRUNC: bool = false, | ||
| 556 | EXCL: bool = false, | ||
| 557 | NOCTTY: bool = false, | ||
| 558 | _9: u1 = 0, | ||
| 559 | DSYNC: bool = false, | ||
| 560 | DIRECTORY: bool = false, | ||
| 561 | NOFOLLOW: bool = false, | ||
| 562 | LARGEFILE: bool = false, | ||
| 563 | _14: u1 = 0, | ||
| 564 | DIRECT: bool = false, | ||
| 565 | NOATIME: bool = false, | ||
| 566 | CLOEXEC: bool = false, | ||
| 567 | SYNC: bool = false, | ||
| 568 | PATH: bool = false, | ||
| 569 | TMPFILE: bool = false, | ||
| 570 | _: u7 = 0, | ||
| 571 | }, | ||
| 523 | else => @compileError("missing std.os.linux.O constants for this architecture"), | 572 | else => @compileError("missing std.os.linux.O constants for this architecture"), |
| 524 | }; | 573 | }; |
| 525 | 574 | ||
| ... | @@ -2217,7 +2266,10 @@ pub fn getsid(pid: pid_t) usize { | ... | @@ -2217,7 +2266,10 @@ pub fn getsid(pid: pid_t) usize { |
| 2217 | 2266 | ||
| 2218 | pub fn getpid() pid_t { | 2267 | pub fn getpid() pid_t { |
| 2219 | // Casts result to a pid_t, safety-checking >= 0, because getpid() cannot fail | 2268 | // Casts result to a pid_t, safety-checking >= 0, because getpid() cannot fail |
| 2220 | return @intCast(@as(u32, @truncate(syscall0(.getpid)))); | 2269 | return @intCast(@as(u32, @truncate(syscall0(comptime switch (native_arch) { |
| 2270 | .alpha => .getxpid, | ||
| 2271 | else => .getpid, | ||
| 2272 | })))); | ||
| 2221 | } | 2273 | } |
| 2222 | 2274 | ||
| 2223 | pub fn getppid() pid_t { | 2275 | pub fn getppid() pid_t { |
| ... | @@ -4061,6 +4113,51 @@ pub const SIG = if (is_mips) enum(u32) { | ... | @@ -4061,6 +4113,51 @@ pub const SIG = if (is_mips) enum(u32) { |
| 4061 | USR1 = 30, | 4113 | USR1 = 30, |
| 4062 | USR2 = 31, | 4114 | USR2 = 31, |
| 4063 | _, | 4115 | _, |
| 4116 | } else if (native_arch == .alpha) enum(u32) { | ||
| 4117 | pub const BLOCK = 1; | ||
| 4118 | pub const UNBLOCK = 2; | ||
| 4119 | pub const SETMASK = 3; | ||
| 4120 | |||
| 4121 | pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); | ||
| 4122 | pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); | ||
| 4123 | pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); | ||
| 4124 | |||
| 4125 | pub const POLL: SIG = .IO; | ||
| 4126 | pub const PWR: SIG = .INFO; | ||
| 4127 | pub const IOT: SIG = .ABRT; | ||
| 4128 | |||
| 4129 | HUP = 1, | ||
| 4130 | INT = 2, | ||
| 4131 | QUIT = 3, | ||
| 4132 | ILL = 4, | ||
| 4133 | TRAP = 5, | ||
| 4134 | ABRT = 6, | ||
| 4135 | EMT = 7, | ||
| 4136 | FPE = 8, | ||
| 4137 | KILL = 9, | ||
| 4138 | BUS = 10, | ||
| 4139 | SEGV = 11, | ||
| 4140 | SYS = 12, | ||
| 4141 | PIPE = 13, | ||
| 4142 | ALRM = 14, | ||
| 4143 | TERM = 15, | ||
| 4144 | URG = 16, | ||
| 4145 | STOP = 17, | ||
| 4146 | TSTP = 18, | ||
| 4147 | CONT = 19, | ||
| 4148 | CHLD = 20, | ||
| 4149 | TTIN = 21, | ||
| 4150 | TTOU = 22, | ||
| 4151 | IO = 23, | ||
| 4152 | XCPU = 24, | ||
| 4153 | XFSZ = 25, | ||
| 4154 | VTALRM = 26, | ||
| 4155 | PROF = 27, | ||
| 4156 | WINCH = 28, | ||
| 4157 | INFO = 29, | ||
| 4158 | USR1 = 30, | ||
| 4159 | USR2 = 31, | ||
| 4160 | _, | ||
| 4064 | } else enum(u32) { | 4161 | } else enum(u32) { |
| 4065 | pub const BLOCK = 0; | 4162 | pub const BLOCK = 0; |
| 4066 | pub const UNBLOCK = 1; | 4163 | pub const UNBLOCK = 1; |
lib/std/os/linux/alpha.zig created+358| ... | @@ -0,0 +1,358 @@ | ||
| 1 | const builtin = @import("builtin"); | ||
| 2 | const std = @import("../../std.zig"); | ||
| 3 | const SYS = std.os.linux.SYS; | ||
| 4 | |||
| 5 | pub fn syscall0(number: SYS) u64 { | ||
| 6 | return asm volatile ( | ||
| 7 | \\ callsys | ||
| 8 | \\ beq $19, 1f | ||
| 9 | \\ negq $0, $0 | ||
| 10 | \\1: | ||
| 11 | : [ret] "={$0}" (-> u64), | ||
| 12 | : [number] "{$0}" (number), | ||
| 13 | : .{ | ||
| 14 | .r1 = true, | ||
| 15 | .r2 = true, | ||
| 16 | .r3 = true, | ||
| 17 | .r4 = true, | ||
| 18 | .r5 = true, | ||
| 19 | .r6 = true, | ||
| 20 | .r7 = true, | ||
| 21 | .r8 = true, | ||
| 22 | .r22 = true, | ||
| 23 | .r23 = true, | ||
| 24 | .r24 = true, | ||
| 25 | .r25 = true, | ||
| 26 | .r27 = true, | ||
| 27 | .r28 = true, | ||
| 28 | .memory = true, | ||
| 29 | .r16 = true, | ||
| 30 | .r17 = true, | ||
| 31 | .r18 = true, | ||
| 32 | .r20 = true, | ||
| 33 | .r21 = true, | ||
| 34 | }); | ||
| 35 | } | ||
| 36 | |||
| 37 | pub fn syscall1(number: SYS, arg1: u64) u64 { | ||
| 38 | // These registers are both inputs and clobbers. | ||
| 39 | var r16_out: u64 = undefined; | ||
| 40 | return asm volatile ( | ||
| 41 | \\ callsys | ||
| 42 | \\ beq $19, 1f | ||
| 43 | \\ negq $0, $0 | ||
| 44 | \\1: | ||
| 45 | : [ret] "={$0}" (-> u64), | ||
| 46 | [r16_out] "={$16}" (r16_out), | ||
| 47 | : [number] "{$0}" (number), | ||
| 48 | [arg1] "{$16}" (arg1), | ||
| 49 | : .{ | ||
| 50 | .r1 = true, | ||
| 51 | .r2 = true, | ||
| 52 | .r3 = true, | ||
| 53 | .r4 = true, | ||
| 54 | .r5 = true, | ||
| 55 | .r6 = true, | ||
| 56 | .r7 = true, | ||
| 57 | .r8 = true, | ||
| 58 | .r22 = true, | ||
| 59 | .r23 = true, | ||
| 60 | .r24 = true, | ||
| 61 | .r25 = true, | ||
| 62 | .r27 = true, | ||
| 63 | .r28 = true, | ||
| 64 | .memory = true, | ||
| 65 | .r17 = true, | ||
| 66 | .r18 = true, | ||
| 67 | .r20 = true, | ||
| 68 | .r21 = true, | ||
| 69 | }); | ||
| 70 | } | ||
| 71 | |||
| 72 | pub fn syscall2(number: SYS, arg1: u64, arg2: u64) u64 { | ||
| 73 | // These registers are both inputs and clobbers. | ||
| 74 | var r16_out: u64 = undefined; | ||
| 75 | var r17_out: u64 = undefined; | ||
| 76 | return asm volatile ( | ||
| 77 | \\ callsys | ||
| 78 | \\ beq $19, 1f | ||
| 79 | \\ negq $0, $0 | ||
| 80 | \\1: | ||
| 81 | : [ret] "={$0}" (-> u64), | ||
| 82 | [r16_out] "={$16}" (r16_out), | ||
| 83 | [r17_out] "={$17}" (r17_out), | ||
| 84 | : [number] "{$0}" (number), | ||
| 85 | [arg1] "{$16}" (arg1), | ||
| 86 | [arg2] "{$17}" (arg2), | ||
| 87 | : .{ | ||
| 88 | .r1 = true, | ||
| 89 | .r2 = true, | ||
| 90 | .r3 = true, | ||
| 91 | .r4 = true, | ||
| 92 | .r5 = true, | ||
| 93 | .r6 = true, | ||
| 94 | .r7 = true, | ||
| 95 | .r8 = true, | ||
| 96 | .r22 = true, | ||
| 97 | .r23 = true, | ||
| 98 | .r24 = true, | ||
| 99 | .r25 = true, | ||
| 100 | .r27 = true, | ||
| 101 | .r28 = true, | ||
| 102 | .memory = true, | ||
| 103 | .r18 = true, | ||
| 104 | .r20 = true, | ||
| 105 | .r21 = true, | ||
| 106 | }); | ||
| 107 | } | ||
| 108 | |||
| 109 | pub fn syscall3(number: SYS, arg1: u64, arg2: u64, arg3: u64) u64 { | ||
| 110 | // These registers are both inputs and clobbers. | ||
| 111 | var r16_out: u64 = undefined; | ||
| 112 | var r17_out: u64 = undefined; | ||
| 113 | var r18_out: u64 = undefined; | ||
| 114 | return asm volatile ( | ||
| 115 | \\ callsys | ||
| 116 | \\ beq $19, 1f | ||
| 117 | \\ negq $0, $0 | ||
| 118 | \\1: | ||
| 119 | : [ret] "={$0}" (-> u64), | ||
| 120 | [r16_out] "={$16}" (r16_out), | ||
| 121 | [r17_out] "={$17}" (r17_out), | ||
| 122 | [r18_out] "={$18}" (r18_out), | ||
| 123 | : [number] "{$0}" (number), | ||
| 124 | [arg1] "{$16}" (arg1), | ||
| 125 | [arg2] "{$17}" (arg2), | ||
| 126 | [arg3] "{$18}" (arg3), | ||
| 127 | : .{ | ||
| 128 | .r1 = true, | ||
| 129 | .r2 = true, | ||
| 130 | .r3 = true, | ||
| 131 | .r4 = true, | ||
| 132 | .r5 = true, | ||
| 133 | .r6 = true, | ||
| 134 | .r7 = true, | ||
| 135 | .r8 = true, | ||
| 136 | .r22 = true, | ||
| 137 | .r23 = true, | ||
| 138 | .r24 = true, | ||
| 139 | .r25 = true, | ||
| 140 | .r27 = true, | ||
| 141 | .r28 = true, | ||
| 142 | .memory = true, | ||
| 143 | .r20 = true, | ||
| 144 | .r21 = true, | ||
| 145 | }); | ||
| 146 | } | ||
| 147 | |||
| 148 | pub fn syscall4(number: SYS, arg1: u64, arg2: u64, arg3: u64, arg4: u64) u64 { | ||
| 149 | // These registers are both inputs and clobbers. | ||
| 150 | var r16_out: u64 = undefined; | ||
| 151 | var r17_out: u64 = undefined; | ||
| 152 | var r18_out: u64 = undefined; | ||
| 153 | var r19_out: u64 = undefined; | ||
| 154 | return asm volatile ( | ||
| 155 | \\ callsys | ||
| 156 | \\ beq $19, 1f | ||
| 157 | \\ negq $0, $0 | ||
| 158 | \\1: | ||
| 159 | : [ret] "={$0}" (-> u64), | ||
| 160 | [r16_out] "={$16}" (r16_out), | ||
| 161 | [r17_out] "={$17}" (r17_out), | ||
| 162 | [r18_out] "={$18}" (r18_out), | ||
| 163 | [r19_out] "={$19}" (r19_out), | ||
| 164 | : [number] "{$0}" (number), | ||
| 165 | [arg1] "{$16}" (arg1), | ||
| 166 | [arg2] "{$17}" (arg2), | ||
| 167 | [arg3] "{$18}" (arg3), | ||
| 168 | [arg4] "{$19}" (arg4), | ||
| 169 | : .{ | ||
| 170 | .r1 = true, | ||
| 171 | .r2 = true, | ||
| 172 | .r3 = true, | ||
| 173 | .r4 = true, | ||
| 174 | .r5 = true, | ||
| 175 | .r6 = true, | ||
| 176 | .r7 = true, | ||
| 177 | .r8 = true, | ||
| 178 | .r22 = true, | ||
| 179 | .r23 = true, | ||
| 180 | .r24 = true, | ||
| 181 | .r25 = true, | ||
| 182 | .r27 = true, | ||
| 183 | .r28 = true, | ||
| 184 | .memory = true, | ||
| 185 | .r20 = true, | ||
| 186 | .r21 = true, | ||
| 187 | }); | ||
| 188 | } | ||
| 189 | |||
| 190 | pub fn syscall5(number: SYS, arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64) u64 { | ||
| 191 | // These registers are both inputs and clobbers. | ||
| 192 | var r16_out: u64 = undefined; | ||
| 193 | var r17_out: u64 = undefined; | ||
| 194 | var r18_out: u64 = undefined; | ||
| 195 | var r19_out: u64 = undefined; | ||
| 196 | var r20_out: u64 = undefined; | ||
| 197 | return asm volatile ( | ||
| 198 | \\ callsys | ||
| 199 | \\ beq $19, 1f | ||
| 200 | \\ negq $0, $0 | ||
| 201 | \\1: | ||
| 202 | : [ret] "={$0}" (-> u64), | ||
| 203 | [r16_out] "={$16}" (r16_out), | ||
| 204 | [r17_out] "={$17}" (r17_out), | ||
| 205 | [r18_out] "={$18}" (r18_out), | ||
| 206 | [r19_out] "={$19}" (r19_out), | ||
| 207 | [r20_out] "={$20}" (r20_out), | ||
| 208 | : [number] "{$0}" (number), | ||
| 209 | [arg1] "{$16}" (arg1), | ||
| 210 | [arg2] "{$17}" (arg2), | ||
| 211 | [arg3] "{$18}" (arg3), | ||
| 212 | [arg4] "{$19}" (arg4), | ||
| 213 | [arg5] "{$20}" (arg5), | ||
| 214 | : .{ | ||
| 215 | .r1 = true, | ||
| 216 | .r2 = true, | ||
| 217 | .r3 = true, | ||
| 218 | .r4 = true, | ||
| 219 | .r5 = true, | ||
| 220 | .r6 = true, | ||
| 221 | .r7 = true, | ||
| 222 | .r8 = true, | ||
| 223 | .r22 = true, | ||
| 224 | .r23 = true, | ||
| 225 | .r24 = true, | ||
| 226 | .r25 = true, | ||
| 227 | .r27 = true, | ||
| 228 | .r28 = true, | ||
| 229 | .memory = true, | ||
| 230 | .r21 = true, | ||
| 231 | }); | ||
| 232 | } | ||
| 233 | |||
| 234 | pub fn syscall6( | ||
| 235 | number: SYS, | ||
| 236 | arg1: u64, | ||
| 237 | arg2: u64, | ||
| 238 | arg3: u64, | ||
| 239 | arg4: u64, | ||
| 240 | arg5: u64, | ||
| 241 | arg6: u64, | ||
| 242 | ) u64 { | ||
| 243 | // These registers are both inputs and clobbers. | ||
| 244 | var r16_out: u64 = undefined; | ||
| 245 | var r17_out: u64 = undefined; | ||
| 246 | var r18_out: u64 = undefined; | ||
| 247 | var r19_out: u64 = undefined; | ||
| 248 | var r20_out: u64 = undefined; | ||
| 249 | var r21_out: u64 = undefined; | ||
| 250 | return asm volatile ( | ||
| 251 | \\ callsys | ||
| 252 | \\ beq $19, 1f | ||
| 253 | \\ negq $0, $0 | ||
| 254 | \\1: | ||
| 255 | : [ret] "={$0}" (-> u64), | ||
| 256 | [r16_out] "={$16}" (r16_out), | ||
| 257 | [r17_out] "={$17}" (r17_out), | ||
| 258 | [r18_out] "={$18}" (r18_out), | ||
| 259 | [r19_out] "={$19}" (r19_out), | ||
| 260 | [r20_out] "={$20}" (r20_out), | ||
| 261 | [r21_out] "={$21}" (r21_out), | ||
| 262 | : [number] "{$0}" (number), | ||
| 263 | [arg1] "{$16}" (arg1), | ||
| 264 | [arg2] "{$17}" (arg2), | ||
| 265 | [arg3] "{$18}" (arg3), | ||
| 266 | [arg4] "{$19}" (arg4), | ||
| 267 | [arg5] "{$20}" (arg5), | ||
| 268 | [arg6] "{$21}" (arg6), | ||
| 269 | : .{ | ||
| 270 | .r1 = true, | ||
| 271 | .r2 = true, | ||
| 272 | .r3 = true, | ||
| 273 | .r4 = true, | ||
| 274 | .r5 = true, | ||
| 275 | .r6 = true, | ||
| 276 | .r7 = true, | ||
| 277 | .r8 = true, | ||
| 278 | .r22 = true, | ||
| 279 | .r23 = true, | ||
| 280 | .r24 = true, | ||
| 281 | .r25 = true, | ||
| 282 | .r27 = true, | ||
| 283 | .r28 = true, | ||
| 284 | .memory = true, | ||
| 285 | }); | ||
| 286 | } | ||
| 287 | |||
| 288 | pub fn clone() callconv(.naked) u64 { | ||
| 289 | // __clone(func, stack, flags, arg, ptid, tls, ctid) | ||
| 290 | // a0, a1, a2, a3, a4, a5, +0 | ||
| 291 | // | ||
| 292 | // syscall(SYS_clone, flags, stack, ptid, ctid, tls) | ||
| 293 | // v0 a0, a1, a2, a3, a4 | ||
| 294 | asm volatile ( | ||
| 295 | // a0 = $16, a1 = $17, a2 = $18, a3 = $19, | ||
| 296 | // a4 = $20, a5 = $21, sp = $30, v0 = $0 | ||
| 297 | \\ # Save function pointer and argument pointer on new thread stack | ||
| 298 | \\ ldi $1, -8 | ||
| 299 | \\ and $17, $17, $1 | ||
| 300 | \\ lda $17, -16($17) | ||
| 301 | \\ stq $16, 0($17) | ||
| 302 | \\ stq $19, 8($17) | ||
| 303 | \\ | ||
| 304 | \\ # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,ctid,tls) | ||
| 305 | \\ mov $18, $16 | ||
| 306 | \\ mov $20, $18 | ||
| 307 | \\ ldq $19, 0($30) | ||
| 308 | \\ mov $21, $20 | ||
| 309 | \\ | ||
| 310 | \\ # Actual syscall | ||
| 311 | \\ ldi $0, 312 # SYS_clone | ||
| 312 | \\ callsys | ||
| 313 | \\ beq $19, 1f | ||
| 314 | \\ negq $0, $0 | ||
| 315 | \\ ret | ||
| 316 | \\1: | ||
| 317 | \\ beq $0, 2f | ||
| 318 | \\ ret | ||
| 319 | \\2: | ||
| 320 | ); | ||
| 321 | if (builtin.unwind_tables != .none or !builtin.strip_debug_info) asm volatile ( | ||
| 322 | // ra = $26 | ||
| 323 | \\ .cfi_undefined $26 | ||
| 324 | ); | ||
| 325 | asm volatile ( | ||
| 326 | // v0 = $0, t9 = $23, a0 = $16, ra = $26, sp = $30, fp = $15 | ||
| 327 | \\ mov 0, $15 | ||
| 328 | \\ | ||
| 329 | \\ ldq $23, 0($30) | ||
| 330 | \\ ldq $16, 8($30) | ||
| 331 | \\ lda $30, 16($30) | ||
| 332 | \\ jsr $26, ($23) | ||
| 333 | \\ | ||
| 334 | \\ mov $0, $16 | ||
| 335 | \\ ldi $0, 1 # SYS_EXIT | ||
| 336 | \\ callsys | ||
| 337 | ); | ||
| 338 | } | ||
| 339 | |||
| 340 | pub fn restore() noreturn { | ||
| 341 | asm volatile ( | ||
| 342 | // v0 = $0, a0 = $16, sp = $30 | ||
| 343 | \\ mov $30, $16 | ||
| 344 | \\ ldi $0, 103 # SIGRETURN | ||
| 345 | \\ callsys | ||
| 346 | ); | ||
| 347 | } | ||
| 348 | |||
| 349 | pub fn restore_rt() noreturn { | ||
| 350 | asm volatile ( | ||
| 351 | // v0 = $0, a0 = $16, sp = $30 | ||
| 352 | \\ mov $30, $16 | ||
| 353 | \\ ldi $0, 351 # RT_SIGRETURN | ||
| 354 | \\ callsys | ||
| 355 | ); | ||
| 356 | } | ||
| 357 | |||
| 358 | pub const VDSO = void; | ||
lib/std/os/linux/syscalls.zig+502| ... | @@ -5851,6 +5851,508 @@ pub const Xtensa = enum(usize) { | ... | @@ -5851,6 +5851,508 @@ pub const Xtensa = enum(usize) { |
| 5851 | rseq_slice_yield = 471, | 5851 | rseq_slice_yield = 471, |
| 5852 | }; | 5852 | }; |
| 5853 | 5853 | ||
| 5854 | pub const Alpha = enum(usize) { | ||
| 5855 | osf_syscall = 0, | ||
| 5856 | exit = 1, | ||
| 5857 | fork = 2, | ||
| 5858 | read = 3, | ||
| 5859 | write = 4, | ||
| 5860 | osf_old_open = 5, | ||
| 5861 | close = 6, | ||
| 5862 | osf_wait4 = 7, | ||
| 5863 | osf_old_creat = 8, | ||
| 5864 | link = 9, | ||
| 5865 | unlink = 10, | ||
| 5866 | osf_execve = 11, | ||
| 5867 | chdir = 12, | ||
| 5868 | fchdir = 13, | ||
| 5869 | mknod = 14, | ||
| 5870 | chmod = 15, | ||
| 5871 | chown = 16, | ||
| 5872 | brk = 17, | ||
| 5873 | osf_getfsstat = 18, | ||
| 5874 | lseek = 19, | ||
| 5875 | getxpid = 20, | ||
| 5876 | osf_mount = 21, | ||
| 5877 | umount2 = 22, | ||
| 5878 | setuid = 23, | ||
| 5879 | getxuid = 24, | ||
| 5880 | exec_with_loader = 25, | ||
| 5881 | ptrace = 26, | ||
| 5882 | osf_nrecvmsg = 27, | ||
| 5883 | osf_nsendmsg = 28, | ||
| 5884 | osf_nrecvfrom = 29, | ||
| 5885 | osf_naccept = 30, | ||
| 5886 | osf_ngetpeername = 31, | ||
| 5887 | osf_ngetsockname = 32, | ||
| 5888 | access = 33, | ||
| 5889 | osf_chflags = 34, | ||
| 5890 | osf_fchflags = 35, | ||
| 5891 | sync = 36, | ||
| 5892 | kill = 37, | ||
| 5893 | osf_old_stat = 38, | ||
| 5894 | setpgid = 39, | ||
| 5895 | osf_old_lstat = 40, | ||
| 5896 | dup = 41, | ||
| 5897 | pipe = 42, | ||
| 5898 | osf_set_program_attributes = 43, | ||
| 5899 | osf_profil = 44, | ||
| 5900 | open = 45, | ||
| 5901 | osf_old_sigaction = 46, | ||
| 5902 | getxgid = 47, | ||
| 5903 | osf_sigprocmask = 48, | ||
| 5904 | osf_getlogin = 49, | ||
| 5905 | osf_setlogin = 50, | ||
| 5906 | acct = 51, | ||
| 5907 | sigpending = 52, | ||
| 5908 | ioctl = 54, | ||
| 5909 | osf_reboot = 55, | ||
| 5910 | osf_revoke = 56, | ||
| 5911 | symlink = 57, | ||
| 5912 | readlink = 58, | ||
| 5913 | execve = 59, | ||
| 5914 | umask = 60, | ||
| 5915 | chroot = 61, | ||
| 5916 | osf_old_fstat = 62, | ||
| 5917 | getpgrp = 63, | ||
| 5918 | getpagesize = 64, | ||
| 5919 | osf_mremap = 65, | ||
| 5920 | vfork = 66, | ||
| 5921 | stat = 67, | ||
| 5922 | lstat = 68, | ||
| 5923 | osf_sbrk = 69, | ||
| 5924 | osf_sstk = 70, | ||
| 5925 | mmap = 71, | ||
| 5926 | osf_old_vadvise = 72, | ||
| 5927 | munmap = 73, | ||
| 5928 | mprotect = 74, | ||
| 5929 | madvise = 75, | ||
| 5930 | vhangup = 76, | ||
| 5931 | osf_kmodcall = 77, | ||
| 5932 | osf_mincore = 78, | ||
| 5933 | getgroups = 79, | ||
| 5934 | setgroups = 80, | ||
| 5935 | osf_old_getpgrp = 81, | ||
| 5936 | setpgrp = 82, | ||
| 5937 | osf_setitimer = 83, | ||
| 5938 | osf_old_wait = 84, | ||
| 5939 | osf_table = 85, | ||
| 5940 | osf_getitimer = 86, | ||
| 5941 | gethostname = 87, | ||
| 5942 | sethostname = 88, | ||
| 5943 | getdtablesize = 89, | ||
| 5944 | dup2 = 90, | ||
| 5945 | fstat = 91, | ||
| 5946 | fcntl = 92, | ||
| 5947 | osf_select = 93, | ||
| 5948 | poll = 94, | ||
| 5949 | fsync = 95, | ||
| 5950 | setpriority = 96, | ||
| 5951 | socket = 97, | ||
| 5952 | connect = 98, | ||
| 5953 | accept = 99, | ||
| 5954 | getpriority = 100, | ||
| 5955 | send = 101, | ||
| 5956 | recv = 102, | ||
| 5957 | sigreturn = 103, | ||
| 5958 | bind = 104, | ||
| 5959 | setsockopt = 105, | ||
| 5960 | listen = 106, | ||
| 5961 | osf_plock = 107, | ||
| 5962 | osf_old_sigvec = 108, | ||
| 5963 | osf_old_sigblock = 109, | ||
| 5964 | osf_old_sigsetmask = 110, | ||
| 5965 | sigsuspend = 111, | ||
| 5966 | osf_sigstack = 112, | ||
| 5967 | recvmsg = 113, | ||
| 5968 | sendmsg = 114, | ||
| 5969 | osf_old_vtrace = 115, | ||
| 5970 | osf_gettimeofday = 116, | ||
| 5971 | osf_getrusage = 117, | ||
| 5972 | getsockopt = 118, | ||
| 5973 | readv = 120, | ||
| 5974 | writev = 121, | ||
| 5975 | osf_settimeofday = 122, | ||
| 5976 | fchown = 123, | ||
| 5977 | fchmod = 124, | ||
| 5978 | recvfrom = 125, | ||
| 5979 | setreuid = 126, | ||
| 5980 | setregid = 127, | ||
| 5981 | rename = 128, | ||
| 5982 | truncate = 129, | ||
| 5983 | ftruncate = 130, | ||
| 5984 | flock = 131, | ||
| 5985 | setgid = 132, | ||
| 5986 | sendto = 133, | ||
| 5987 | shutdown = 134, | ||
| 5988 | socketpair = 135, | ||
| 5989 | mkdir = 136, | ||
| 5990 | rmdir = 137, | ||
| 5991 | osf_utimes = 138, | ||
| 5992 | osf_old_sigreturn = 139, | ||
| 5993 | osf_adjtime = 140, | ||
| 5994 | getpeername = 141, | ||
| 5995 | osf_gethostid = 142, | ||
| 5996 | osf_sethostid = 143, | ||
| 5997 | getrlimit = 144, | ||
| 5998 | setrlimit = 145, | ||
| 5999 | osf_old_killpg = 146, | ||
| 6000 | setsid = 147, | ||
| 6001 | quotactl = 148, | ||
| 6002 | osf_oldquota = 149, | ||
| 6003 | getsockname = 150, | ||
| 6004 | osf_pid_block = 153, | ||
| 6005 | osf_pid_unblock = 154, | ||
| 6006 | sigaction = 156, | ||
| 6007 | osf_sigwaitprim = 157, | ||
| 6008 | osf_nfssvc = 158, | ||
| 6009 | osf_getdirentries = 159, | ||
| 6010 | osf_statfs = 160, | ||
| 6011 | osf_fstatfs = 161, | ||
| 6012 | osf_asynch_daemon = 163, | ||
| 6013 | osf_getfh = 164, | ||
| 6014 | osf_getdomainname = 165, | ||
| 6015 | setdomainname = 166, | ||
| 6016 | osf_exportfs = 169, | ||
| 6017 | osf_alt_plock = 181, | ||
| 6018 | osf_getmnt = 184, | ||
| 6019 | osf_alt_sigpending = 187, | ||
| 6020 | osf_alt_setsid = 188, | ||
| 6021 | osf_swapon = 199, | ||
| 6022 | msgctl = 200, | ||
| 6023 | msgget = 201, | ||
| 6024 | msgrcv = 202, | ||
| 6025 | msgsnd = 203, | ||
| 6026 | semctl = 204, | ||
| 6027 | semget = 205, | ||
| 6028 | semop = 206, | ||
| 6029 | osf_utsname = 207, | ||
| 6030 | lchown = 208, | ||
| 6031 | shmat = 209, | ||
| 6032 | shmctl = 210, | ||
| 6033 | shmdt = 211, | ||
| 6034 | shmget = 212, | ||
| 6035 | osf_mvalid = 213, | ||
| 6036 | osf_getaddressconf = 214, | ||
| 6037 | osf_msleep = 215, | ||
| 6038 | osf_mwakeup = 216, | ||
| 6039 | msync = 217, | ||
| 6040 | osf_signal = 218, | ||
| 6041 | osf_utc_gettime = 219, | ||
| 6042 | osf_utc_adjtime = 220, | ||
| 6043 | osf_security = 222, | ||
| 6044 | osf_kloadcall = 223, | ||
| 6045 | osf_stat = 224, | ||
| 6046 | osf_lstat = 225, | ||
| 6047 | osf_fstat = 226, | ||
| 6048 | osf_statfs64 = 227, | ||
| 6049 | osf_fstatfs64 = 228, | ||
| 6050 | getpgid = 233, | ||
| 6051 | getsid = 234, | ||
| 6052 | sigaltstack = 235, | ||
| 6053 | osf_waitid = 236, | ||
| 6054 | osf_priocntlset = 237, | ||
| 6055 | osf_sigsendset = 238, | ||
| 6056 | osf_set_speculative = 239, | ||
| 6057 | osf_msfs_syscall = 240, | ||
| 6058 | osf_sysinfo = 241, | ||
| 6059 | osf_uadmin = 242, | ||
| 6060 | osf_fuser = 243, | ||
| 6061 | osf_proplist_syscall = 244, | ||
| 6062 | osf_ntp_adjtime = 245, | ||
| 6063 | osf_ntp_gettime = 246, | ||
| 6064 | osf_pathconf = 247, | ||
| 6065 | osf_fpathconf = 248, | ||
| 6066 | osf_uswitch = 250, | ||
| 6067 | osf_usleep_thread = 251, | ||
| 6068 | osf_audcntl = 252, | ||
| 6069 | osf_audgen = 253, | ||
| 6070 | sysfs = 254, | ||
| 6071 | osf_subsys_info = 255, | ||
| 6072 | osf_getsysinfo = 256, | ||
| 6073 | osf_setsysinfo = 257, | ||
| 6074 | osf_afs_syscall = 258, | ||
| 6075 | osf_swapctl = 259, | ||
| 6076 | osf_memcntl = 260, | ||
| 6077 | osf_fdatasync = 261, | ||
| 6078 | bdflush = 300, | ||
| 6079 | sethae = 301, | ||
| 6080 | mount = 302, | ||
| 6081 | old_adjtimex = 303, | ||
| 6082 | swapoff = 304, | ||
| 6083 | getdents = 305, | ||
| 6084 | create_module = 306, | ||
| 6085 | init_module = 307, | ||
| 6086 | delete_module = 308, | ||
| 6087 | get_kernel_syms = 309, | ||
| 6088 | syslog = 310, | ||
| 6089 | reboot = 311, | ||
| 6090 | clone = 312, | ||
| 6091 | uselib = 313, | ||
| 6092 | mlock = 314, | ||
| 6093 | munlock = 315, | ||
| 6094 | mlockall = 316, | ||
| 6095 | munlockall = 317, | ||
| 6096 | sysinfo = 318, | ||
| 6097 | sysctl = 319, | ||
| 6098 | oldumount = 321, | ||
| 6099 | swapon = 322, | ||
| 6100 | times = 323, | ||
| 6101 | personality = 324, | ||
| 6102 | setfsuid = 325, | ||
| 6103 | setfsgid = 326, | ||
| 6104 | ustat = 327, | ||
| 6105 | statfs = 328, | ||
| 6106 | fstatfs = 329, | ||
| 6107 | sched_setparam = 330, | ||
| 6108 | sched_getparam = 331, | ||
| 6109 | sched_setscheduler = 332, | ||
| 6110 | sched_getscheduler = 333, | ||
| 6111 | sched_yield = 334, | ||
| 6112 | sched_get_priority_max = 335, | ||
| 6113 | sched_get_priority_min = 336, | ||
| 6114 | sched_rr_get_interval = 337, | ||
| 6115 | afs_syscall = 338, | ||
| 6116 | uname = 339, | ||
| 6117 | nanosleep = 340, | ||
| 6118 | mremap = 341, | ||
| 6119 | nfsservctl = 342, | ||
| 6120 | setresuid = 343, | ||
| 6121 | getresuid = 344, | ||
| 6122 | pciconfig_read = 345, | ||
| 6123 | pciconfig_write = 346, | ||
| 6124 | query_module = 347, | ||
| 6125 | prctl = 348, | ||
| 6126 | pread64 = 349, | ||
| 6127 | pwrite64 = 350, | ||
| 6128 | rt_sigreturn = 351, | ||
| 6129 | rt_sigaction = 352, | ||
| 6130 | rt_sigprocmask = 353, | ||
| 6131 | rt_sigpending = 354, | ||
| 6132 | rt_sigtimedwait = 355, | ||
| 6133 | rt_sigqueueinfo = 356, | ||
| 6134 | rt_sigsuspend = 357, | ||
| 6135 | select = 358, | ||
| 6136 | gettimeofday = 359, | ||
| 6137 | settimeofday = 360, | ||
| 6138 | getitimer = 361, | ||
| 6139 | setitimer = 362, | ||
| 6140 | utimes = 363, | ||
| 6141 | getrusage = 364, | ||
| 6142 | wait4 = 365, | ||
| 6143 | adjtimex = 366, | ||
| 6144 | getcwd = 367, | ||
| 6145 | capget = 368, | ||
| 6146 | capset = 369, | ||
| 6147 | sendfile = 370, | ||
| 6148 | setresgid = 371, | ||
| 6149 | getresgid = 372, | ||
| 6150 | dipc = 373, | ||
| 6151 | pivot_root = 374, | ||
| 6152 | mincore = 375, | ||
| 6153 | pciconfig_iobase = 376, | ||
| 6154 | getdents64 = 377, | ||
| 6155 | gettid = 378, | ||
| 6156 | readahead = 379, | ||
| 6157 | tkill = 381, | ||
| 6158 | setxattr = 382, | ||
| 6159 | lsetxattr = 383, | ||
| 6160 | fsetxattr = 384, | ||
| 6161 | getxattr = 385, | ||
| 6162 | lgetxattr = 386, | ||
| 6163 | fgetxattr = 387, | ||
| 6164 | listxattr = 388, | ||
| 6165 | llistxattr = 389, | ||
| 6166 | flistxattr = 390, | ||
| 6167 | removexattr = 391, | ||
| 6168 | lremovexattr = 392, | ||
| 6169 | fremovexattr = 393, | ||
| 6170 | futex = 394, | ||
| 6171 | sched_setaffinity = 395, | ||
| 6172 | sched_getaffinity = 396, | ||
| 6173 | tuxcall = 397, | ||
| 6174 | io_setup = 398, | ||
| 6175 | io_destroy = 399, | ||
| 6176 | io_getevents = 400, | ||
| 6177 | io_submit = 401, | ||
| 6178 | io_cancel = 402, | ||
| 6179 | exit_group = 405, | ||
| 6180 | lookup_dcookie = 406, | ||
| 6181 | epoll_create = 407, | ||
| 6182 | epoll_ctl = 408, | ||
| 6183 | epoll_wait = 409, | ||
| 6184 | remap_file_pages = 410, | ||
| 6185 | set_tid_address = 411, | ||
| 6186 | restart_syscall = 412, | ||
| 6187 | fadvise64 = 413, | ||
| 6188 | timer_create = 414, | ||
| 6189 | timer_settime = 415, | ||
| 6190 | timer_gettime = 416, | ||
| 6191 | timer_getoverrun = 417, | ||
| 6192 | timer_delete = 418, | ||
| 6193 | clock_settime = 419, | ||
| 6194 | clock_gettime = 420, | ||
| 6195 | clock_getres = 421, | ||
| 6196 | clock_nanosleep = 422, | ||
| 6197 | semtimedop = 423, | ||
| 6198 | tgkill = 424, | ||
| 6199 | stat64 = 425, | ||
| 6200 | lstat64 = 426, | ||
| 6201 | fstat64 = 427, | ||
| 6202 | vserver = 428, | ||
| 6203 | mbind = 429, | ||
| 6204 | get_mempolicy = 430, | ||
| 6205 | set_mempolicy = 431, | ||
| 6206 | mq_open = 432, | ||
| 6207 | mq_unlink = 433, | ||
| 6208 | mq_timedsend = 434, | ||
| 6209 | mq_timedreceive = 435, | ||
| 6210 | mq_notify = 436, | ||
| 6211 | mq_getsetattr = 437, | ||
| 6212 | waitid = 438, | ||
| 6213 | add_key = 439, | ||
| 6214 | request_key = 440, | ||
| 6215 | keyctl = 441, | ||
| 6216 | ioprio_set = 442, | ||
| 6217 | ioprio_get = 443, | ||
| 6218 | inotify_init = 444, | ||
| 6219 | inotify_add_watch = 445, | ||
| 6220 | inotify_rm_watch = 446, | ||
| 6221 | fdatasync = 447, | ||
| 6222 | kexec_load = 448, | ||
| 6223 | migrate_pages = 449, | ||
| 6224 | openat = 450, | ||
| 6225 | mkdirat = 451, | ||
| 6226 | mknodat = 452, | ||
| 6227 | fchownat = 453, | ||
| 6228 | futimesat = 454, | ||
| 6229 | fstatat64 = 455, | ||
| 6230 | unlinkat = 456, | ||
| 6231 | renameat = 457, | ||
| 6232 | linkat = 458, | ||
| 6233 | symlinkat = 459, | ||
| 6234 | readlinkat = 460, | ||
| 6235 | fchmodat = 461, | ||
| 6236 | faccessat = 462, | ||
| 6237 | pselect6 = 463, | ||
| 6238 | ppoll = 464, | ||
| 6239 | unshare = 465, | ||
| 6240 | set_robust_list = 466, | ||
| 6241 | get_robust_list = 467, | ||
| 6242 | splice = 468, | ||
| 6243 | sync_file_range = 469, | ||
| 6244 | tee = 470, | ||
| 6245 | vmsplice = 471, | ||
| 6246 | move_pages = 472, | ||
| 6247 | getcpu = 473, | ||
| 6248 | epoll_pwait = 474, | ||
| 6249 | utimensat = 475, | ||
| 6250 | signalfd = 476, | ||
| 6251 | timerfd = 477, | ||
| 6252 | eventfd = 478, | ||
| 6253 | recvmmsg = 479, | ||
| 6254 | fallocate = 480, | ||
| 6255 | timerfd_create = 481, | ||
| 6256 | timerfd_settime = 482, | ||
| 6257 | timerfd_gettime = 483, | ||
| 6258 | signalfd4 = 484, | ||
| 6259 | eventfd2 = 485, | ||
| 6260 | epoll_create1 = 486, | ||
| 6261 | dup3 = 487, | ||
| 6262 | pipe2 = 488, | ||
| 6263 | inotify_init1 = 489, | ||
| 6264 | preadv = 490, | ||
| 6265 | pwritev = 491, | ||
| 6266 | rt_tgsigqueueinfo = 492, | ||
| 6267 | perf_event_open = 493, | ||
| 6268 | fanotify_init = 494, | ||
| 6269 | fanotify_mark = 495, | ||
| 6270 | prlimit64 = 496, | ||
| 6271 | name_to_handle_at = 497, | ||
| 6272 | open_by_handle_at = 498, | ||
| 6273 | clock_adjtime = 499, | ||
| 6274 | syncfs = 500, | ||
| 6275 | setns = 501, | ||
| 6276 | accept4 = 502, | ||
| 6277 | sendmmsg = 503, | ||
| 6278 | process_vm_readv = 504, | ||
| 6279 | process_vm_writev = 505, | ||
| 6280 | kcmp = 506, | ||
| 6281 | finit_module = 507, | ||
| 6282 | sched_setattr = 508, | ||
| 6283 | sched_getattr = 509, | ||
| 6284 | renameat2 = 510, | ||
| 6285 | getrandom = 511, | ||
| 6286 | memfd_create = 512, | ||
| 6287 | execveat = 513, | ||
| 6288 | seccomp = 514, | ||
| 6289 | bpf = 515, | ||
| 6290 | userfaultfd = 516, | ||
| 6291 | membarrier = 517, | ||
| 6292 | mlock2 = 518, | ||
| 6293 | copy_file_range = 519, | ||
| 6294 | preadv2 = 520, | ||
| 6295 | pwritev2 = 521, | ||
| 6296 | statx = 522, | ||
| 6297 | io_pgetevents = 523, | ||
| 6298 | pkey_mprotect = 524, | ||
| 6299 | pkey_alloc = 525, | ||
| 6300 | pkey_free = 526, | ||
| 6301 | rseq = 527, | ||
| 6302 | statfs64 = 528, | ||
| 6303 | fstatfs64 = 529, | ||
| 6304 | getegid = 530, | ||
| 6305 | geteuid = 531, | ||
| 6306 | getppid = 532, | ||
| 6307 | pidfd_send_signal = 534, | ||
| 6308 | io_uring_setup = 535, | ||
| 6309 | io_uring_enter = 536, | ||
| 6310 | io_uring_register = 537, | ||
| 6311 | open_tree = 538, | ||
| 6312 | move_mount = 539, | ||
| 6313 | fsopen = 540, | ||
| 6314 | fsconfig = 541, | ||
| 6315 | fsmount = 542, | ||
| 6316 | fspick = 543, | ||
| 6317 | pidfd_open = 544, | ||
| 6318 | clone3 = 545, | ||
| 6319 | close_range = 546, | ||
| 6320 | openat2 = 547, | ||
| 6321 | pidfd_getfd = 548, | ||
| 6322 | faccessat2 = 549, | ||
| 6323 | process_madvise = 550, | ||
| 6324 | epoll_pwait2 = 551, | ||
| 6325 | mount_setattr = 552, | ||
| 6326 | quotactl_fd = 553, | ||
| 6327 | landlock_create_ruleset = 554, | ||
| 6328 | landlock_add_rule = 555, | ||
| 6329 | landlock_restrict_self = 556, | ||
| 6330 | process_mrelease = 558, | ||
| 6331 | futex_waitv = 559, | ||
| 6332 | set_mempolicy_home_node = 560, | ||
| 6333 | cachestat = 561, | ||
| 6334 | fchmodat2 = 562, | ||
| 6335 | map_shadow_stack = 563, | ||
| 6336 | futex_wake = 564, | ||
| 6337 | futex_wait = 565, | ||
| 6338 | futex_requeue = 566, | ||
| 6339 | statmount = 567, | ||
| 6340 | listmount = 568, | ||
| 6341 | lsm_get_self_attr = 569, | ||
| 6342 | lsm_set_self_attr = 570, | ||
| 6343 | lsm_list_modules = 571, | ||
| 6344 | mseal = 572, | ||
| 6345 | setxattrat = 573, | ||
| 6346 | getxattrat = 574, | ||
| 6347 | listxattrat = 575, | ||
| 6348 | removexattrat = 576, | ||
| 6349 | open_tree_attr = 577, | ||
| 6350 | file_getattr = 578, | ||
| 6351 | file_setattr = 579, | ||
| 6352 | listns = 580, | ||
| 6353 | rseq_slice_yield = 581, | ||
| 6354 | }; | ||
| 6355 | |||
| 5854 | pub const Arm64 = enum(usize) { | 6356 | pub const Arm64 = enum(usize) { |
| 5855 | io_setup = 0, | 6357 | io_setup = 0, |
| 5856 | io_destroy = 1, | 6358 | io_destroy = 1, |
lib/std/os/linux/tls.zig+1-1| ... | @@ -256,7 +256,7 @@ pub fn setThreadPointer(addr: usize) void { | ... | @@ -256,7 +256,7 @@ pub fn setThreadPointer(addr: usize) void { |
| 256 | }, | 256 | }, |
| 257 | .alpha => { | 257 | .alpha => { |
| 258 | asm volatile ( | 258 | asm volatile ( |
| 259 | \\ lda a0, %[addr] | 259 | \\ lda $16, 0(%[addr]) |
| 260 | \\ wruniq | 260 | \\ wruniq |
| 261 | : | 261 | : |
| 262 | : [addr] "r" (addr), | 262 | : [addr] "r" (addr), |
tools/generate_linux_syscalls.zig+1| ... | @@ -156,6 +156,7 @@ const architectures: []const Arch = &.{ | ... | @@ -156,6 +156,7 @@ const architectures: []const Arch = &.{ |
| 156 | .{ .@"var" = "PowerPC64", .table = .{ .specific = "arch/powerpc/kernel/syscalls/syscall.tbl" }, .abi = &.{ .common, .@"64", .nospu } }, | 156 | .{ .@"var" = "PowerPC64", .table = .{ .specific = "arch/powerpc/kernel/syscalls/syscall.tbl" }, .abi = &.{ .common, .@"64", .nospu } }, |
| 157 | .{ .@"var" = "S390x", .table = .{ .specific = "arch/s390/kernel/syscalls/syscall.tbl" }, .abi = &.{ .common, .@"64" } }, | 157 | .{ .@"var" = "S390x", .table = .{ .specific = "arch/s390/kernel/syscalls/syscall.tbl" }, .abi = &.{ .common, .@"64" } }, |
| 158 | .{ .@"var" = "Xtensa", .table = .{ .specific = "arch/xtensa/kernel/syscalls/syscall.tbl" } }, | 158 | .{ .@"var" = "Xtensa", .table = .{ .specific = "arch/xtensa/kernel/syscalls/syscall.tbl" } }, |
| 159 | .{ .@"var" = "Alpha", .table = .{ .specific = "arch/alpha/kernel/syscalls/syscall.tbl" } }, | ||
| 159 | .{ .@"var" = "Arm64", .table = .generic, .abi = &.{ .common, .@"64", .renameat, .rlimit, .memfd_secret } }, | 160 | .{ .@"var" = "Arm64", .table = .generic, .abi = &.{ .common, .@"64", .renameat, .rlimit, .memfd_secret } }, |
| 160 | .{ .@"var" = "RiscV32", .table = .generic, .abi = &.{ .common, .@"32", .riscv, .memfd_secret } }, | 161 | .{ .@"var" = "RiscV32", .table = .generic, .abi = &.{ .common, .@"32", .riscv, .memfd_secret } }, |
| 161 | .{ .@"var" = "RiscV64", .table = .generic, .abi = &.{ .common, .@"64", .riscv, .rlimit, .memfd_secret } }, | 162 | .{ .@"var" = "RiscV64", .table = .generic, .abi = &.{ .common, .@"64", .riscv, .rlimit, .memfd_secret } }, |