Skip to content

Commit 2d33cc2

Browse files
authored
Merge pull request #23376 from sweiglbosker/m68k-archbits
2 parents d8153fa + bcb4ba9 commit 2d33cc2

13 files changed

+324
-51
lines changed

lib/std/c.zig

-4
Original file line numberDiff line numberDiff line change
@@ -1601,10 +1601,6 @@ pub const MSF = switch (native_os) {
16011601
},
16021602
else => void,
16031603
};
1604-
pub const MMAP2_UNIT = switch (native_os) {
1605-
.linux => linux.MMAP2_UNIT,
1606-
else => void,
1607-
};
16081604
pub const NAME_MAX = switch (native_os) {
16091605
.linux => linux.NAME_MAX,
16101606
.emscripten => emscripten.NAME_MAX,

lib/std/os/linux.zig

+32-11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const arch_bits = switch (native_arch) {
3939
.riscv64 => @import("linux/riscv64.zig"),
4040
.sparc64 => @import("linux/sparc64.zig"),
4141
.loongarch64 => @import("linux/loongarch64.zig"),
42+
.m68k => @import("linux/m68k.zig"),
4243
.mips, .mipsel => @import("linux/mips.zig"),
4344
.mips64, .mips64el => @import("linux/mips64.zig"),
4445
.powerpc, .powerpcle => @import("linux/powerpc.zig"),
@@ -92,7 +93,6 @@ pub const Elf_Symndx = arch_bits.Elf_Symndx;
9293
pub const F = arch_bits.F;
9394
pub const Flock = arch_bits.Flock;
9495
pub const HWCAP = arch_bits.HWCAP;
95-
pub const MMAP2_UNIT = arch_bits.MMAP2_UNIT;
9696
pub const REG = arch_bits.REG;
9797
pub const SC = arch_bits.SC;
9898
pub const Stat = arch_bits.Stat;
@@ -279,7 +279,7 @@ pub const MAP = switch (native_arch) {
279279
UNINITIALIZED: bool = false,
280280
_: u5 = 0,
281281
},
282-
.hexagon, .s390x => packed struct(u32) {
282+
.hexagon, .m68k, .s390x => packed struct(u32) {
283283
TYPE: MAP_TYPE,
284284
FIXED: bool = false,
285285
ANONYMOUS: bool = false,
@@ -333,7 +333,7 @@ pub const O = switch (native_arch) {
333333
SYNC: bool = false,
334334
PATH: bool = false,
335335
TMPFILE: bool = false,
336-
_: u9 = 0,
336+
_23: u9 = 0,
337337
},
338338
.x86, .riscv32, .riscv64, .loongarch64 => packed struct(u32) {
339339
ACCMODE: ACCMODE = .RDONLY,
@@ -355,7 +355,7 @@ pub const O = switch (native_arch) {
355355
SYNC: bool = false,
356356
PATH: bool = false,
357357
TMPFILE: bool = false,
358-
_: u9 = 0,
358+
_23: u9 = 0,
359359
},
360360
.aarch64, .aarch64_be, .arm, .armeb, .thumb, .thumbeb => packed struct(u32) {
361361
ACCMODE: ACCMODE = .RDONLY,
@@ -377,7 +377,7 @@ pub const O = switch (native_arch) {
377377
SYNC: bool = false,
378378
PATH: bool = false,
379379
TMPFILE: bool = false,
380-
_: u9 = 0,
380+
_23: u9 = 0,
381381
},
382382
.sparc64 => packed struct(u32) {
383383
ACCMODE: ACCMODE = .RDONLY,
@@ -402,7 +402,7 @@ pub const O = switch (native_arch) {
402402
SYNC: bool = false,
403403
PATH: bool = false,
404404
TMPFILE: bool = false,
405-
_: u6 = 0,
405+
_27: u6 = 0,
406406
},
407407
.mips, .mipsel, .mips64, .mips64el => packed struct(u32) {
408408
ACCMODE: ACCMODE = .RDONLY,
@@ -426,7 +426,7 @@ pub const O = switch (native_arch) {
426426
_20: u1 = 0,
427427
PATH: bool = false,
428428
TMPFILE: bool = false,
429-
_: u9 = 0,
429+
_23: u9 = 0,
430430
},
431431
.powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
432432
ACCMODE: ACCMODE = .RDONLY,
@@ -448,7 +448,7 @@ pub const O = switch (native_arch) {
448448
SYNC: bool = false,
449449
PATH: bool = false,
450450
TMPFILE: bool = false,
451-
_: u9 = 0,
451+
_23: u9 = 0,
452452
},
453453
.hexagon, .s390x => packed struct(u32) {
454454
ACCMODE: ACCMODE = .RDONLY,
@@ -467,15 +467,36 @@ pub const O = switch (native_arch) {
467467
NOFOLLOW: bool = false,
468468
NOATIME: bool = false,
469469
CLOEXEC: bool = false,
470-
_17: u1 = 0,
470+
_20: u1 = 0,
471471
PATH: bool = false,
472-
_: u10 = 0,
472+
_22: u10 = 0,
473473

474474
// #define O_RSYNC 04010000
475475
// #define O_SYNC 04010000
476476
// #define O_TMPFILE 020200000
477477
// #define O_NDELAY O_NONBLOCK
478478
},
479+
.m68k => packed struct(u32) {
480+
ACCMODE: ACCMODE = .RDONLY,
481+
_2: u4 = 0,
482+
CREAT: bool = false,
483+
EXCL: bool = false,
484+
NOCTTY: bool = false,
485+
TRUNC: bool = false,
486+
APPEND: bool = false,
487+
NONBLOCK: bool = false,
488+
DSYNC: bool = false,
489+
ASYNC: bool = false,
490+
DIRECTORY: bool = false,
491+
NOFOLLOW: bool = false,
492+
DIRECT: bool = false,
493+
LARGEFILE: bool = false,
494+
NOATIME: bool = false,
495+
CLOEXEC: bool = false,
496+
_20: u1 = 0,
497+
PATH: bool = false,
498+
_22: u10 = 0,
499+
},
479500
else => @compileError("missing std.os.linux.O constants for this architecture"),
480501
};
481502

@@ -906,7 +927,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: MAP, fd: i32, of
906927
prot,
907928
@as(u32, @bitCast(flags)),
908929
@bitCast(@as(isize, fd)),
909-
@truncate(@as(u64, @bitCast(offset)) / MMAP2_UNIT),
930+
@truncate(@as(u64, @bitCast(offset)) / std.heap.pageSize()),
910931
);
911932
} else {
912933
// The s390x mmap() syscall existed before Linux supported syscalls with 5+ parameters, so

lib/std/os/linux/arm.zig

-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ pub fn restore_rt() callconv(.naked) noreturn {
170170
}
171171
}
172172

173-
pub const MMAP2_UNIT = 4096;
174-
175173
pub const F = struct {
176174
pub const DUPFD = 0;
177175
pub const GETFD = 1;

lib/std/os/linux/hexagon.zig

-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ pub const Stat = extern struct {
251251

252252
pub const Elf_Symndx = u32;
253253

254-
pub const MMAP2_UNIT = 4096;
255-
256254
pub const VDSO = void;
257255

258256
/// TODO

0 commit comments

Comments
 (0)