@zigc/lib 0.17.0-dev.356 → 0.17.0-dev.387
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/std/Target/riscv.zig +97 -0
- package/std/Target.zig +27 -9
- package/std/Thread.zig +2 -2
- package/std/array_list.zig +2 -2
- package/std/atomic.zig +2 -0
- package/std/debug/Dwarf.zig +6 -0
- package/std/debug/SelfInfo/Elf.zig +1 -0
- package/std/debug/cpu_context.zig +168 -3
- package/std/debug.zig +1 -1
- package/std/heap.zig +2 -0
- package/std/lang/assembly.zig +71 -0
- package/std/lang.zig +2 -0
- package/std/os/linux/alpha.zig +358 -0
- package/std/os/linux/arm.zig +0 -26
- package/std/os/linux/ioctl.zig +1 -0
- package/std/os/linux/syscalls.zig +502 -0
- package/std/os/linux/tls.zig +1 -1
- package/std/os/linux.zig +729 -31
- package/std/start.zig +11 -0
- package/std/zig/LibCDirs.zig +1 -0
- package/std/zig/system/linux.zig +4 -0
- package/std/zig/system/loongarch.zig +25 -9
- package/std/zig/system.zig +4 -0
- package/zig.h +24 -2
package/package.json
CHANGED
package/std/Target/riscv.zig
CHANGED
|
@@ -3370,6 +3370,103 @@ pub const cpu = struct {
|
|
|
3370
3370
|
.zvl1024b,
|
|
3371
3371
|
}),
|
|
3372
3372
|
};
|
|
3373
|
+
pub const spacemit_a100: CpuModel = .{
|
|
3374
|
+
.name = "spacemit_a100",
|
|
3375
|
+
.llvm_name = null,
|
|
3376
|
+
.features = featureSet(&[_]Feature{
|
|
3377
|
+
.@"64bit",
|
|
3378
|
+
.a,
|
|
3379
|
+
.b,
|
|
3380
|
+
.c,
|
|
3381
|
+
.dlen_factor_2,
|
|
3382
|
+
.i,
|
|
3383
|
+
.m,
|
|
3384
|
+
.optimized_nf2_segment_load_store,
|
|
3385
|
+
.optimized_nf3_segment_load_store,
|
|
3386
|
+
.optimized_nf4_segment_load_store,
|
|
3387
|
+
.smepmp,
|
|
3388
|
+
.smnpm,
|
|
3389
|
+
.smstateen,
|
|
3390
|
+
.ssccptr,
|
|
3391
|
+
.sscofpmf,
|
|
3392
|
+
.sscounterenw,
|
|
3393
|
+
.ssnpm,
|
|
3394
|
+
.sspm,
|
|
3395
|
+
.sstc,
|
|
3396
|
+
.sstvala,
|
|
3397
|
+
.sstvecd,
|
|
3398
|
+
.ssu64xl,
|
|
3399
|
+
.supm,
|
|
3400
|
+
.svade,
|
|
3401
|
+
.svbare,
|
|
3402
|
+
.svinval,
|
|
3403
|
+
.svnapot,
|
|
3404
|
+
.svpbmt,
|
|
3405
|
+
.unaligned_scalar_mem,
|
|
3406
|
+
.v,
|
|
3407
|
+
.vxrm_pipeline_flush,
|
|
3408
|
+
.za64rs,
|
|
3409
|
+
.zawrs,
|
|
3410
|
+
.zbc,
|
|
3411
|
+
.zbkc,
|
|
3412
|
+
.zcb,
|
|
3413
|
+
.zcmop,
|
|
3414
|
+
.zfa,
|
|
3415
|
+
.zfh,
|
|
3416
|
+
.zic64b,
|
|
3417
|
+
.zicbom,
|
|
3418
|
+
.zicbop,
|
|
3419
|
+
.zicboz,
|
|
3420
|
+
.ziccamoa,
|
|
3421
|
+
.ziccif,
|
|
3422
|
+
.zicclsm,
|
|
3423
|
+
.ziccrse,
|
|
3424
|
+
.zicntr,
|
|
3425
|
+
.zicond,
|
|
3426
|
+
.zifencei,
|
|
3427
|
+
.zihintntl,
|
|
3428
|
+
.zihintpause,
|
|
3429
|
+
.zihpm,
|
|
3430
|
+
.zimop,
|
|
3431
|
+
.zkt,
|
|
3432
|
+
.zvbb,
|
|
3433
|
+
.zvfbfwma,
|
|
3434
|
+
.zvfh,
|
|
3435
|
+
.zvkng,
|
|
3436
|
+
.zvknha,
|
|
3437
|
+
.zvksc,
|
|
3438
|
+
.zvksg,
|
|
3439
|
+
.zvl1024b,
|
|
3440
|
+
}),
|
|
3441
|
+
};
|
|
3442
|
+
pub const spacemit_x100: CpuModel = .{
|
|
3443
|
+
.name = "spacemit_x100",
|
|
3444
|
+
.llvm_name = null,
|
|
3445
|
+
.features = featureSet(&[_]Feature{
|
|
3446
|
+
.dlen_factor_2,
|
|
3447
|
+
.optimized_nf2_segment_load_store,
|
|
3448
|
+
.optimized_nf3_segment_load_store,
|
|
3449
|
+
.optimized_nf4_segment_load_store,
|
|
3450
|
+
.rva23s64,
|
|
3451
|
+
.smepmp,
|
|
3452
|
+
.smnpm,
|
|
3453
|
+
.smstateen,
|
|
3454
|
+
.sspm,
|
|
3455
|
+
.unaligned_scalar_mem,
|
|
3456
|
+
.vxrm_pipeline_flush,
|
|
3457
|
+
.xsmtvdot,
|
|
3458
|
+
.zbc,
|
|
3459
|
+
.zbkc,
|
|
3460
|
+
.zfh,
|
|
3461
|
+
.zvfbfwma,
|
|
3462
|
+
.zvfh,
|
|
3463
|
+
.zvkng,
|
|
3464
|
+
.zvknha,
|
|
3465
|
+
.zvksc,
|
|
3466
|
+
.zvksg,
|
|
3467
|
+
.zvl256b,
|
|
3468
|
+
}),
|
|
3469
|
+
};
|
|
3373
3470
|
pub const spacemit_x60: CpuModel = .{
|
|
3374
3471
|
.name = "spacemit_x60",
|
|
3375
3472
|
.llvm_name = "spacemit-x60",
|
package/std/Target.zig
CHANGED
|
@@ -250,10 +250,12 @@ pub const Os = struct {
|
|
|
250
250
|
win11_ga = 0x0A00000F, //aka win11_22h2
|
|
251
251
|
win11_ge = 0x0A000010, //aka win11_23h2
|
|
252
252
|
win11_dt = 0x0A000011, //aka win11_24h2
|
|
253
|
+
win11_br = 0x0A000012, //aka win11_25h2
|
|
254
|
+
win11_kr = 0x0A000013, //aka win11_26h1
|
|
253
255
|
_,
|
|
254
256
|
|
|
255
257
|
/// Latest Windows version that the Zig Standard Library is aware of
|
|
256
|
-
pub const latest = WindowsVersion.
|
|
258
|
+
pub const latest = WindowsVersion.win11_kr;
|
|
257
259
|
|
|
258
260
|
/// Compared against build numbers reported by the runtime to distinguish win10 versions,
|
|
259
261
|
/// where 0x0A000000 + index corresponds to the WindowsVersion u32 value.
|
|
@@ -276,6 +278,8 @@ pub const Os = struct {
|
|
|
276
278
|
22621, //win11_ga aka win11_22h2
|
|
277
279
|
22631, //win11_ge aka win11_23h2
|
|
278
280
|
26100, //win11_dt aka win11_24h2
|
|
281
|
+
26200, //win11_br aka win11_25h2
|
|
282
|
+
28000, //win11_kr aka win11_26h1
|
|
279
283
|
};
|
|
280
284
|
|
|
281
285
|
/// Returns whether the first version `ver` is newer (greater) than or equal to the second version `ver`.
|
|
@@ -751,6 +755,7 @@ pub const kvx = @import("Target/kvx.zig");
|
|
|
751
755
|
pub const lanai = @import("Target/lanai.zig");
|
|
752
756
|
pub const loongarch = @import("Target/loongarch.zig");
|
|
753
757
|
pub const m68k = @import("Target/m68k.zig");
|
|
758
|
+
pub const m88k = @import("Target/generic.zig");
|
|
754
759
|
pub const microblaze = @import("Target/generic.zig");
|
|
755
760
|
pub const mips = @import("Target/mips.zig");
|
|
756
761
|
pub const msp430 = @import("Target/msp430.zig");
|
|
@@ -798,6 +803,7 @@ pub const Abi = enum {
|
|
|
798
803
|
simulator,
|
|
799
804
|
ohos,
|
|
800
805
|
ohoseabi,
|
|
806
|
+
call0,
|
|
801
807
|
|
|
802
808
|
// LLVM tags deliberately omitted:
|
|
803
809
|
// - amplification
|
|
@@ -1091,6 +1097,7 @@ pub fn toElfMachine(target: *const Target) std.elf.EM {
|
|
|
1091
1097
|
.kvx => .KVX,
|
|
1092
1098
|
.lanai => .LANAI,
|
|
1093
1099
|
.loongarch32, .loongarch64 => .LOONGARCH,
|
|
1100
|
+
.m88k => .@"88K",
|
|
1094
1101
|
.m68k => .@"68K",
|
|
1095
1102
|
.microblaze, .microblazeel => .MICROBLAZE,
|
|
1096
1103
|
.mips, .mips64, .mipsel, .mips64el => .MIPS,
|
|
@@ -1154,6 +1161,7 @@ pub fn toCoffMachine(target: *const Target) std.coff.IMAGE.FILE.MACHINE {
|
|
|
1154
1161
|
.kalimba,
|
|
1155
1162
|
.kvx,
|
|
1156
1163
|
.lanai,
|
|
1164
|
+
.m88k,
|
|
1157
1165
|
.m68k,
|
|
1158
1166
|
.microblaze,
|
|
1159
1167
|
.microblazeel,
|
|
@@ -1364,6 +1372,7 @@ pub const Cpu = struct {
|
|
|
1364
1372
|
loongarch32,
|
|
1365
1373
|
loongarch64,
|
|
1366
1374
|
m68k,
|
|
1375
|
+
m88k,
|
|
1367
1376
|
microblaze,
|
|
1368
1377
|
microblazeel,
|
|
1369
1378
|
mips,
|
|
@@ -1439,6 +1448,7 @@ pub const Cpu = struct {
|
|
|
1439
1448
|
lanai,
|
|
1440
1449
|
loongarch,
|
|
1441
1450
|
m68k,
|
|
1451
|
+
m88k,
|
|
1442
1452
|
microblaze,
|
|
1443
1453
|
mips,
|
|
1444
1454
|
msp430,
|
|
@@ -1477,6 +1487,7 @@ pub const Cpu = struct {
|
|
|
1477
1487
|
.lanai => .lanai,
|
|
1478
1488
|
.loongarch32, .loongarch64 => .loongarch,
|
|
1479
1489
|
.m68k => .m68k,
|
|
1490
|
+
.m88k => .m88k,
|
|
1480
1491
|
.microblaze, .microblazeel => .microblaze,
|
|
1481
1492
|
.mips, .mipsel, .mips64, .mips64el => .mips,
|
|
1482
1493
|
.msp430 => .msp430,
|
|
@@ -1710,6 +1721,7 @@ pub const Cpu = struct {
|
|
|
1710
1721
|
.hppa64,
|
|
1711
1722
|
.lanai,
|
|
1712
1723
|
.m68k,
|
|
1724
|
+
.m88k,
|
|
1713
1725
|
.microblaze,
|
|
1714
1726
|
.mips,
|
|
1715
1727
|
.mips64,
|
|
@@ -1922,6 +1934,9 @@ pub const Cpu = struct {
|
|
|
1922
1934
|
.m68k_interrupt,
|
|
1923
1935
|
=> &.{.m68k},
|
|
1924
1936
|
|
|
1937
|
+
.m88k_sysv,
|
|
1938
|
+
=> &.{.m88k},
|
|
1939
|
+
|
|
1925
1940
|
.microblaze_std,
|
|
1926
1941
|
.microblaze_interrupt,
|
|
1927
1942
|
=> &.{ .microblaze, .microblazeel },
|
|
@@ -2554,6 +2569,7 @@ pub const DynamicLinker = struct {
|
|
|
2554
2569
|
.m68k,
|
|
2555
2570
|
.microblaze,
|
|
2556
2571
|
.microblazeel,
|
|
2572
|
+
.or1k,
|
|
2557
2573
|
.powerpc64,
|
|
2558
2574
|
.powerpc64le,
|
|
2559
2575
|
.s390x,
|
|
@@ -2631,8 +2647,6 @@ pub const DynamicLinker = struct {
|
|
|
2631
2647
|
|
|
2632
2648
|
.arm,
|
|
2633
2649
|
.armeb,
|
|
2634
|
-
.thumb,
|
|
2635
|
-
.thumbeb,
|
|
2636
2650
|
=> initFmt("/lib/ld-linux{s}.so.3", .{switch (abi) {
|
|
2637
2651
|
.gnueabi => "",
|
|
2638
2652
|
.gnueabihf => "-armhf",
|
|
@@ -2641,6 +2655,7 @@ pub const DynamicLinker = struct {
|
|
|
2641
2655
|
|
|
2642
2656
|
.aarch64,
|
|
2643
2657
|
.aarch64_be,
|
|
2658
|
+
.or1k,
|
|
2644
2659
|
=> |arch| if (abi == .gnu) initFmt("/lib/ld-linux-{s}.so.1", .{@tagName(arch)}) else none,
|
|
2645
2660
|
|
|
2646
2661
|
// TODO: `-be` architecture support.
|
|
@@ -2803,6 +2818,7 @@ pub const DynamicLinker = struct {
|
|
|
2803
2818
|
.arm,
|
|
2804
2819
|
.aarch64,
|
|
2805
2820
|
.hppa,
|
|
2821
|
+
.m88k,
|
|
2806
2822
|
.mips64,
|
|
2807
2823
|
.mips64el,
|
|
2808
2824
|
.powerpc,
|
|
@@ -2910,6 +2926,7 @@ pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
|
|
|
2910
2926
|
.lanai,
|
|
2911
2927
|
.loongarch32,
|
|
2912
2928
|
.m68k,
|
|
2929
|
+
.m88k,
|
|
2913
2930
|
.microblaze,
|
|
2914
2931
|
.microblazeel,
|
|
2915
2932
|
.mips,
|
|
@@ -3495,6 +3512,7 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) u16 {
|
|
|
3495
3512
|
.hppa,
|
|
3496
3513
|
.lanai,
|
|
3497
3514
|
.m68k,
|
|
3515
|
+
.m88k,
|
|
3498
3516
|
.mips,
|
|
3499
3517
|
.mipsel,
|
|
3500
3518
|
.nvptx,
|
|
@@ -3604,6 +3622,7 @@ pub fn cTypePreferredAlignment(target: *const Target, c_type: CType) u16 {
|
|
|
3604
3622
|
.hppa,
|
|
3605
3623
|
.lanai,
|
|
3606
3624
|
.m68k,
|
|
3625
|
+
.m88k,
|
|
3607
3626
|
.mips,
|
|
3608
3627
|
.mipsel,
|
|
3609
3628
|
.nvptx,
|
|
@@ -3675,6 +3694,7 @@ pub fn cMaxIntAlignment(target: *const Target) u16 {
|
|
|
3675
3694
|
.lanai,
|
|
3676
3695
|
.loongarch32,
|
|
3677
3696
|
.m68k,
|
|
3697
|
+
.m88k,
|
|
3678
3698
|
.mips,
|
|
3679
3699
|
.mipsel,
|
|
3680
3700
|
.powerpc,
|
|
@@ -3723,7 +3743,7 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
|
|
|
3723
3743
|
.x86_64 => switch (target.os.tag) {
|
|
3724
3744
|
.windows, .uefi => .{ .x86_64_win = .{} },
|
|
3725
3745
|
else => switch (target.abi) {
|
|
3726
|
-
.
|
|
3746
|
+
.gnux32, .muslx32 => .{ .x86_64_x32 = .{} },
|
|
3727
3747
|
else => .{ .x86_64_sysv = .{} },
|
|
3728
3748
|
},
|
|
3729
3749
|
},
|
|
@@ -3752,7 +3772,7 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
|
|
|
3752
3772
|
.riscv32, .riscv32be => .{ .riscv32_ilp32 = .{} },
|
|
3753
3773
|
.sparc64 => .{ .sparc64_sysv = .{} },
|
|
3754
3774
|
.sparc => .{ .sparc_sysv = .{} },
|
|
3755
|
-
.powerpc64 => if (target.abi.isGnu())
|
|
3775
|
+
.powerpc64 => if (target.os.tag == .ps3 or target.abi.isGnu())
|
|
3756
3776
|
.{ .powerpc64_elf = .{} }
|
|
3757
3777
|
else
|
|
3758
3778
|
.{ .powerpc64_elf_v2 = .{} },
|
|
@@ -3774,10 +3794,8 @@ pub fn cCallingConvention(target: *const Target) ?std.builtin.CallingConvention
|
|
|
3774
3794
|
.lanai => .{ .lanai_sysv = .{} },
|
|
3775
3795
|
.loongarch64 => .{ .loongarch64_lp64 = .{} },
|
|
3776
3796
|
.loongarch32 => .{ .loongarch32_ilp32 = .{} },
|
|
3777
|
-
.m68k =>
|
|
3778
|
-
|
|
3779
|
-
else
|
|
3780
|
-
.{ .m68k_sysv = .{} },
|
|
3797
|
+
.m68k => .{ .m68k_gnu = .{} },
|
|
3798
|
+
.m88k => .{ .m88k_sysv = .{} },
|
|
3781
3799
|
.microblaze, .microblazeel => .{ .microblaze_std = .{} },
|
|
3782
3800
|
.msp430 => .{ .msp430_eabi = .{} },
|
|
3783
3801
|
.or1k => .{ .or1k_sysv = .{} },
|
package/std/Thread.zig
CHANGED
|
@@ -1217,8 +1217,8 @@ const LinuxThreadImpl = struct {
|
|
|
1217
1217
|
\\ ldi $16, 0
|
|
1218
1218
|
\\ callsys
|
|
1219
1219
|
:
|
|
1220
|
-
: [ptr] "{
|
|
1221
|
-
[len] "{
|
|
1220
|
+
: [ptr] "{$16}" (@intFromPtr(self.mapped.ptr)),
|
|
1221
|
+
[len] "{$17}" (self.mapped.len),
|
|
1222
1222
|
),
|
|
1223
1223
|
.hexagon => asm volatile (
|
|
1224
1224
|
\\ r6 = #215 // SYS_munmap
|
package/std/array_list.zig
CHANGED
|
@@ -1152,14 +1152,14 @@ pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type {
|
|
|
1152
1152
|
|
|
1153
1153
|
/// Shrinks capacity to match length.
|
|
1154
1154
|
/// May invalidate element pointers.
|
|
1155
|
-
/// If succeds it is safe to call toOwnedSliceAssert
|
|
1155
|
+
/// If succeds it is safe to call `toOwnedSliceAssert`.
|
|
1156
1156
|
pub fn shrinkToLen(self: *Self, gpa: Allocator) Allocator.Error!void {
|
|
1157
1157
|
try self.shrinkAndFreePrecise(gpa, self.items.len);
|
|
1158
1158
|
}
|
|
1159
1159
|
|
|
1160
1160
|
/// Shrinks or expands capacity to match length + 1.
|
|
1161
1161
|
/// May invalidate element pointers.
|
|
1162
|
-
/// If succeds it is safe to call toOwnedSliceSentinelAssert
|
|
1162
|
+
/// If succeds it is safe to call `toOwnedSliceSentinelAssert`.
|
|
1163
1163
|
pub fn shrinkToLenSentinel(self: *Self, gpa: Allocator) Allocator.Error!void {
|
|
1164
1164
|
std.debug.assert(self.items.len <= self.capacity);
|
|
1165
1165
|
const required_len = self.items.len + 1;
|
package/std/atomic.zig
CHANGED
|
@@ -442,10 +442,12 @@ pub fn cacheLineForCpu(cpu: std.Target.Cpu) u16 {
|
|
|
442
442
|
// - https://github.com/torvalds/linux/blob/3a7e02c040b130b5545e4b115aada7bacd80a2b6/arch/sparc/include/asm/cache.h#L14
|
|
443
443
|
// - https://github.com/torvalds/linux/blob/3a7e02c040b130b5545e4b115aada7bacd80a2b6/arch/microblaze/include/asm/cache.h#L15
|
|
444
444
|
// - https://github.com/torvalds/linux/blob/3a7e02c040b130b5545e4b115aada7bacd80a2b6/arch/sh/include/cpu-sh4/cpu/cache.h#L10
|
|
445
|
+
// - https://github.com/openbsd/src/blob/1957873d2063db11dab780eca75b5e629d1e838d/sys/arch/m88k/m88k/atomic.S#L22
|
|
445
446
|
.arm,
|
|
446
447
|
.armeb,
|
|
447
448
|
.thumb,
|
|
448
449
|
.thumbeb,
|
|
450
|
+
.m88k,
|
|
449
451
|
.microblaze,
|
|
450
452
|
.microblazeel,
|
|
451
453
|
.mips,
|
package/std/debug/Dwarf.zig
CHANGED
|
@@ -1436,6 +1436,7 @@ pub fn compactUnwindToDwarfRegNumber(unwind_reg_number: u3) !u16 {
|
|
|
1436
1436
|
pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 {
|
|
1437
1437
|
return switch (arch) {
|
|
1438
1438
|
.aarch64, .aarch64_be => 32,
|
|
1439
|
+
.alpha => 64,
|
|
1439
1440
|
.arc, .arceb => 160,
|
|
1440
1441
|
.arm, .armeb, .thumb, .thumbeb => 15,
|
|
1441
1442
|
.csky => 64,
|
|
@@ -1444,6 +1445,7 @@ pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 {
|
|
|
1444
1445
|
.lanai => 2,
|
|
1445
1446
|
.loongarch32, .loongarch64 => 64,
|
|
1446
1447
|
.m68k => 26,
|
|
1448
|
+
.m88k => 64,
|
|
1447
1449
|
.mips, .mipsel, .mips64, .mips64el => 66,
|
|
1448
1450
|
.or1k => 35,
|
|
1449
1451
|
.powerpc, .powerpcle, .powerpc64, .powerpc64le => 67,
|
|
@@ -1460,6 +1462,7 @@ pub fn ipRegNum(arch: std.Target.Cpu.Arch) ?u16 {
|
|
|
1460
1462
|
pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 {
|
|
1461
1463
|
return switch (arch) {
|
|
1462
1464
|
.aarch64, .aarch64_be => 29,
|
|
1465
|
+
.alpha => 15,
|
|
1463
1466
|
.arc, .arceb => 27,
|
|
1464
1467
|
.arm, .armeb, .thumb, .thumbeb => 11,
|
|
1465
1468
|
.csky => 14,
|
|
@@ -1468,6 +1471,7 @@ pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 {
|
|
|
1468
1471
|
.lanai => 5,
|
|
1469
1472
|
.loongarch32, .loongarch64 => 22,
|
|
1470
1473
|
.m68k => 14,
|
|
1474
|
+
.m88k => 30,
|
|
1471
1475
|
.mips, .mipsel, .mips64, .mips64el => 30,
|
|
1472
1476
|
.or1k => 2,
|
|
1473
1477
|
.powerpc, .powerpcle, .powerpc64, .powerpc64le => 1,
|
|
@@ -1484,6 +1488,7 @@ pub fn fpRegNum(arch: std.Target.Cpu.Arch) u16 {
|
|
|
1484
1488
|
pub fn spRegNum(arch: std.Target.Cpu.Arch) u16 {
|
|
1485
1489
|
return switch (arch) {
|
|
1486
1490
|
.aarch64, .aarch64_be => 31,
|
|
1491
|
+
.alpha => 30,
|
|
1487
1492
|
.arc, .arceb => 28,
|
|
1488
1493
|
.arm, .armeb, .thumb, .thumbeb => 13,
|
|
1489
1494
|
.csky => 14,
|
|
@@ -1492,6 +1497,7 @@ pub fn spRegNum(arch: std.Target.Cpu.Arch) u16 {
|
|
|
1492
1497
|
.lanai => 4,
|
|
1493
1498
|
.loongarch32, .loongarch64 => 3,
|
|
1494
1499
|
.m68k => 15,
|
|
1500
|
+
.m88k => 31,
|
|
1495
1501
|
.mips, .mipsel, .mips64, .mips64el => 29,
|
|
1496
1502
|
.or1k => 1,
|
|
1497
1503
|
.powerpc, .powerpcle, .powerpc64, .powerpc64le => 1,
|
|
@@ -5,6 +5,7 @@ pub const Native = if (@hasDecl(root, "debug") and @hasDecl(root.debug, "CpuCont
|
|
|
5
5
|
root.debug.CpuContext
|
|
6
6
|
else switch (native_arch) {
|
|
7
7
|
.aarch64, .aarch64_be => Aarch64,
|
|
8
|
+
.alpha => Alpha,
|
|
8
9
|
.arc, .arceb => Arc,
|
|
9
10
|
.arm, .armeb, .thumb, .thumbeb => Arm,
|
|
10
11
|
.csky => Csky,
|
|
@@ -13,6 +14,7 @@ else switch (native_arch) {
|
|
|
13
14
|
.lanai => Lanai,
|
|
14
15
|
.loongarch32, .loongarch64 => LoongArch,
|
|
15
16
|
.m68k => M68k,
|
|
17
|
+
.m88k => M88k,
|
|
16
18
|
.mips, .mipsel, .mips64, .mips64el => Mips,
|
|
17
19
|
.or1k => Or1k,
|
|
18
20
|
.powerpc, .powerpcle, .powerpc64, .powerpc64le => Powerpc,
|
|
@@ -61,6 +63,13 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native {
|
|
|
61
63
|
},
|
|
62
64
|
.pc = @truncate(uc.mcontext.pc),
|
|
63
65
|
};
|
|
66
|
+
} else if (native_arch == .m88k and native_os == .openbsd) {
|
|
67
|
+
// OpenBSD makes no effort to clear the V and E bits of the SXIP register when presenting it
|
|
68
|
+
// to user space, so we need to do that here.
|
|
69
|
+
return .{
|
|
70
|
+
.r = uc.mcontext.r,
|
|
71
|
+
.xip = uc.mcontext.xip & ~@as(u32, 0b11),
|
|
72
|
+
};
|
|
64
73
|
} else if (native_arch.isMIPS32() and native_os == .linux) {
|
|
65
74
|
// The O32 kABI uses 64-bit fields for some reason.
|
|
66
75
|
return .{
|
|
@@ -103,6 +112,10 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native {
|
|
|
103
112
|
.sp = uc.mcontext.sp,
|
|
104
113
|
.pc = uc.mcontext.pc,
|
|
105
114
|
},
|
|
115
|
+
.alpha => .{
|
|
116
|
+
.r = uc.mcontext.r,
|
|
117
|
+
.pc = uc.mcontext.pc,
|
|
118
|
+
},
|
|
106
119
|
.csky => .{
|
|
107
120
|
.r = uc.mcontext.r0_13 ++
|
|
108
121
|
[_]u32{ uc.mcontext.r14, uc.mcontext.r15 } ++
|
|
@@ -293,6 +306,75 @@ const Aarch64 = extern struct {
|
|
|
293
306
|
}
|
|
294
307
|
};
|
|
295
308
|
|
|
309
|
+
const Alpha = extern struct {
|
|
310
|
+
/// The numbered general-purpose registers R0 - R31.
|
|
311
|
+
r: [32]u64,
|
|
312
|
+
pc: u64,
|
|
313
|
+
|
|
314
|
+
pub inline fn current() Alpha {
|
|
315
|
+
var ctx: Alpha = undefined;
|
|
316
|
+
asm volatile (
|
|
317
|
+
\\ stq $0 , 0x000($0)
|
|
318
|
+
\\ stq $1 , 0x008($0)
|
|
319
|
+
\\ stq $2 , 0x010($0)
|
|
320
|
+
\\ stq $3 , 0x018($0)
|
|
321
|
+
\\ stq $4 , 0x020($0)
|
|
322
|
+
\\ stq $5 , 0x028($0)
|
|
323
|
+
\\ stq $6 , 0x030($0)
|
|
324
|
+
\\ stq $7 , 0x038($0)
|
|
325
|
+
\\ stq $8 , 0x040($0)
|
|
326
|
+
\\ stq $9 , 0x048($0)
|
|
327
|
+
\\ stq $10, 0x050($0)
|
|
328
|
+
\\ stq $11, 0x058($0)
|
|
329
|
+
\\ stq $12, 0x060($0)
|
|
330
|
+
\\ stq $13, 0x068($0)
|
|
331
|
+
\\ stq $14, 0x070($0)
|
|
332
|
+
\\ stq $15, 0x078($0)
|
|
333
|
+
\\ stq $16, 0x080($0)
|
|
334
|
+
\\ stq $17, 0x088($0)
|
|
335
|
+
\\ stq $18, 0x090($0)
|
|
336
|
+
\\ stq $19, 0x098($0)
|
|
337
|
+
\\ stq $20, 0x0a0($0)
|
|
338
|
+
\\ stq $21, 0x0a8($0)
|
|
339
|
+
\\ stq $22, 0x0b0($0)
|
|
340
|
+
\\ stq $23, 0x0b8($0)
|
|
341
|
+
\\ stq $24, 0x0c0($0)
|
|
342
|
+
\\ stq $25, 0x0c8($0)
|
|
343
|
+
\\ stq $26, 0x0d0($0)
|
|
344
|
+
\\ stq $27, 0x0d8($0)
|
|
345
|
+
\\ stq $28, 0x0e0($0)
|
|
346
|
+
\\ stq $29, 0x0e8($0)
|
|
347
|
+
\\ stq $30, 0x0f0($0)
|
|
348
|
+
\\
|
|
349
|
+
\\ br $1, 1f
|
|
350
|
+
\\1:
|
|
351
|
+
\\ stq $1, 0x100($0)
|
|
352
|
+
:
|
|
353
|
+
: [ctx] "{r0}" (&ctx),
|
|
354
|
+
: .{ .r1 = true, .memory = true });
|
|
355
|
+
return ctx;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
pub fn getFp(ctx: *const Alpha) u64 {
|
|
359
|
+
return ctx.r[15];
|
|
360
|
+
}
|
|
361
|
+
pub fn getPc(ctx: *const Alpha) u64 {
|
|
362
|
+
return ctx.pc;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
pub fn dwarfRegisterBytes(ctx: *Aarch64, register_num: u16) DwarfRegisterError![]u8 {
|
|
366
|
+
switch (register_num) {
|
|
367
|
+
0...31 => return @ptrCast(&ctx.r[register_num]),
|
|
368
|
+
64 => return @ptrCast(&ctx.pc),
|
|
369
|
+
|
|
370
|
+
32...63 => return error.UnsupportedRegister, // f0 - f31
|
|
371
|
+
66 => return error.UnsupportedRegister, // uniq
|
|
372
|
+
|
|
373
|
+
else => return error.InvalidRegister,
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
296
378
|
/// This is an `extern struct` so that inline assembly in `current` can use field offsets.
|
|
297
379
|
const Arc = extern struct {
|
|
298
380
|
/// The numbered general-purpose registers r0 - r31.
|
|
@@ -820,6 +902,75 @@ const M68k = extern struct {
|
|
|
820
902
|
}
|
|
821
903
|
};
|
|
822
904
|
|
|
905
|
+
/// This is an `extern struct` so that inline assembly in `current` can use field offsets.
|
|
906
|
+
const M88k = extern struct {
|
|
907
|
+
/// The numbered general-purpose registers r0 - r31.
|
|
908
|
+
r: [32]u32,
|
|
909
|
+
xip: u32,
|
|
910
|
+
|
|
911
|
+
pub inline fn current() M88k {
|
|
912
|
+
var ctx: M88k = undefined;
|
|
913
|
+
asm volatile (
|
|
914
|
+
\\ st %%r0, %%r2, 0
|
|
915
|
+
\\ st %%r1, %%r2, 4
|
|
916
|
+
\\ st %%r2, %%r2, 8
|
|
917
|
+
\\ st %%r3, %%r2, 12
|
|
918
|
+
\\ st %%r4, %%r2, 16
|
|
919
|
+
\\ st %%r5, %%r2, 20
|
|
920
|
+
\\ st %%r6, %%r2, 24
|
|
921
|
+
\\ st %%r7, %%r2, 28
|
|
922
|
+
\\ st %%r8, %%r2, 32
|
|
923
|
+
\\ st %%r9, %%r2, 36
|
|
924
|
+
\\ st %%r10, %%r2, 40
|
|
925
|
+
\\ st %%r11, %%r2, 44
|
|
926
|
+
\\ st %%r12, %%r2, 48
|
|
927
|
+
\\ st %%r13, %%r2, 52
|
|
928
|
+
\\ st %%r14, %%r2, 56
|
|
929
|
+
\\ st %%r15, %%r2, 60
|
|
930
|
+
\\ st %%r16, %%r2, 64
|
|
931
|
+
\\ st %%r17, %%r2, 68
|
|
932
|
+
\\ st %%r18, %%r2, 72
|
|
933
|
+
\\ st %%r19, %%r2, 76
|
|
934
|
+
\\ st %%r20, %%r2, 80
|
|
935
|
+
\\ st %%r21, %%r2, 84
|
|
936
|
+
\\ st %%r22, %%r2, 88
|
|
937
|
+
\\ st %%r23, %%r2, 92
|
|
938
|
+
\\ st %%r24, %%r2, 96
|
|
939
|
+
\\ st %%r25, %%r2, 100
|
|
940
|
+
\\ st %%r26, %%r2, 104
|
|
941
|
+
\\ st %%r27, %%r2, 108
|
|
942
|
+
\\ st %%r28, %%r2, 112
|
|
943
|
+
\\ st %%r29, %%r2, 116
|
|
944
|
+
\\ st %%r30, %%r2, 120
|
|
945
|
+
\\ st %%r31, %%r2, 124
|
|
946
|
+
\\ bsr.n 1f
|
|
947
|
+
\\1:
|
|
948
|
+
\\ st %%r1, %%r2, 128
|
|
949
|
+
:
|
|
950
|
+
: [ctx] "{r2}" (&ctx),
|
|
951
|
+
: .{ .r1 = true, .memory = true });
|
|
952
|
+
return ctx;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
pub fn getFp(ctx: *const M88k) u32 {
|
|
956
|
+
return ctx.r[30];
|
|
957
|
+
}
|
|
958
|
+
pub fn getPc(ctx: *const M88k) u32 {
|
|
959
|
+
return ctx.xip;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
pub fn dwarfRegisterBytes(ctx: *M88k, register_num: u16) DwarfRegisterError![]u8 {
|
|
963
|
+
switch (register_num) {
|
|
964
|
+
0...31 => return @ptrCast(&ctx.r[register_num]),
|
|
965
|
+
64 => return @ptrCast(&ctx.xip),
|
|
966
|
+
|
|
967
|
+
32...63 => return error.UnsupportedRegister, // x0 - x31
|
|
968
|
+
|
|
969
|
+
else => return error.InvalidRegister,
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
|
|
823
974
|
/// This is an `extern struct` so that inline assembly in `current` can use field offsets.
|
|
824
975
|
const Mips = extern struct {
|
|
825
976
|
/// The numbered general-purpose registers r0 - r31. r0 must be zero.
|
|
@@ -2256,9 +2407,11 @@ const signal_ucontext_t = switch (native_os) {
|
|
|
2256
2407
|
.alpha => extern struct {
|
|
2257
2408
|
_cookie: i64,
|
|
2258
2409
|
_mask: i64,
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2410
|
+
mcontext: extern struct {
|
|
2411
|
+
pc: u64,
|
|
2412
|
+
_ps: i64,
|
|
2413
|
+
r: [32]u64,
|
|
2414
|
+
},
|
|
2262
2415
|
},
|
|
2263
2416
|
// https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/arm/include/signal.h
|
|
2264
2417
|
.arm => extern struct {
|
|
@@ -2287,6 +2440,18 @@ const signal_ucontext_t = switch (native_os) {
|
|
|
2287
2440
|
r23_29: [7]u32,
|
|
2288
2441
|
r31: u32,
|
|
2289
2442
|
},
|
|
2443
|
+
// https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/m88k/include/signal.h
|
|
2444
|
+
.m88k => extern struct {
|
|
2445
|
+
_cookie: i32,
|
|
2446
|
+
_mask: i32,
|
|
2447
|
+
mcontext: extern struct {
|
|
2448
|
+
r: [32]u32,
|
|
2449
|
+
_epsr: u32,
|
|
2450
|
+
_fpsr: u32,
|
|
2451
|
+
_fpcr: u32,
|
|
2452
|
+
xip: u32,
|
|
2453
|
+
},
|
|
2454
|
+
},
|
|
2290
2455
|
// https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/mips64/include/signal.h
|
|
2291
2456
|
.mips64, .mips64el => extern struct {
|
|
2292
2457
|
_cookie: i64,
|
package/std/debug.zig
CHANGED
|
@@ -495,7 +495,7 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn {
|
|
|
495
495
|
if (use_trap_panic) @trap();
|
|
496
496
|
|
|
497
497
|
switch (builtin.os.tag) {
|
|
498
|
-
.freestanding, .other, .@"3ds", .vita => {
|
|
498
|
+
.freestanding, .other, .@"3ds", .psp, .vita => {
|
|
499
499
|
@trap();
|
|
500
500
|
},
|
|
501
501
|
.uefi => {
|
package/std/heap.zig
CHANGED
|
@@ -608,6 +608,7 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) {
|
|
|
608
608
|
.hppa => 4 << 10,
|
|
609
609
|
.x86, .x86_64 => 4 << 10,
|
|
610
610
|
.thumb, .thumbeb, .arm, .armeb, .aarch64, .aarch64_be => 4 << 10,
|
|
611
|
+
.m88k => 4 << 10,
|
|
611
612
|
.mips64, .mips64el => 4 << 10,
|
|
612
613
|
.powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10,
|
|
613
614
|
.riscv64 => 4 << 10,
|
|
@@ -771,6 +772,7 @@ const page_size_max_default: ?usize = switch (builtin.os.tag) {
|
|
|
771
772
|
.hppa => 4 << 10,
|
|
772
773
|
.x86, .x86_64 => 4 << 10,
|
|
773
774
|
.thumb, .thumbeb, .arm, .armeb, .aarch64, .aarch64_be => 4 << 10,
|
|
775
|
+
.m88k => 4 << 10,
|
|
774
776
|
.mips64, .mips64el => 16 << 10,
|
|
775
777
|
.powerpc, .powerpc64, .powerpc64le, .powerpcle => 4 << 10,
|
|
776
778
|
.riscv64 => 4 << 10,
|