Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade zig to 0.12.1 #67

Merged
merged 6 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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(.{});

Expand All @@ -102,26 +102,26 @@ 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" });
kernel.addObjectFile(Build.LazyPath{ .path = "build/newlib/libc.a" });
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");
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/virtio/common.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/fs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/sync.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/timer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/x64.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion submodules/lwip
Submodule lwip updated from 1cc153 to 73fcf7
Loading