From 4b6897aedfb706dfe326e696a04c7c8722462e84 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:12:55 -0300 Subject: [PATCH] feat: Get ZBA working on Zig's new stage2/stage3 compiler --- lib/SDL.zig | 2 +- lib/util/bitfield.zig | 4 ++-- src/core/cpu.zig | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/SDL.zig b/lib/SDL.zig index 401c50f..d669250 160000 --- a/lib/SDL.zig +++ b/lib/SDL.zig @@ -1 +1 @@ -Subproject commit 401c50ff3d0b83ad4bd89caf580ce1bd90fb5618 +Subproject commit d66925011971fbe221fc2a7f7cb4cd8c181d9ba3 diff --git a/lib/util/bitfield.zig b/lib/util/bitfield.zig index 1124cd2..b9ca43e 100644 --- a/lib/util/bitfield.zig +++ b/lib/util/bitfield.zig @@ -14,7 +14,7 @@ fn PtrCastPreserveCV(comptime T: type, comptime PtrToT: type, comptime NewT: typ fn BitType(comptime FieldType: type, comptime ValueType: type, comptime shamt: usize) type { const self_bit: FieldType = (1 << shamt); - return struct { + return extern struct { bits: Bitfield(FieldType, shamt, 1), pub fn set(self: anytype) void { @@ -63,7 +63,7 @@ pub fn Bitfield(comptime FieldType: type, comptime shamt: usize, comptime num_bi const ValueType = std.meta.Int(.unsigned, num_bits); - return struct { + return extern struct { dummy: FieldType, fn field(self: anytype) PtrCastPreserveCV(@This(), @TypeOf(self), FieldType) { diff --git a/src/core/cpu.zig b/src/core/cpu.zig index 319841a..7ef1014 100644 --- a/src/core/cpu.zig +++ b/src/core/cpu.zig @@ -12,7 +12,7 @@ const File = std.fs.File; // ARM Instructions pub const arm = struct { - pub const InstrFn = fn (*Arm7tdmi, *Bus, u32) void; + pub const InstrFn = *const fn (*Arm7tdmi, *Bus, u32) void; const lut: [0x1000]InstrFn = populate(); const processing = @import("cpu/arm/data_processing.zig").dataProcessing; @@ -110,7 +110,7 @@ pub const arm = struct { // THUMB Instructions pub const thumb = struct { - pub const InstrFn = fn (*Arm7tdmi, *Bus, u16) void; + pub const InstrFn = *const fn (*Arm7tdmi, *Bus, u16) void; const lut: [0x400]InstrFn = populate(); const processing = @import("cpu/thumb/data_processing.zig");