authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2020-04-21 18:42:21+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-24 15:28:55-04:00
logc829f2f7b7c5bdd13d3c39ae2960ed108393a210
treef93b1df14908722f4e587f438102813067e3a4c6
parenta9eb4a6740e0bb00e1984de3768a7de6001c25dd

Add mips support to standard library


24 files changed, 842 insertions(+), 718 deletions(-)

lib/std/bloom_filter.zig+3
......@@ -160,6 +160,9 @@ fn hashFunc(out: []u8, Ki: usize, in: []const u8) void {
160160}
161161
162162test "std.BloomFilter" {
163 // https://github.com/ziglang/zig/issues/5127
164 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
165
163166 inline for ([_]type{ bool, u1, u2, u3, u4 }) |Cell| {
164167 const emptyCell = if (Cell == bool) false else @as(Cell, 0);
165168 const BF = BloomFilter(128 * 8, 8, Cell, builtin.endian, hashFunc);
lib/std/crypto/gimli.zig+6
......@@ -162,6 +162,9 @@ pub fn hash(out: []u8, in: []const u8) void {
162162}
163163
164164test "hash" {
165 // https://github.com/ziglang/zig/issues/5127
166 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
167
165168 // a test vector (30) from NIST KAT submission.
166169 var msg: [58 / 2]u8 = undefined;
167170 try std.fmt.hexToBytes(&msg, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C");
......@@ -307,6 +310,9 @@ pub const Aead = struct {
307310};
308311
309312test "cipher" {
313 // https://github.com/ziglang/zig/issues/5127
314 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
315
310316 var key: [32]u8 = undefined;
311317 try std.fmt.hexToBytes(&key, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F");
312318 var nonce: [16]u8 = undefined;
lib/std/fmt.zig+1-1
......@@ -1661,7 +1661,7 @@ test "positional/alignment/width/precision" {
16611661}
16621662
16631663test "vector" {
1664 if (builtin.arch == .mipsel) {
1664 if (builtin.arch == .mipsel or builtin.arch == .mips) {
16651665 // https://github.com/ziglang/zig/issues/3317
16661666 return error.SkipZigTest;
16671667 }
lib/std/hash/auto_hash.zig+1-1
......@@ -357,7 +357,7 @@ test "testHash union" {
357357
358358test "testHash vector" {
359359 // Disabled because of #3317
360 if (@import("builtin").arch == .mipsel) return error.SkipZigTest;
360 if (@import("builtin").arch == .mipsel or @import("builtin").arch == .mips) return error.SkipZigTest;
361361
362362 const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
363363 const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
lib/std/hash_map.zig+3
......@@ -463,6 +463,9 @@ test "basic hash map usage" {
463463}
464464
465465test "iterator hash map" {
466 // https://github.com/ziglang/zig/issues/5127
467 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
468
466469 var reset_map = AutoHashMap(i32, i32).init(std.testing.allocator);
467470 defer reset_map.deinit();
468471
lib/std/io/test.zig+3
......@@ -126,6 +126,9 @@ test "File seek ops" {
126126}
127127
128128test "setEndPos" {
129 // https://github.com/ziglang/zig/issues/5127
130 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
131
129132 const tmp_file_name = "temp_test_file.txt";
130133 var file = try fs.cwd().createFile(tmp_file_name, .{});
131134 defer {
lib/std/json.zig+6
......@@ -2249,6 +2249,9 @@ test "integer after float has proper type" {
22492249}
22502250
22512251test "escaped characters" {
2252 // https://github.com/ziglang/zig/issues/5127
2253 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
2254
22522255 var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
22532256 defer arena_allocator.deinit();
22542257 const input =
......@@ -2281,6 +2284,9 @@ test "escaped characters" {
22812284}
22822285
22832286test "string copy option" {
2287 // https://github.com/ziglang/zig/issues/5127
2288 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
2289
22842290 const input =
22852291 \\{
22862292 \\ "noescape": "aą😂",
lib/std/json/test.zig+69
......@@ -332,12 +332,18 @@ test "y_string_1_2_3_bytes_UTF-8_sequences" {
332332}
333333
334334test "y_string_accepted_surrogate_pair" {
335 // https://github.com/ziglang/zig/issues/5127
336 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
337
335338 ok(
336339 \\["\uD801\udc37"]
337340 );
338341}
339342
340343test "y_string_accepted_surrogate_pairs" {
344 // https://github.com/ziglang/zig/issues/5127
345 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
346
341347 ok(
342348 \\["\ud83d\ude39\ud83d\udc8d"]
343349 );
......@@ -404,6 +410,9 @@ test "y_string_in_array_with_leading_space" {
404410}
405411
406412test "y_string_last_surrogates_1_and_2" {
413 // https://github.com/ziglang/zig/issues/5127
414 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
415
407416 ok(
408417 \\["\uDBFF\uDFFF"]
409418 );
......@@ -464,6 +473,9 @@ test "y_string_space" {
464473}
465474
466475test "y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" {
476 // https://github.com/ziglang/zig/issues/5127
477 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
478
467479 ok(
468480 \\["\uD834\uDd1e"]
469481 );
......@@ -506,60 +518,90 @@ test "y_string_unescaped_char_delete" {
506518}
507519
508520test "y_string_unicode_2" {
521 // https://github.com/ziglang/zig/issues/5127
522 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
523
509524 ok(
510525 \\["⍂㈴⍂"]
511526 );
512527}
513528
514529test "y_string_unicodeEscapedBackslash" {
530 // https://github.com/ziglang/zig/issues/5127
531 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
532
515533 ok(
516534 \\["\u005C"]
517535 );
518536}
519537
520538test "y_string_unicode_escaped_double_quote" {
539 // https://github.com/ziglang/zig/issues/5127
540 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
541
521542 ok(
522543 \\["\u0022"]
523544 );
524545}
525546
526547test "y_string_unicode" {
548 // https://github.com/ziglang/zig/issues/5127
549 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
550
527551 ok(
528552 \\["\uA66D"]
529553 );
530554}
531555
532556test "y_string_unicode_U+10FFFE_nonchar" {
557 // https://github.com/ziglang/zig/issues/5127
558 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
559
533560 ok(
534561 \\["\uDBFF\uDFFE"]
535562 );
536563}
537564
538565test "y_string_unicode_U+1FFFE_nonchar" {
566 // https://github.com/ziglang/zig/issues/5127
567 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
568
539569 ok(
540570 \\["\uD83F\uDFFE"]
541571 );
542572}
543573
544574test "y_string_unicode_U+200B_ZERO_WIDTH_SPACE" {
575 // https://github.com/ziglang/zig/issues/5127
576 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
577
545578 ok(
546579 \\["\u200B"]
547580 );
548581}
549582
550583test "y_string_unicode_U+2064_invisible_plus" {
584 // https://github.com/ziglang/zig/issues/5127
585 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
586
551587 ok(
552588 \\["\u2064"]
553589 );
554590}
555591
556592test "y_string_unicode_U+FDD0_nonchar" {
593 // https://github.com/ziglang/zig/issues/5127
594 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
595
557596 ok(
558597 \\["\uFDD0"]
559598 );
560599}
561600
562601test "y_string_unicode_U+FFFE_nonchar" {
602 // https://github.com/ziglang/zig/issues/5127
603 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
604
563605 ok(
564606 \\["\uFFFE"]
565607 );
......@@ -1811,42 +1853,63 @@ test "i_object_key_lone_2nd_surrogate" {
18111853}
18121854
18131855test "i_string_1st_surrogate_but_2nd_missing" {
1856 // https://github.com/ziglang/zig/issues/5127
1857 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1858
18141859 anyStreamingErrNonStreaming(
18151860 \\["\uDADA"]
18161861 );
18171862}
18181863
18191864test "i_string_1st_valid_surrogate_2nd_invalid" {
1865 // https://github.com/ziglang/zig/issues/5127
1866 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1867
18201868 anyStreamingErrNonStreaming(
18211869 \\["\uD888\u1234"]
18221870 );
18231871}
18241872
18251873test "i_string_incomplete_surrogate_and_escape_valid" {
1874 // https://github.com/ziglang/zig/issues/5127
1875 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1876
18261877 anyStreamingErrNonStreaming(
18271878 \\["\uD800\n"]
18281879 );
18291880}
18301881
18311882test "i_string_incomplete_surrogate_pair" {
1883 // https://github.com/ziglang/zig/issues/5127
1884 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1885
18321886 anyStreamingErrNonStreaming(
18331887 \\["\uDd1ea"]
18341888 );
18351889}
18361890
18371891test "i_string_incomplete_surrogates_escape_valid" {
1892 // https://github.com/ziglang/zig/issues/5127
1893 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1894
18381895 anyStreamingErrNonStreaming(
18391896 \\["\uD800\uD800\n"]
18401897 );
18411898}
18421899
18431900test "i_string_invalid_lonely_surrogate" {
1901 // https://github.com/ziglang/zig/issues/5127
1902 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1903
18441904 anyStreamingErrNonStreaming(
18451905 \\["\ud800"]
18461906 );
18471907}
18481908
18491909test "i_string_invalid_surrogate" {
1910 // https://github.com/ziglang/zig/issues/5127
1911 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1912
18501913 anyStreamingErrNonStreaming(
18511914 \\["\ud800abc"]
18521915 );
......@@ -1859,6 +1922,9 @@ test "i_string_invalid_utf-8" {
18591922}
18601923
18611924test "i_string_inverted_surrogates_U+1D11E" {
1925 // https://github.com/ziglang/zig/issues/5127
1926 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1927
18621928 anyStreamingErrNonStreaming(
18631929 \\["\uDd1e\uD834"]
18641930 );
......@@ -1871,6 +1937,9 @@ test "i_string_iso_latin_1" {
18711937}
18721938
18731939test "i_string_lone_second_surrogate" {
1940 // https://github.com/ziglang/zig/issues/5127
1941 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
1942
18741943 anyStreamingErrNonStreaming(
18751944 \\["\uDFAA"]
18761945 );
lib/std/os/bits/linux.zig+1-1
......@@ -14,7 +14,7 @@ pub usingnamespace switch (builtin.arch) {
1414 .aarch64 => @import("linux/arm64.zig"),
1515 .arm => @import("linux/arm-eabi.zig"),
1616 .riscv64 => @import("linux/riscv64.zig"),
17 .mipsel => @import("linux/mipsel.zig"),
17 .mips, .mipsel => @import("linux/mips.zig"),
1818 else => struct {},
1919};
2020
lib/std/os/bits/linux/mips.zig created+543
......@@ -0,0 +1,543 @@
1const std = @import("../../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9
10pub const SYS = extern enum(usize) {
11 pub const Linux = 4000;
12
13 syscall = Linux + 0,
14 exit = Linux + 1,
15 fork = Linux + 2,
16 read = Linux + 3,
17 write = Linux + 4,
18 open = Linux + 5,
19 close = Linux + 6,
20 waitpid = Linux + 7,
21 creat = Linux + 8,
22 link = Linux + 9,
23 unlink = Linux + 10,
24 execve = Linux + 11,
25 chdir = Linux + 12,
26 time = Linux + 13,
27 mknod = Linux + 14,
28 chmod = Linux + 15,
29 lchown = Linux + 16,
30 @"break" = Linux + 17,
31 unused18 = Linux + 18,
32 lseek = Linux + 19,
33 getpid = Linux + 20,
34 mount = Linux + 21,
35 umount = Linux + 22,
36 setuid = Linux + 23,
37 getuid = Linux + 24,
38 stime = Linux + 25,
39 ptrace = Linux + 26,
40 alarm = Linux + 27,
41 unused28 = Linux + 28,
42 pause = Linux + 29,
43 utime = Linux + 30,
44 stty = Linux + 31,
45 gtty = Linux + 32,
46 access = Linux + 33,
47 nice = Linux + 34,
48 ftime = Linux + 35,
49 sync = Linux + 36,
50 kill = Linux + 37,
51 rename = Linux + 38,
52 mkdir = Linux + 39,
53 rmdir = Linux + 40,
54 dup = Linux + 41,
55 pipe = Linux + 42,
56 times = Linux + 43,
57 prof = Linux + 44,
58 brk = Linux + 45,
59 setgid = Linux + 46,
60 getgid = Linux + 47,
61 signal = Linux + 48,
62 geteuid = Linux + 49,
63 getegid = Linux + 50,
64 acct = Linux + 51,
65 umount2 = Linux + 52,
66 lock = Linux + 53,
67 ioctl = Linux + 54,
68 fcntl = Linux + 55,
69 mpx = Linux + 56,
70 setpgid = Linux + 57,
71 ulimit = Linux + 58,
72 unused59 = Linux + 59,
73 umask = Linux + 60,
74 chroot = Linux + 61,
75 ustat = Linux + 62,
76 dup2 = Linux + 63,
77 getppid = Linux + 64,
78 getpgrp = Linux + 65,
79 setsid = Linux + 66,
80 sigaction = Linux + 67,
81 sgetmask = Linux + 68,
82 ssetmask = Linux + 69,
83 setreuid = Linux + 70,
84 setregid = Linux + 71,
85 sigsuspend = Linux + 72,
86 sigpending = Linux + 73,
87 sethostname = Linux + 74,
88 setrlimit = Linux + 75,
89 getrlimit = Linux + 76,
90 getrusage = Linux + 77,
91 gettimeofday = Linux + 78,
92 settimeofday = Linux + 79,
93 getgroups = Linux + 80,
94 setgroups = Linux + 81,
95 reserved82 = Linux + 82,
96 symlink = Linux + 83,
97 unused84 = Linux + 84,
98 readlink = Linux + 85,
99 uselib = Linux + 86,
100 swapon = Linux + 87,
101 reboot = Linux + 88,
102 readdir = Linux + 89,
103 mmap = Linux + 90,
104 munmap = Linux + 91,
105 truncate = Linux + 92,
106 ftruncate = Linux + 93,
107 fchmod = Linux + 94,
108 fchown = Linux + 95,
109 getpriority = Linux + 96,
110 setpriority = Linux + 97,
111 profil = Linux + 98,
112 statfs = Linux + 99,
113 fstatfs = Linux + 100,
114 ioperm = Linux + 101,
115 socketcall = Linux + 102,
116 syslog = Linux + 103,
117 setitimer = Linux + 104,
118 getitimer = Linux + 105,
119 stat = Linux + 106,
120 lstat = Linux + 107,
121 fstat = Linux + 108,
122 unused109 = Linux + 109,
123 iopl = Linux + 110,
124 vhangup = Linux + 111,
125 idle = Linux + 112,
126 vm86 = Linux + 113,
127 wait4 = Linux + 114,
128 swapoff = Linux + 115,
129 sysinfo = Linux + 116,
130 ipc = Linux + 117,
131 fsync = Linux + 118,
132 sigreturn = Linux + 119,
133 clone = Linux + 120,
134 setdomainname = Linux + 121,
135 uname = Linux + 122,
136 modify_ldt = Linux + 123,
137 adjtimex = Linux + 124,
138 mprotect = Linux + 125,
139 sigprocmask = Linux + 126,
140 create_module = Linux + 127,
141 init_module = Linux + 128,
142 delete_module = Linux + 129,
143 get_kernel_syms = Linux + 130,
144 quotactl = Linux + 131,
145 getpgid = Linux + 132,
146 fchdir = Linux + 133,
147 bdflush = Linux + 134,
148 sysfs = Linux + 135,
149 personality = Linux + 136,
150 afs_syscall = Linux + 137,
151 setfsuid = Linux + 138,
152 setfsgid = Linux + 139,
153 _llseek = Linux + 140,
154 getdents = Linux + 141,
155 _newselect = Linux + 142,
156 flock = Linux + 143,
157 msync = Linux + 144,
158 readv = Linux + 145,
159 writev = Linux + 146,
160 cacheflush = Linux + 147,
161 cachectl = Linux + 148,
162 sysmips = Linux + 149,
163 unused150 = Linux + 150,
164 getsid = Linux + 151,
165 fdatasync = Linux + 152,
166 _sysctl = Linux + 153,
167 mlock = Linux + 154,
168 munlock = Linux + 155,
169 mlockall = Linux + 156,
170 munlockall = Linux + 157,
171 sched_setparam = Linux + 158,
172 sched_getparam = Linux + 159,
173 sched_setscheduler = Linux + 160,
174 sched_getscheduler = Linux + 161,
175 sched_yield = Linux + 162,
176 sched_get_priority_max = Linux + 163,
177 sched_get_priority_min = Linux + 164,
178 sched_rr_get_interval = Linux + 165,
179 nanosleep = Linux + 166,
180 mremap = Linux + 167,
181 accept = Linux + 168,
182 bind = Linux + 169,
183 connect = Linux + 170,
184 getpeername = Linux + 171,
185 getsockname = Linux + 172,
186 getsockopt = Linux + 173,
187 listen = Linux + 174,
188 recv = Linux + 175,
189 recvfrom = Linux + 176,
190 recvmsg = Linux + 177,
191 send = Linux + 178,
192 sendmsg = Linux + 179,
193 sendto = Linux + 180,
194 setsockopt = Linux + 181,
195 shutdown = Linux + 182,
196 socket = Linux + 183,
197 socketpair = Linux + 184,
198 setresuid = Linux + 185,
199 getresuid = Linux + 186,
200 query_module = Linux + 187,
201 poll = Linux + 188,
202 nfsservctl = Linux + 189,
203 setresgid = Linux + 190,
204 getresgid = Linux + 191,
205 prctl = Linux + 192,
206 rt_sigreturn = Linux + 193,
207 rt_sigaction = Linux + 194,
208 rt_sigprocmask = Linux + 195,
209 rt_sigpending = Linux + 196,
210 rt_sigtimedwait = Linux + 197,
211 rt_sigqueueinfo = Linux + 198,
212 rt_sigsuspend = Linux + 199,
213 pread64 = Linux + 200,
214 pwrite64 = Linux + 201,
215 chown = Linux + 202,
216 getcwd = Linux + 203,
217 capget = Linux + 204,
218 capset = Linux + 205,
219 sigaltstack = Linux + 206,
220 sendfile = Linux + 207,
221 getpmsg = Linux + 208,
222 putpmsg = Linux + 209,
223 mmap2 = Linux + 210,
224 truncate64 = Linux + 211,
225 ftruncate64 = Linux + 212,
226 stat64 = Linux + 213,
227 lstat64 = Linux + 214,
228 fstat64 = Linux + 215,
229 pivot_root = Linux + 216,
230 mincore = Linux + 217,
231 madvise = Linux + 218,
232 getdents64 = Linux + 219,
233 fcntl64 = Linux + 220,
234 reserved221 = Linux + 221,
235 gettid = Linux + 222,
236 readahead = Linux + 223,
237 setxattr = Linux + 224,
238 lsetxattr = Linux + 225,
239 fsetxattr = Linux + 226,
240 getxattr = Linux + 227,
241 lgetxattr = Linux + 228,
242 fgetxattr = Linux + 229,
243 listxattr = Linux + 230,
244 llistxattr = Linux + 231,
245 flistxattr = Linux + 232,
246 removexattr = Linux + 233,
247 lremovexattr = Linux + 234,
248 fremovexattr = Linux + 235,
249 tkill = Linux + 236,
250 sendfile64 = Linux + 237,
251 futex = Linux + 238,
252 sched_setaffinity = Linux + 239,
253 sched_getaffinity = Linux + 240,
254 io_setup = Linux + 241,
255 io_destroy = Linux + 242,
256 io_getevents = Linux + 243,
257 io_submit = Linux + 244,
258 io_cancel = Linux + 245,
259 exit_group = Linux + 246,
260 lookup_dcookie = Linux + 247,
261 epoll_create = Linux + 248,
262 epoll_ctl = Linux + 249,
263 epoll_wait = Linux + 250,
264 remap_file_pages = Linux + 251,
265 set_tid_address = Linux + 252,
266 restart_syscall = Linux + 253,
267 fadvise64 = Linux + 254,
268 statfs64 = Linux + 255,
269 fstatfs64 = Linux + 256,
270 timer_create = Linux + 257,
271 timer_settime = Linux + 258,
272 timer_gettime = Linux + 259,
273 timer_getoverrun = Linux + 260,
274 timer_delete = Linux + 261,
275 clock_settime = Linux + 262,
276 clock_gettime = Linux + 263,
277 clock_getres = Linux + 264,
278 clock_nanosleep = Linux + 265,
279 tgkill = Linux + 266,
280 utimes = Linux + 267,
281 mbind = Linux + 268,
282 get_mempolicy = Linux + 269,
283 set_mempolicy = Linux + 270,
284 mq_open = Linux + 271,
285 mq_unlink = Linux + 272,
286 mq_timedsend = Linux + 273,
287 mq_timedreceive = Linux + 274,
288 mq_notify = Linux + 275,
289 mq_getsetattr = Linux + 276,
290 vserver = Linux + 277,
291 waitid = Linux + 278,
292 add_key = Linux + 280,
293 request_key = Linux + 281,
294 keyctl = Linux + 282,
295 set_thread_area = Linux + 283,
296 inotify_init = Linux + 284,
297 inotify_add_watch = Linux + 285,
298 inotify_rm_watch = Linux + 286,
299 migrate_pages = Linux + 287,
300 openat = Linux + 288,
301 mkdirat = Linux + 289,
302 mknodat = Linux + 290,
303 fchownat = Linux + 291,
304 futimesat = Linux + 292,
305 fstatat64 = Linux + 293,
306 unlinkat = Linux + 294,
307 renameat = Linux + 295,
308 linkat = Linux + 296,
309 symlinkat = Linux + 297,
310 readlinkat = Linux + 298,
311 fchmodat = Linux + 299,
312 faccessat = Linux + 300,
313 pselect6 = Linux + 301,
314 ppoll = Linux + 302,
315 unshare = Linux + 303,
316 splice = Linux + 304,
317 sync_file_range = Linux + 305,
318 tee = Linux + 306,
319 vmsplice = Linux + 307,
320 move_pages = Linux + 308,
321 set_robust_list = Linux + 309,
322 get_robust_list = Linux + 310,
323 kexec_load = Linux + 311,
324 getcpu = Linux + 312,
325 epoll_pwait = Linux + 313,
326 ioprio_set = Linux + 314,
327 ioprio_get = Linux + 315,
328 utimensat = Linux + 316,
329 signalfd = Linux + 317,
330 timerfd = Linux + 318,
331 eventfd = Linux + 319,
332 fallocate = Linux + 320,
333 timerfd_create = Linux + 321,
334 timerfd_gettime = Linux + 322,
335 timerfd_settime = Linux + 323,
336 signalfd4 = Linux + 324,
337 eventfd2 = Linux + 325,
338 epoll_create1 = Linux + 326,
339 dup3 = Linux + 327,
340 pipe2 = Linux + 328,
341 inotify_init1 = Linux + 329,
342 preadv = Linux + 330,
343 pwritev = Linux + 331,
344 rt_tgsigqueueinfo = Linux + 332,
345 perf_event_open = Linux + 333,
346 accept4 = Linux + 334,
347 recvmmsg = Linux + 335,
348 fanotify_init = Linux + 336,
349 fanotify_mark = Linux + 337,
350 prlimit64 = Linux + 338,
351 name_to_handle_at = Linux + 339,
352 open_by_handle_at = Linux + 340,
353 clock_adjtime = Linux + 341,
354 syncfs = Linux + 342,
355 sendmmsg = Linux + 343,
356 setns = Linux + 344,
357 process_vm_readv = Linux + 345,
358 process_vm_writev = Linux + 346,
359 kcmp = Linux + 347,
360 finit_module = Linux + 348,
361 sched_setattr = Linux + 349,
362 sched_getattr = Linux + 350,
363 renameat2 = Linux + 351,
364 seccomp = Linux + 352,
365 getrandom = Linux + 353,
366 memfd_create = Linux + 354,
367 bpf = Linux + 355,
368 execveat = Linux + 356,
369 userfaultfd = Linux + 357,
370 membarrier = Linux + 358,
371 mlock2 = Linux + 359,
372 copy_file_range = Linux + 360,
373 preadv2 = Linux + 361,
374 pwritev2 = Linux + 362,
375 pkey_mprotect = Linux + 363,
376 pkey_alloc = Linux + 364,
377 pkey_free = Linux + 365,
378 statx = Linux + 366,
379 rseq = Linux + 367,
380 io_pgetevents = Linux + 368,
381 openat2 = Linux + 437,
382 pidfd_getfd = Linux + 438,
383
384 _,
385};
386
387pub const O_CREAT = 0o0400;
388pub const O_EXCL = 0o02000;
389pub const O_NOCTTY = 0o04000;
390pub const O_TRUNC = 0o01000;
391pub const O_APPEND = 0o0010;
392pub const O_NONBLOCK = 0o0200;
393pub const O_DSYNC = 0o0020;
394pub const O_SYNC = 0o040020;
395pub const O_RSYNC = 0o040020;
396pub const O_DIRECTORY = 0o0200000;
397pub const O_NOFOLLOW = 0o0400000;
398pub const O_CLOEXEC = 0o02000000;
399
400pub const O_ASYNC = 0o010000;
401pub const O_DIRECT = 0o0100000;
402pub const O_LARGEFILE = 0o020000;
403pub const O_NOATIME = 0o01000000;
404pub const O_PATH = 0o010000000;
405pub const O_TMPFILE = 0o020200000;
406pub const O_NDELAY = O_NONBLOCK;
407
408pub const F_DUPFD = 0;
409pub const F_GETFD = 1;
410pub const F_SETFD = 2;
411pub const F_GETFL = 3;
412pub const F_SETFL = 4;
413
414pub const F_SETOWN = 24;
415pub const F_GETOWN = 23;
416pub const F_SETSIG = 10;
417pub const F_GETSIG = 11;
418
419pub const F_GETLK = 33;
420pub const F_SETLK = 34;
421pub const F_SETLKW = 35;
422
423pub const F_RDLCK = 0;
424pub const F_WRLCK = 1;
425pub const F_UNLCK = 2;
426
427pub const LOCK_SH = 1;
428pub const LOCK_EX = 2;
429pub const LOCK_UN = 8;
430pub const LOCK_NB = 4;
431
432pub const F_SETOWN_EX = 15;
433pub const F_GETOWN_EX = 16;
434
435pub const F_GETOWNER_UIDS = 17;
436
437pub const MMAP2_UNIT = 4096;
438
439pub const MAP_NORESERVE = 0x0400;
440pub const MAP_GROWSDOWN = 0x1000;
441pub const MAP_DENYWRITE = 0x2000;
442pub const MAP_EXECUTABLE = 0x4000;
443pub const MAP_LOCKED = 0x8000;
444pub const MAP_32BIT = 0x40;
445
446pub const SO_DEBUG = 1;
447pub const SO_REUSEADDR = 0x0004;
448pub const SO_KEEPALIVE = 0x0008;
449pub const SO_DONTROUTE = 0x0010;
450pub const SO_BROADCAST = 0x0020;
451pub const SO_LINGER = 0x0080;
452pub const SO_OOBINLINE = 0x0100;
453pub const SO_REUSEPORT = 0x0200;
454pub const SO_SNDBUF = 0x1001;
455pub const SO_RCVBUF = 0x1002;
456pub const SO_SNDLOWAT = 0x1003;
457pub const SO_RCVLOWAT = 0x1004;
458pub const SO_RCVTIMEO = 0x1006;
459pub const SO_SNDTIMEO = 0x1005;
460pub const SO_ERROR = 0x1007;
461pub const SO_TYPE = 0x1008;
462pub const SO_ACCEPTCONN = 0x1009;
463pub const SO_PROTOCOL = 0x1028;
464pub const SO_DOMAIN = 0x1029;
465pub const SO_NO_CHECK = 11;
466pub const SO_PRIORITY = 12;
467pub const SO_BSDCOMPAT = 14;
468pub const SO_PASSCRED = 17;
469pub const SO_PEERCRED = 18;
470pub const SO_PEERSEC = 30;
471pub const SO_SNDBUFFORCE = 31;
472pub const SO_RCVBUFFORCE = 33;
473
474pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
475pub const VDSO_CGT_VER = "LINUX_2.6.39";
476
477pub const Flock = extern struct {
478 l_type: i16,
479 l_whence: i16,
480 __pad0: [4]u8,
481 l_start: off_t,
482 l_len: off_t,
483 l_pid: pid_t,
484 __unused: [4]u8,
485};
486
487pub const blksize_t = i32;
488pub const nlink_t = u32;
489pub const time_t = isize;
490pub const mode_t = u32;
491pub const off_t = i64;
492pub const ino_t = u64;
493pub const dev_t = usize;
494pub const blkcnt_t = i64;
495
496pub const Stat = extern struct {
497 dev: u32,
498 __pad0: [3]u32,
499 ino: ino_t,
500 mode: mode_t,
501 nlink: nlink_t,
502 uid: uid_t,
503 gid: gid_t,
504 rdev: dev_t,
505 __pad1: [3]u32,
506 size: off_t,
507 atim: timespec,
508 mtim: timespec,
509 ctim: timespec,
510 blksize: blksize_t,
511 __pad3: [1]u32,
512 blocks: blkcnt_t,
513 __pad4: [14]usize,
514
515 pub fn atime(self: Stat) timespec {
516 return self.atim;
517 }
518
519 pub fn mtime(self: Stat) timespec {
520 return self.mtim;
521 }
522
523 pub fn ctime(self: Stat) timespec {
524 return self.ctim;
525 }
526};
527
528pub const timespec = extern struct {
529 tv_sec: isize,
530 tv_nsec: isize,
531};
532
533pub const timeval = extern struct {
534 tv_sec: isize,
535 tv_usec: isize,
536};
537
538pub const timezone = extern struct {
539 tz_minuteswest: i32,
540 tz_dsttime: i32,
541};
542
543pub const Elf_Symndx = u32;
lib/std/os/bits/linux/mipsel.zig deleted-543
......@@ -1,543 +0,0 @@
1const std = @import("../../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9
10pub const SYS = extern enum(usize) {
11 pub const Linux = 4000;
12
13 syscall = Linux + 0,
14 exit = Linux + 1,
15 fork = Linux + 2,
16 read = Linux + 3,
17 write = Linux + 4,
18 open = Linux + 5,
19 close = Linux + 6,
20 waitpid = Linux + 7,
21 creat = Linux + 8,
22 link = Linux + 9,
23 unlink = Linux + 10,
24 execve = Linux + 11,
25 chdir = Linux + 12,
26 time = Linux + 13,
27 mknod = Linux + 14,
28 chmod = Linux + 15,
29 lchown = Linux + 16,
30 @"break" = Linux + 17,
31 unused18 = Linux + 18,
32 lseek = Linux + 19,
33 getpid = Linux + 20,
34 mount = Linux + 21,
35 umount = Linux + 22,
36 setuid = Linux + 23,
37 getuid = Linux + 24,
38 stime = Linux + 25,
39 ptrace = Linux + 26,
40 alarm = Linux + 27,
41 unused28 = Linux + 28,
42 pause = Linux + 29,
43 utime = Linux + 30,
44 stty = Linux + 31,
45 gtty = Linux + 32,
46 access = Linux + 33,
47 nice = Linux + 34,
48 ftime = Linux + 35,
49 sync = Linux + 36,
50 kill = Linux + 37,
51 rename = Linux + 38,
52 mkdir = Linux + 39,
53 rmdir = Linux + 40,
54 dup = Linux + 41,
55 pipe = Linux + 42,
56 times = Linux + 43,
57 prof = Linux + 44,
58 brk = Linux + 45,
59 setgid = Linux + 46,
60 getgid = Linux + 47,
61 signal = Linux + 48,
62 geteuid = Linux + 49,
63 getegid = Linux + 50,
64 acct = Linux + 51,
65 umount2 = Linux + 52,
66 lock = Linux + 53,
67 ioctl = Linux + 54,
68 fcntl = Linux + 55,
69 mpx = Linux + 56,
70 setpgid = Linux + 57,
71 ulimit = Linux + 58,
72 unused59 = Linux + 59,
73 umask = Linux + 60,
74 chroot = Linux + 61,
75 ustat = Linux + 62,
76 dup2 = Linux + 63,
77 getppid = Linux + 64,
78 getpgrp = Linux + 65,
79 setsid = Linux + 66,
80 sigaction = Linux + 67,
81 sgetmask = Linux + 68,
82 ssetmask = Linux + 69,
83 setreuid = Linux + 70,
84 setregid = Linux + 71,
85 sigsuspend = Linux + 72,
86 sigpending = Linux + 73,
87 sethostname = Linux + 74,
88 setrlimit = Linux + 75,
89 getrlimit = Linux + 76,
90 getrusage = Linux + 77,
91 gettimeofday = Linux + 78,
92 settimeofday = Linux + 79,
93 getgroups = Linux + 80,
94 setgroups = Linux + 81,
95 reserved82 = Linux + 82,
96 symlink = Linux + 83,
97 unused84 = Linux + 84,
98 readlink = Linux + 85,
99 uselib = Linux + 86,
100 swapon = Linux + 87,
101 reboot = Linux + 88,
102 readdir = Linux + 89,
103 mmap = Linux + 90,
104 munmap = Linux + 91,
105 truncate = Linux + 92,
106 ftruncate = Linux + 93,
107 fchmod = Linux + 94,
108 fchown = Linux + 95,
109 getpriority = Linux + 96,
110 setpriority = Linux + 97,
111 profil = Linux + 98,
112 statfs = Linux + 99,
113 fstatfs = Linux + 100,
114 ioperm = Linux + 101,
115 socketcall = Linux + 102,
116 syslog = Linux + 103,
117 setitimer = Linux + 104,
118 getitimer = Linux + 105,
119 stat = Linux + 106,
120 lstat = Linux + 107,
121 fstat = Linux + 108,
122 unused109 = Linux + 109,
123 iopl = Linux + 110,
124 vhangup = Linux + 111,
125 idle = Linux + 112,
126 vm86 = Linux + 113,
127 wait4 = Linux + 114,
128 swapoff = Linux + 115,
129 sysinfo = Linux + 116,
130 ipc = Linux + 117,
131 fsync = Linux + 118,
132 sigreturn = Linux + 119,
133 clone = Linux + 120,
134 setdomainname = Linux + 121,
135 uname = Linux + 122,
136 modify_ldt = Linux + 123,
137 adjtimex = Linux + 124,
138 mprotect = Linux + 125,
139 sigprocmask = Linux + 126,
140 create_module = Linux + 127,
141 init_module = Linux + 128,
142 delete_module = Linux + 129,
143 get_kernel_syms = Linux + 130,
144 quotactl = Linux + 131,
145 getpgid = Linux + 132,
146 fchdir = Linux + 133,
147 bdflush = Linux + 134,
148 sysfs = Linux + 135,
149 personality = Linux + 136,
150 afs_syscall = Linux + 137,
151 setfsuid = Linux + 138,
152 setfsgid = Linux + 139,
153 _llseek = Linux + 140,
154 getdents = Linux + 141,
155 _newselect = Linux + 142,
156 flock = Linux + 143,
157 msync = Linux + 144,
158 readv = Linux + 145,
159 writev = Linux + 146,
160 cacheflush = Linux + 147,
161 cachectl = Linux + 148,
162 sysmips = Linux + 149,
163 unused150 = Linux + 150,
164 getsid = Linux + 151,
165 fdatasync = Linux + 152,
166 _sysctl = Linux + 153,
167 mlock = Linux + 154,
168 munlock = Linux + 155,
169 mlockall = Linux + 156,
170 munlockall = Linux + 157,
171 sched_setparam = Linux + 158,
172 sched_getparam = Linux + 159,
173 sched_setscheduler = Linux + 160,
174 sched_getscheduler = Linux + 161,
175 sched_yield = Linux + 162,
176 sched_get_priority_max = Linux + 163,
177 sched_get_priority_min = Linux + 164,
178 sched_rr_get_interval = Linux + 165,
179 nanosleep = Linux + 166,
180 mremap = Linux + 167,
181 accept = Linux + 168,
182 bind = Linux + 169,
183 connect = Linux + 170,
184 getpeername = Linux + 171,
185 getsockname = Linux + 172,
186 getsockopt = Linux + 173,
187 listen = Linux + 174,
188 recv = Linux + 175,
189 recvfrom = Linux + 176,
190 recvmsg = Linux + 177,
191 send = Linux + 178,
192 sendmsg = Linux + 179,
193 sendto = Linux + 180,
194 setsockopt = Linux + 181,
195 shutdown = Linux + 182,
196 socket = Linux + 183,
197 socketpair = Linux + 184,
198 setresuid = Linux + 185,
199 getresuid = Linux + 186,
200 query_module = Linux + 187,
201 poll = Linux + 188,
202 nfsservctl = Linux + 189,
203 setresgid = Linux + 190,
204 getresgid = Linux + 191,
205 prctl = Linux + 192,
206 rt_sigreturn = Linux + 193,
207 rt_sigaction = Linux + 194,
208 rt_sigprocmask = Linux + 195,
209 rt_sigpending = Linux + 196,
210 rt_sigtimedwait = Linux + 197,
211 rt_sigqueueinfo = Linux + 198,
212 rt_sigsuspend = Linux + 199,
213 pread64 = Linux + 200,
214 pwrite64 = Linux + 201,
215 chown = Linux + 202,
216 getcwd = Linux + 203,
217 capget = Linux + 204,
218 capset = Linux + 205,
219 sigaltstack = Linux + 206,
220 sendfile = Linux + 207,
221 getpmsg = Linux + 208,
222 putpmsg = Linux + 209,
223 mmap2 = Linux + 210,
224 truncate64 = Linux + 211,
225 ftruncate64 = Linux + 212,
226 stat64 = Linux + 213,
227 lstat64 = Linux + 214,
228 fstat64 = Linux + 215,
229 pivot_root = Linux + 216,
230 mincore = Linux + 217,
231 madvise = Linux + 218,
232 getdents64 = Linux + 219,
233 fcntl64 = Linux + 220,
234 reserved221 = Linux + 221,
235 gettid = Linux + 222,
236 readahead = Linux + 223,
237 setxattr = Linux + 224,
238 lsetxattr = Linux + 225,
239 fsetxattr = Linux + 226,
240 getxattr = Linux + 227,
241 lgetxattr = Linux + 228,
242 fgetxattr = Linux + 229,
243 listxattr = Linux + 230,
244 llistxattr = Linux + 231,
245 flistxattr = Linux + 232,
246 removexattr = Linux + 233,
247 lremovexattr = Linux + 234,
248 fremovexattr = Linux + 235,
249 tkill = Linux + 236,
250 sendfile64 = Linux + 237,
251 futex = Linux + 238,
252 sched_setaffinity = Linux + 239,
253 sched_getaffinity = Linux + 240,
254 io_setup = Linux + 241,
255 io_destroy = Linux + 242,
256 io_getevents = Linux + 243,
257 io_submit = Linux + 244,
258 io_cancel = Linux + 245,
259 exit_group = Linux + 246,
260 lookup_dcookie = Linux + 247,
261 epoll_create = Linux + 248,
262 epoll_ctl = Linux + 249,
263 epoll_wait = Linux + 250,
264 remap_file_pages = Linux + 251,
265 set_tid_address = Linux + 252,
266 restart_syscall = Linux + 253,
267 fadvise64 = Linux + 254,
268 statfs64 = Linux + 255,
269 fstatfs64 = Linux + 256,
270 timer_create = Linux + 257,
271 timer_settime = Linux + 258,
272 timer_gettime = Linux + 259,
273 timer_getoverrun = Linux + 260,
274 timer_delete = Linux + 261,
275 clock_settime = Linux + 262,
276 clock_gettime = Linux + 263,
277 clock_getres = Linux + 264,
278 clock_nanosleep = Linux + 265,
279 tgkill = Linux + 266,
280 utimes = Linux + 267,
281 mbind = Linux + 268,
282 get_mempolicy = Linux + 269,
283 set_mempolicy = Linux + 270,
284 mq_open = Linux + 271,
285 mq_unlink = Linux + 272,
286 mq_timedsend = Linux + 273,
287 mq_timedreceive = Linux + 274,
288 mq_notify = Linux + 275,
289 mq_getsetattr = Linux + 276,
290 vserver = Linux + 277,
291 waitid = Linux + 278,
292 add_key = Linux + 280,
293 request_key = Linux + 281,
294 keyctl = Linux + 282,
295 set_thread_area = Linux + 283,
296 inotify_init = Linux + 284,
297 inotify_add_watch = Linux + 285,
298 inotify_rm_watch = Linux + 286,
299 migrate_pages = Linux + 287,
300 openat = Linux + 288,
301 mkdirat = Linux + 289,
302 mknodat = Linux + 290,
303 fchownat = Linux + 291,
304 futimesat = Linux + 292,
305 fstatat64 = Linux + 293,
306 unlinkat = Linux + 294,
307 renameat = Linux + 295,
308 linkat = Linux + 296,
309 symlinkat = Linux + 297,
310 readlinkat = Linux + 298,
311 fchmodat = Linux + 299,
312 faccessat = Linux + 300,
313 pselect6 = Linux + 301,
314 ppoll = Linux + 302,
315 unshare = Linux + 303,
316 splice = Linux + 304,
317 sync_file_range = Linux + 305,
318 tee = Linux + 306,
319 vmsplice = Linux + 307,
320 move_pages = Linux + 308,
321 set_robust_list = Linux + 309,
322 get_robust_list = Linux + 310,
323 kexec_load = Linux + 311,
324 getcpu = Linux + 312,
325 epoll_pwait = Linux + 313,
326 ioprio_set = Linux + 314,
327 ioprio_get = Linux + 315,
328 utimensat = Linux + 316,
329 signalfd = Linux + 317,
330 timerfd = Linux + 318,
331 eventfd = Linux + 319,
332 fallocate = Linux + 320,
333 timerfd_create = Linux + 321,
334 timerfd_gettime = Linux + 322,
335 timerfd_settime = Linux + 323,
336 signalfd4 = Linux + 324,
337 eventfd2 = Linux + 325,
338 epoll_create1 = Linux + 326,
339 dup3 = Linux + 327,
340 pipe2 = Linux + 328,
341 inotify_init1 = Linux + 329,
342 preadv = Linux + 330,
343 pwritev = Linux + 331,
344 rt_tgsigqueueinfo = Linux + 332,
345 perf_event_open = Linux + 333,
346 accept4 = Linux + 334,
347 recvmmsg = Linux + 335,
348 fanotify_init = Linux + 336,
349 fanotify_mark = Linux + 337,
350 prlimit64 = Linux + 338,
351 name_to_handle_at = Linux + 339,
352 open_by_handle_at = Linux + 340,
353 clock_adjtime = Linux + 341,
354 syncfs = Linux + 342,
355 sendmmsg = Linux + 343,
356 setns = Linux + 344,
357 process_vm_readv = Linux + 345,
358 process_vm_writev = Linux + 346,
359 kcmp = Linux + 347,
360 finit_module = Linux + 348,
361 sched_setattr = Linux + 349,
362 sched_getattr = Linux + 350,
363 renameat2 = Linux + 351,
364 seccomp = Linux + 352,
365 getrandom = Linux + 353,
366 memfd_create = Linux + 354,
367 bpf = Linux + 355,
368 execveat = Linux + 356,
369 userfaultfd = Linux + 357,
370 membarrier = Linux + 358,
371 mlock2 = Linux + 359,
372 copy_file_range = Linux + 360,
373 preadv2 = Linux + 361,
374 pwritev2 = Linux + 362,
375 pkey_mprotect = Linux + 363,
376 pkey_alloc = Linux + 364,
377 pkey_free = Linux + 365,
378 statx = Linux + 366,
379 rseq = Linux + 367,
380 io_pgetevents = Linux + 368,
381 openat2 = Linux + 437,
382 pidfd_getfd = Linux + 438,
383
384 _,
385};
386
387pub const O_CREAT = 0o0400;
388pub const O_EXCL = 0o02000;
389pub const O_NOCTTY = 0o04000;
390pub const O_TRUNC = 0o01000;
391pub const O_APPEND = 0o0010;
392pub const O_NONBLOCK = 0o0200;
393pub const O_DSYNC = 0o0020;
394pub const O_SYNC = 0o040020;
395pub const O_RSYNC = 0o040020;
396pub const O_DIRECTORY = 0o0200000;
397pub const O_NOFOLLOW = 0o0400000;
398pub const O_CLOEXEC = 0o02000000;
399
400pub const O_ASYNC = 0o010000;
401pub const O_DIRECT = 0o0100000;
402pub const O_LARGEFILE = 0o020000;
403pub const O_NOATIME = 0o01000000;
404pub const O_PATH = 0o010000000;
405pub const O_TMPFILE = 0o020200000;
406pub const O_NDELAY = O_NONBLOCK;
407
408pub const F_DUPFD = 0;
409pub const F_GETFD = 1;
410pub const F_SETFD = 2;
411pub const F_GETFL = 3;
412pub const F_SETFL = 4;
413
414pub const F_SETOWN = 24;
415pub const F_GETOWN = 23;
416pub const F_SETSIG = 10;
417pub const F_GETSIG = 11;
418
419pub const F_GETLK = 33;
420pub const F_SETLK = 34;
421pub const F_SETLKW = 35;
422
423pub const F_RDLCK = 0;
424pub const F_WRLCK = 1;
425pub const F_UNLCK = 2;
426
427pub const LOCK_SH = 1;
428pub const LOCK_EX = 2;
429pub const LOCK_UN = 8;
430pub const LOCK_NB = 4;
431
432pub const F_SETOWN_EX = 15;
433pub const F_GETOWN_EX = 16;
434
435pub const F_GETOWNER_UIDS = 17;
436
437pub const MMAP2_UNIT = 4096;
438
439pub const MAP_NORESERVE = 0x0400;
440pub const MAP_GROWSDOWN = 0x1000;
441pub const MAP_DENYWRITE = 0x2000;
442pub const MAP_EXECUTABLE = 0x4000;
443pub const MAP_LOCKED = 0x8000;
444pub const MAP_32BIT = 0x40;
445
446pub const SO_DEBUG = 1;
447pub const SO_REUSEADDR = 0x0004;
448pub const SO_KEEPALIVE = 0x0008;
449pub const SO_DONTROUTE = 0x0010;
450pub const SO_BROADCAST = 0x0020;
451pub const SO_LINGER = 0x0080;
452pub const SO_OOBINLINE = 0x0100;
453pub const SO_REUSEPORT = 0x0200;
454pub const SO_SNDBUF = 0x1001;
455pub const SO_RCVBUF = 0x1002;
456pub const SO_SNDLOWAT = 0x1003;
457pub const SO_RCVLOWAT = 0x1004;
458pub const SO_RCVTIMEO = 0x1006;
459pub const SO_SNDTIMEO = 0x1005;
460pub const SO_ERROR = 0x1007;
461pub const SO_TYPE = 0x1008;
462pub const SO_ACCEPTCONN = 0x1009;
463pub const SO_PROTOCOL = 0x1028;
464pub const SO_DOMAIN = 0x1029;
465pub const SO_NO_CHECK = 11;
466pub const SO_PRIORITY = 12;
467pub const SO_BSDCOMPAT = 14;
468pub const SO_PASSCRED = 17;
469pub const SO_PEERCRED = 18;
470pub const SO_PEERSEC = 30;
471pub const SO_SNDBUFFORCE = 31;
472pub const SO_RCVBUFFORCE = 33;
473
474pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
475pub const VDSO_CGT_VER = "LINUX_2.6.39";
476
477pub const Flock = extern struct {
478 l_type: i16,
479 l_whence: i16,
480 __pad0: [4]u8,
481 l_start: off_t,
482 l_len: off_t,
483 l_pid: pid_t,
484 __unused: [4]u8,
485};
486
487pub const blksize_t = i32;
488pub const nlink_t = u32;
489pub const time_t = isize;
490pub const mode_t = u32;
491pub const off_t = i64;
492pub const ino_t = u64;
493pub const dev_t = usize;
494pub const blkcnt_t = i64;
495
496pub const Stat = extern struct {
497 dev: u32,
498 __pad0: [3]u32,
499 ino: ino_t,
500 mode: mode_t,
501 nlink: nlink_t,
502 uid: uid_t,
503 gid: gid_t,
504 rdev: dev_t,
505 __pad1: [3]u32,
506 size: off_t,
507 atim: timespec,
508 mtim: timespec,
509 ctim: timespec,
510 blksize: blksize_t,
511 __pad3: [1]u32,
512 blocks: blkcnt_t,
513 __pad4: [14]usize,
514
515 pub fn atime(self: Stat) timespec {
516 return self.atim;
517 }
518
519 pub fn mtime(self: Stat) timespec {
520 return self.mtim;
521 }
522
523 pub fn ctime(self: Stat) timespec {
524 return self.ctim;
525 }
526};
527
528pub const timespec = extern struct {
529 tv_sec: isize,
530 tv_nsec: isize,
531};
532
533pub const timeval = extern struct {
534 tv_sec: isize,
535 tv_usec: isize,
536};
537
538pub const timezone = extern struct {
539 tz_minuteswest: i32,
540 tz_dsttime: i32,
541};
542
543pub const Elf_Symndx = u32;
lib/std/os/linux.zig+1-1
......@@ -19,7 +19,7 @@ pub usingnamespace switch (builtin.arch) {
1919 .aarch64 => @import("linux/arm64.zig"),
2020 .arm => @import("linux/arm-eabi.zig"),
2121 .riscv64 => @import("linux/riscv64.zig"),
22 .mipsel => @import("linux/mipsel.zig"),
22 .mips, .mipsel => @import("linux/mips.zig"),
2323 else => struct {},
2424};
2525pub usingnamespace @import("bits.zig");
lib/std/os/linux/mips.zig created+161
......@@ -0,0 +1,161 @@
1usingnamespace @import("../bits.zig");
2
3pub fn syscall0(number: SYS) usize {
4 return asm volatile (
5 \\ syscall
6 \\ blez $7, 1f
7 \\ subu $2, $0, $2
8 \\ 1:
9 : [ret] "={$2}" (-> usize)
10 : [number] "{$2}" (@enumToInt(number))
11 : "memory", "cc", "$7"
12 );
13}
14
15pub fn syscall_pipe(fd: *[2]i32) usize {
16 return asm volatile (
17 \\ .set noat
18 \\ .set noreorder
19 \\ syscall
20 \\ blez $7, 1f
21 \\ nop
22 \\ b 2f
23 \\ subu $2, $0, $2
24 \\ 1:
25 \\ sw $2, 0($4)
26 \\ sw $3, 4($4)
27 \\ 2:
28 : [ret] "={$2}" (-> usize)
29 : [number] "{$2}" (@enumToInt(SYS.pipe))
30 : "memory", "cc", "$7"
31 );
32}
33
34pub fn syscall1(number: SYS, arg1: usize) usize {
35 return asm volatile (
36 \\ syscall
37 \\ blez $7, 1f
38 \\ subu $2, $0, $2
39 \\ 1:
40 : [ret] "={$2}" (-> usize)
41 : [number] "{$2}" (@enumToInt(number)),
42 [arg1] "{$4}" (arg1)
43 : "memory", "cc", "$7"
44 );
45}
46
47pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
48 return asm volatile (
49 \\ syscall
50 \\ blez $7, 1f
51 \\ subu $2, $0, $2
52 \\ 1:
53 : [ret] "={$2}" (-> usize)
54 : [number] "{$2}" (@enumToInt(number)),
55 [arg1] "{$4}" (arg1),
56 [arg2] "{$5}" (arg2)
57 : "memory", "cc", "$7"
58 );
59}
60
61pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
62 return asm volatile (
63 \\ syscall
64 \\ blez $7, 1f
65 \\ subu $2, $0, $2
66 \\ 1:
67 : [ret] "={$2}" (-> usize)
68 : [number] "{$2}" (@enumToInt(number)),
69 [arg1] "{$4}" (arg1),
70 [arg2] "{$5}" (arg2),
71 [arg3] "{$6}" (arg3)
72 : "memory", "cc", "$7"
73 );
74}
75
76pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
77 return asm volatile (
78 \\ syscall
79 \\ blez $7, 1f
80 \\ subu $2, $0, $2
81 \\ 1:
82 : [ret] "={$2}" (-> usize)
83 : [number] "{$2}" (@enumToInt(number)),
84 [arg1] "{$4}" (arg1),
85 [arg2] "{$5}" (arg2),
86 [arg3] "{$6}" (arg3),
87 [arg4] "{$7}" (arg4)
88 : "memory", "cc", "$7"
89 );
90}
91
92pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
93 return asm volatile (
94 \\ .set noat
95 \\ subu $sp, $sp, 24
96 \\ sw %[arg5], 16($sp)
97 \\ syscall
98 \\ addu $sp, $sp, 24
99 \\ blez $7, 1f
100 \\ subu $2, $0, $2
101 \\ 1:
102 : [ret] "={$2}" (-> usize)
103 : [number] "{$2}" (@enumToInt(number)),
104 [arg1] "{$4}" (arg1),
105 [arg2] "{$5}" (arg2),
106 [arg3] "{$6}" (arg3),
107 [arg4] "{$7}" (arg4),
108 [arg5] "r" (arg5)
109 : "memory", "cc", "$7"
110 );
111}
112
113pub fn syscall6(
114 number: SYS,
115 arg1: usize,
116 arg2: usize,
117 arg3: usize,
118 arg4: usize,
119 arg5: usize,
120 arg6: usize,
121) usize {
122 return asm volatile (
123 \\ .set noat
124 \\ subu $sp, $sp, 24
125 \\ sw %[arg5], 16($sp)
126 \\ sw %[arg6], 20($sp)
127 \\ syscall
128 \\ addu $sp, $sp, 24
129 \\ blez $7, 1f
130 \\ subu $2, $0, $2
131 \\ 1:
132 : [ret] "={$2}" (-> usize)
133 : [number] "{$2}" (@enumToInt(number)),
134 [arg1] "{$4}" (arg1),
135 [arg2] "{$5}" (arg2),
136 [arg3] "{$6}" (arg3),
137 [arg4] "{$7}" (arg4),
138 [arg5] "r" (arg5),
139 [arg6] "r" (arg6)
140 : "memory", "cc", "$7"
141 );
142}
143
144/// This matches the libc clone function.
145pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
146
147pub fn restore() callconv(.Naked) void {
148 return asm volatile ("syscall"
149 :
150 : [number] "{$2}" (@enumToInt(SYS.sigreturn))
151 : "memory", "cc", "$7"
152 );
153}
154
155pub fn restore_rt() callconv(.Naked) void {
156 return asm volatile ("syscall"
157 :
158 : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn))
159 : "memory", "cc", "$7"
160 );
161}
lib/std/os/linux/mipsel.zig deleted-161
......@@ -1,161 +0,0 @@
1usingnamespace @import("../bits.zig");
2
3pub fn syscall0(number: SYS) usize {
4 return asm volatile (
5 \\ syscall
6 \\ blez $7, 1f
7 \\ subu $2, $0, $2
8 \\ 1:
9 : [ret] "={$2}" (-> usize)
10 : [number] "{$2}" (@enumToInt(number))
11 : "memory", "cc", "$7"
12 );
13}
14
15pub fn syscall_pipe(fd: *[2]i32) usize {
16 return asm volatile (
17 \\ .set noat
18 \\ .set noreorder
19 \\ syscall
20 \\ blez $7, 1f
21 \\ nop
22 \\ b 2f
23 \\ subu $2, $0, $2
24 \\ 1:
25 \\ sw $2, 0($4)
26 \\ sw $3, 4($4)
27 \\ 2:
28 : [ret] "={$2}" (-> usize)
29 : [number] "{$2}" (@enumToInt(SYS.pipe))
30 : "memory", "cc", "$7"
31 );
32}
33
34pub fn syscall1(number: SYS, arg1: usize) usize {
35 return asm volatile (
36 \\ syscall
37 \\ blez $7, 1f
38 \\ subu $2, $0, $2
39 \\ 1:
40 : [ret] "={$2}" (-> usize)
41 : [number] "{$2}" (@enumToInt(number)),
42 [arg1] "{$4}" (arg1)
43 : "memory", "cc", "$7"
44 );
45}
46
47pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
48 return asm volatile (
49 \\ syscall
50 \\ blez $7, 1f
51 \\ subu $2, $0, $2
52 \\ 1:
53 : [ret] "={$2}" (-> usize)
54 : [number] "{$2}" (@enumToInt(number)),
55 [arg1] "{$4}" (arg1),
56 [arg2] "{$5}" (arg2)
57 : "memory", "cc", "$7"
58 );
59}
60
61pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
62 return asm volatile (
63 \\ syscall
64 \\ blez $7, 1f
65 \\ subu $2, $0, $2
66 \\ 1:
67 : [ret] "={$2}" (-> usize)
68 : [number] "{$2}" (@enumToInt(number)),
69 [arg1] "{$4}" (arg1),
70 [arg2] "{$5}" (arg2),
71 [arg3] "{$6}" (arg3)
72 : "memory", "cc", "$7"
73 );
74}
75
76pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
77 return asm volatile (
78 \\ syscall
79 \\ blez $7, 1f
80 \\ subu $2, $0, $2
81 \\ 1:
82 : [ret] "={$2}" (-> usize)
83 : [number] "{$2}" (@enumToInt(number)),
84 [arg1] "{$4}" (arg1),
85 [arg2] "{$5}" (arg2),
86 [arg3] "{$6}" (arg3),
87 [arg4] "{$7}" (arg4)
88 : "memory", "cc", "$7"
89 );
90}
91
92pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
93 return asm volatile (
94 \\ .set noat
95 \\ subu $sp, $sp, 24
96 \\ sw %[arg5], 16($sp)
97 \\ syscall
98 \\ addu $sp, $sp, 24
99 \\ blez $7, 1f
100 \\ subu $2, $0, $2
101 \\ 1:
102 : [ret] "={$2}" (-> usize)
103 : [number] "{$2}" (@enumToInt(number)),
104 [arg1] "{$4}" (arg1),
105 [arg2] "{$5}" (arg2),
106 [arg3] "{$6}" (arg3),
107 [arg4] "{$7}" (arg4),
108 [arg5] "r" (arg5)
109 : "memory", "cc", "$7"
110 );
111}
112
113pub fn syscall6(
114 number: SYS,
115 arg1: usize,
116 arg2: usize,
117 arg3: usize,
118 arg4: usize,
119 arg5: usize,
120 arg6: usize,
121) usize {
122 return asm volatile (
123 \\ .set noat
124 \\ subu $sp, $sp, 24
125 \\ sw %[arg5], 16($sp)
126 \\ sw %[arg6], 20($sp)
127 \\ syscall
128 \\ addu $sp, $sp, 24
129 \\ blez $7, 1f
130 \\ subu $2, $0, $2
131 \\ 1:
132 : [ret] "={$2}" (-> usize)
133 : [number] "{$2}" (@enumToInt(number)),
134 [arg1] "{$4}" (arg1),
135 [arg2] "{$5}" (arg2),
136 [arg3] "{$6}" (arg3),
137 [arg4] "{$7}" (arg4),
138 [arg5] "r" (arg5),
139 [arg6] "r" (arg6)
140 : "memory", "cc", "$7"
141 );
142}
143
144/// This matches the libc clone function.
145pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
146
147pub fn restore() callconv(.Naked) void {
148 return asm volatile ("syscall"
149 :
150 : [number] "{$2}" (@enumToInt(SYS.sigreturn))
151 : "memory", "cc", "$7"
152 );
153}
154
155pub fn restore_rt() callconv(.Naked) void {
156 return asm volatile ("syscall"
157 :
158 : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn))
159 : "memory", "cc", "$7"
160 );
161}
lib/std/os/linux/tls.zig+5-5
......@@ -48,7 +48,7 @@ const TLSVariant = enum {
4848};
4949
5050const tls_variant = switch (builtin.arch) {
51 .arm, .armeb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mipsel => TLSVariant.VariantI,
51 .arm, .armeb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel => TLSVariant.VariantI,
5252 .x86_64, .i386 => TLSVariant.VariantII,
5353 else => @compileError("undefined tls_variant for this architecture"),
5454};
......@@ -64,7 +64,7 @@ const tls_tcb_size = switch (builtin.arch) {
6464
6565// Controls if the TP points to the end of the TCB instead of its beginning
6666const tls_tp_points_past_tcb = switch (builtin.arch) {
67 .riscv32, .riscv64, .mipsel, .powerpc64, .powerpc64le => true,
67 .riscv32, .riscv64, .mips, .mipsel, .powerpc64, .powerpc64le => true,
6868 else => false,
6969};
7070
......@@ -72,12 +72,12 @@ const tls_tp_points_past_tcb = switch (builtin.arch) {
7272// make the generated code more efficient
7373
7474const tls_tp_offset = switch (builtin.arch) {
75 .mipsel => 0x7000,
75 .mips, .mipsel => 0x7000,
7676 else => 0,
7777};
7878
7979const tls_dtv_offset = switch (builtin.arch) {
80 .mipsel => 0x8000,
80 .mips, .mipsel => 0x8000,
8181 .riscv32, .riscv64 => 0x800,
8282 else => 0,
8383};
......@@ -156,7 +156,7 @@ pub fn setThreadPointer(addr: usize) void {
156156 : [addr] "r" (addr)
157157 );
158158 },
159 .mipsel => {
159 .mips, .mipsel => {
160160 const rc = std.os.linux.syscall1(.set_thread_area, addr);
161161 assert(rc == 0);
162162 },
lib/std/special/c.zig+1-1
......@@ -354,7 +354,7 @@ fn clone() callconv(.Naked) void {
354354 \\ ecall
355355 );
356356 },
357 .mipsel => {
357 .mips, .mipsel => {
358358 asm volatile (
359359 \\ # Save function pointer and argument pointer on new thread stack
360360 \\ and $5, $5, -8
lib/std/start.zig+1-1
......@@ -108,7 +108,7 @@ fn _start() callconv(.Naked) noreturn {
108108 : [argc] "=r" (-> [*]usize)
109109 );
110110 },
111 .mipsel => {
111 .mips, .mipsel => {
112112 // Need noat here because LLVM is free to pick any register
113113 starting_stack_ptr = asm (
114114 \\ .set noat
lib/std/unicode.zig+3
......@@ -660,6 +660,9 @@ fn calcUtf16LeLen(utf8: []const u8) usize {
660660}
661661
662662test "utf8ToUtf16LeStringLiteral" {
663 // https://github.com/ziglang/zig/issues/5127
664 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
665
663666 {
664667 const bytes = [_:0]u16{0x41};
665668 const utf16 = utf8ToUtf16LeStringLiteral("A");
src/analyze.cpp+1-1
......@@ -1007,7 +1007,7 @@ bool want_first_arg_sret(CodeGen *g, FnTypeId *fn_type_id) {
10071007 {
10081008 X64CABIClass abi_class = type_c_abi_x86_64_class(g, fn_type_id->return_type);
10091009 return abi_class == X64CABIClass_MEMORY || abi_class == X64CABIClass_MEMORY_nobyval;
1010 } else if (g->zig_target->arch == ZigLLVM_mipsel) {
1010 } else if (g->zig_target->arch == ZigLLVM_mips || g->zig_target->arch == ZigLLVM_mipsel) {
10111011 return false;
10121012 }
10131013 zig_panic("TODO implement C ABI for this architecture. See https://github.com/ziglang/zig/issues/1481");
test/stage1/behavior/byteswap.zig+1-1
......@@ -43,7 +43,7 @@ test "@byteSwap vectors" {
4343 if (std.Target.current.os.tag == .dragonfly) return error.SkipZigTest;
4444
4545 // https://github.com/ziglang/zig/issues/3317
46 if (std.Target.current.cpu.arch == .mipsel) return error.SkipZigTest;
46 if (std.Target.current.cpu.arch == .mipsel or std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
4747
4848 const ByteSwapVectorTest = struct {
4949 fn run() void {
test/stage1/behavior/cast.zig+3
......@@ -16,6 +16,9 @@ test "integer literal to pointer cast" {
1616}
1717
1818test "pointer reinterpret const float to int" {
19 // https://github.com/ziglang/zig/issues/3345
20 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
21
1922 const float: f64 = 5.99999999999994648725e-01;
2023 const float_ptr = &float;
2124 const int_ptr = @ptrCast(*const i32, float_ptr);
test/stage1/behavior/shuffle.zig+1-1
......@@ -34,7 +34,7 @@ test "@shuffle" {
3434
3535 // bool
3636 // Disabled because of #3317
37 if (@import("builtin").arch != .mipsel) {
37 if (@import("builtin").arch != .mipsel and std.Target.current.cpu.arch != .mips) {
3838 var x2: @Vector(4, bool) = [4]bool{ false, true, false, true };
3939 var v4: @Vector(2, bool) = [2]bool{ true, false };
4040 const mask5: @Vector(4, i32) = [4]i32{ 0, ~@as(i32, 1), 1, 2 };
test/stage1/behavior/union.zig+3
......@@ -623,6 +623,9 @@ test "0-sized extern union definition" {
623623}
624624
625625test "union initializer generates padding only if needed" {
626 // https://github.com/ziglang/zig/issues/5127
627 if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
628
626629 const U = union(enum) {
627630 A: u24,
628631 };
test/tests.zig+25
......@@ -145,6 +145,31 @@ const test_targets = blk: {
145145 // .link_libc = true,
146146 //},
147147
148 TestTarget{
149 .target = .{
150 .cpu_arch = .mips,
151 .os_tag = .linux,
152 .abi = .none,
153 },
154 },
155 TestTarget{
156 .target = .{
157 .cpu_arch = .mips,
158 .os_tag = .linux,
159 .abi = .musl,
160 },
161 .link_libc = true,
162 },
163 // https://github.com/ziglang/zig/issues/4927
164 //TestTarget{
165 // .target = .{
166 // .cpu_arch = .mips,
167 // .os_tag = .linux,
168 // .abi = .gnu,
169 // },
170 // .link_libc = true,
171 //},
172
148173 TestTarget{
149174 .target = .{
150175 .cpu_arch = .mipsel,