diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 75cdb98..e3e692c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm RUN apt-get update && apt-get install -y cmake ARG LLVM_URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.0/clang+llvm-15.0.0-x86_64-linux-gnu-rhel-8.4.tar.xz -ARG ZIG_VERSION=zig-linux-x86_64-0.12.0-dev.1856+94c63f31f +ARG ZIG_VERSION=zig-linux-x86_64-0.12.1 ENV PATH="/usr/bin/zig:${PATH}" ENV PATH=/usr/local/llvm/bin:$PATH @@ -17,8 +17,8 @@ RUN mkdir -p /usr/local/llvm \ WORKDIR /work -RUN git clone https://github.com/Mewz-project/Wasker.git \ - && cd Wasker \ +RUN git clone https://github.com/mewz-project/wasker.git \ + && cd wasker \ && cargo build --release \ && cp target/release/wasker /usr/bin diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a4d2fb2..726b4e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,7 +23,7 @@ jobs: - name: Install Zig uses: goto-bus-stop/setup-zig@v2 with: - version: 0.12.0-dev.926+3be8490d8 + version: 0.12.1 cache: true - name: Install packages for running tests diff --git a/build.zig b/build.zig index b0673c9..b5af2aa 100644 --- a/build.zig +++ b/build.zig @@ -1,7 +1,7 @@ const std = @import("std"); const Build = @import("std").Build; const Target = @import("std").Target; -const CrossTarget = @import("std").zig.CrossTarget; +const Query = @import("std").Target.Query; const Feature = @import("std").Target.Cpu.Feature; const TEST_DIR_PATH = "build/test"; @@ -91,7 +91,7 @@ pub fn build(b: *Build) !void { disabled_features.addFeature(@intFromEnum(features.avx2)); enabled_features.addFeature(@intFromEnum(features.soft_float)); - const target = CrossTarget{ .cpu_arch = Target.Cpu.Arch.x86_64, .os_tag = Target.Os.Tag.freestanding, .cpu_features_sub = disabled_features, .cpu_features_add = enabled_features }; + const target = Query{ .cpu_arch = Target.Cpu.Arch.x86_64, .os_tag = Target.Os.Tag.freestanding, .cpu_features_sub = disabled_features, .cpu_features_add = enabled_features }; const optimize = b.standardOptimizeOption(.{}); @@ -102,10 +102,10 @@ pub fn build(b: *Build) !void { .name = "mewz.elf", .root_source_file = .{ .path = "src/main.zig" }, .optimize = optimize, - .target = target, - .linkage = std.build.CompileStep.Linkage.static, + .target = b.resolveTargetQuery(target), + .linkage = std.builtin.LinkMode.static, }); - kernel.code_model = .kernel; + kernel.entry = .{ .symbol_name = "boot" }; kernel.setLinkerScriptPath(.{ .path = "src/x64.ld" }); kernel.addAssemblyFile(Build.LazyPath{ .path = "src/boot.S" }); kernel.addAssemblyFile(Build.LazyPath{ .path = "src/interrupt.S" }); @@ -113,15 +113,15 @@ pub fn build(b: *Build) !void { kernel.addObjectFile(Build.LazyPath{ .path = "build/lwip/libtcpip.a" }); kernel.addObjectFile(Build.LazyPath{ .path = "build/lwip/liblwipcore.a" }); kernel.addObjectFile(Build.LazyPath{ .path = "build/lwip/liblwipallapps.a" }); - kernel.addCSourceFile(Build.Step.Compile.CSourceFile{ .file = Build.LazyPath{ .path = "src/c/newlib_support.c" }, .flags = &[_][]const u8{ "-I", "submodules/newlib/newlib/libc/include" } }); - kernel.addCSourceFile(Build.Step.Compile.CSourceFile{ .file = Build.LazyPath{ .path = "src/c/lwip_support.c" }, .flags = &[_][]const u8{ "-I", "submodules/newlib/newlib/libc/include" } }); + kernel.addCSourceFile(Build.Module.CSourceFile{ .file = Build.LazyPath{ .path = "src/c/newlib_support.c" }, .flags = &[_][]const u8{ "-I", "submodules/newlib/newlib/libc/include" } }); + kernel.addCSourceFile(Build.Module.CSourceFile{ .file = Build.LazyPath{ .path = "src/c/lwip_support.c" }, .flags = &[_][]const u8{ "-I", "submodules/newlib/newlib/libc/include" } }); if (params.obj_path) |p| { kernel.addObjectFile(Build.LazyPath{ .path = p }); } if (params.dir_path) |_| { kernel.addObjectFile(Build.LazyPath{ .path = "build/disk.o" }); } - kernel.addOptions("options", options); + kernel.root_module.addOptions("options", options); b.installArtifact(kernel); const kernel_step = b.step("kernel", "Build the kernel"); diff --git a/src/drivers/virtio/common.zig b/src/drivers/virtio/common.zig index 4d9520d..b093548 100644 --- a/src/drivers/virtio/common.zig +++ b/src/drivers/virtio/common.zig @@ -535,7 +535,7 @@ pub fn VirtioMmioTransport(comptime DeviceConfigType: type) type { } self.common_config.queue_select = virtq.index; - @fence(std.builtin.AtomicOrder.SeqCst); + @fence(std.builtin.AtomicOrder.seq_cst); const offset = self.notify_off_multiplier * self.common_config.queue_notify_off; const addr = self.notify + @as(usize, @intCast(offset)); @as(*volatile u16, @ptrFromInt(addr)).* = virtq.index; diff --git a/src/fs.zig b/src/fs.zig index 67585eb..bb80371 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -99,7 +99,8 @@ pub fn init() void { } log.debug.printf("FILES_MAX: {d}\n", .{FILES_MAX}); - const disk_pointer = @as([*]u8, @ptrCast(&_binary_build_disk_tar_start)); + const disk_ptr_addr = &_binary_build_disk_tar_start; + const disk_pointer = @as([*]u8, @ptrCast(@constCast(disk_ptr_addr))); var off: usize = 0; var i: usize = 0; diff --git a/src/sync.zig b/src/sync.zig index 2815a45..bd6ab51 100644 --- a/src/sync.zig +++ b/src/sync.zig @@ -20,13 +20,13 @@ pub fn SpinLock(comptime T: type) type { @panic("deadlock"); } - while (@atomicRmw(bool, &this.locked, builtin.AtomicRmwOp.Xchg, true, builtin.AtomicOrder.Acquire)) {} + while (@atomicRmw(bool, &this.locked, builtin.AtomicRmwOp.Xchg, true, builtin.AtomicOrder.acquire)) {} return @as(*T, @alignCast(@ptrCast(this.ptr))); } pub fn release(this: *volatile This) void { - _ = @atomicRmw(bool, &this.locked, builtin.AtomicRmwOp.Xchg, false, builtin.AtomicOrder.Release); + _ = @atomicRmw(bool, &this.locked, builtin.AtomicRmwOp.Xchg, false, builtin.AtomicOrder.release); popcli(); } @@ -43,13 +43,13 @@ pub const Waiter = struct { } pub fn setWait(self: *volatile Self) void { - @atomicStore(bool, &self.waiting, true, builtin.AtomicOrder.SeqCst); + @atomicStore(bool, &self.waiting, true, builtin.AtomicOrder.seq_cst); } pub fn wait(self: *volatile Self) void { while (true) { while (self.waiting) {} - if (!@atomicLoad(bool, &self.waiting, builtin.AtomicOrder.SeqCst)) { + if (!@atomicLoad(bool, &self.waiting, builtin.AtomicOrder.seq_cst)) { break; } } diff --git a/src/timer.zig b/src/timer.zig index 324305b..3603dd1 100644 --- a/src/timer.zig +++ b/src/timer.zig @@ -41,7 +41,7 @@ pub const Timer = struct { } pub fn isFinished(self: *Self) bool { - return @atomicLoad(bool, &self.*.is_finished_internal, std.builtin.AtomicOrder.SeqCst); + return @atomicLoad(bool, &self.*.is_finished_internal, std.builtin.AtomicOrder.seq_cst); } }; diff --git a/src/x64.zig b/src/x64.zig index 68feaa0..f1fa797 100644 --- a/src/x64.zig +++ b/src/x64.zig @@ -4,7 +4,7 @@ pub const EFLAGS_IF = 0x00000200; pub fn init() void { enableSSE(); - @fence(std.builtin.AtomicOrder.SeqCst); + @fence(std.builtin.AtomicOrder.seq_cst); enableAVX(); } diff --git a/submodules/lwip b/submodules/lwip index 1cc1536..73fcf72 160000 --- a/submodules/lwip +++ b/submodules/lwip @@ -1 +1 @@ -Subproject commit 1cc1536e6a7117e23ebaf5546405a843a3e558ae +Subproject commit 73fcf72792a926a4e0ac8b656b29bff70552d927