aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-05-13 16:53:31 +0200
committerHimbeer <himbeer@disroot.org>2024-05-13 16:53:31 +0200
commit9dd595c22dad9aabcdf3389d61f3cbc516f04d1c (patch)
tree7bf2c96a2343e8f04dfb5d23cbdbca5914c7156e
parent6e3abbeaa324a1d68c806998dbe5cec4e6624c53 (diff)
Update to zig 0.12.0
-rw-r--r--build.zig7
-rw-r--r--src/fdt.zig8
-rw-r--r--src/pci.zig8
-rw-r--r--src/sbi/time.zig4
4 files changed, 14 insertions, 13 deletions
diff --git a/build.zig b/build.zig
index 9b24928..01b43d5 100644
--- a/build.zig
+++ b/build.zig
@@ -30,13 +30,14 @@ pub fn build(b: *std.Build) void {
.name = "srvre_kernel.elf",
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
- .root_source_file = .{ .path = "src/main.zig" },
.target = target,
+ .root_source_file = b.path("src/main.zig"),
.optimize = optimize,
+ .code_model = .medium,
});
- exe.code_model = .medium;
- exe.setLinkerScript(std.Build.LazyPath.relative("linker.ld"));
+ exe.entry = .{ .symbol_name = "start" };
+ exe.setLinkerScript(b.path("linker.ld"));
// This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default
diff --git a/src/fdt.zig b/src/fdt.zig
index 023435d..aa9fbf3 100644
--- a/src/fdt.zig
+++ b/src/fdt.zig
@@ -78,8 +78,8 @@ pub const Node = struct {
const address_cells_bytes = self.parent.?.props.get("#address-cells");
const size_cells_bytes = self.parent.?.props.get("#size-cells");
- const address_cells = if (address_cells_bytes) |bytes| std.mem.readInt(u32, bytes[0..4], .Big) else 2;
- const size_cells = if (size_cells_bytes) |bytes| std.mem.readInt(u32, bytes[0..4], .Big) else 1;
+ const address_cells = if (address_cells_bytes) |bytes| std.mem.readInt(u32, bytes[0..4], .big) else 2;
+ const size_cells = if (size_cells_bytes) |bytes| std.mem.readInt(u32, bytes[0..4], .big) else 1;
if (address_cells == 0 or size_cells == 0) return NodeError.BadCellSize;
@@ -95,8 +95,8 @@ pub const Node = struct {
const len_offset = start_offset + 4 * address_cells;
try regs.append(.{
- .start = std.mem.readVarInt(usize, reg_prop[start_offset .. start_offset + 4 * address_cells], .Big),
- .len = std.mem.readVarInt(usize, reg_prop[len_offset .. len_offset + 4 * size_cells], .Big),
+ .start = std.mem.readVarInt(usize, reg_prop[start_offset .. start_offset + 4 * address_cells], .big),
+ .len = std.mem.readVarInt(usize, reg_prop[len_offset .. len_offset + 4 * size_cells], .big),
});
}
diff --git a/src/pci.zig b/src/pci.zig
index eae1a14..7ee8f7b 100644
--- a/src/pci.zig
+++ b/src/pci.zig
@@ -765,8 +765,8 @@ pub fn controllerFromFdt(dt: *const fdt.Tree) !Controller {
const address_cells_bytes = soc[1].props.get("#address-cells") orelse return Error.NoAddrCells;
const size_cells_bytes = soc[1].props.get("#size-cells") orelse return Error.NoSizeCells;
- const address_cells = 16 * std.mem.readInt(u32, address_cells_bytes[0..4], .Big);
- const size_cells = 16 * std.mem.readInt(u32, size_cells_bytes[0..4], .Big);
+ const address_cells = 16 * std.mem.readInt(u32, address_cells_bytes[0..4], .big);
+ const size_cells = 16 * std.mem.readInt(u32, size_cells_bytes[0..4], .big);
var results = fdt.findNode(soc[1].subnodes.items, "pci");
const node = results.next() orelse return Error.NoPcinode;
@@ -779,8 +779,8 @@ pub fn controllerFromFdt(dt: *const fdt.Tree) !Controller {
if (n < 1) return Error.NoReg;
- const ptr: [*]u8 = @ptrFromInt(unitAddr + std.mem.readVarInt(usize, reg[0..(address_cells / 8)], .Big));
- const len = std.mem.readVarInt(usize, reg[(address_cells / 8) .. (size_cells / 8) + (address_cells / 8)], .Big);
+ const ptr: [*]u8 = @ptrFromInt(unitAddr + std.mem.readVarInt(usize, reg[0..(address_cells / 8)], .big));
+ const len = std.mem.readVarInt(usize, reg[(address_cells / 8) .. (size_cells / 8) + (address_cells / 8)], .big);
const slice = ptr[0..len];
const compatible = node.props.get("compatible") orelse return Error.NoCompatInfo;
diff --git a/src/sbi/time.zig b/src/sbi/time.zig
index e70d589..e10784a 100644
--- a/src/sbi/time.zig
+++ b/src/sbi/time.zig
@@ -38,9 +38,9 @@ pub fn interruptInSeconds(dt: ?*const fdt.Tree, seconds: u64) !void {
var frequency: u64 = undefined;
if (frequency_prop.len >= @sizeOf(u64)) {
- frequency = std.mem.readInt(u64, frequency_prop[0..@sizeOf(u64)], .Big);
+ frequency = std.mem.readInt(u64, frequency_prop[0..@sizeOf(u64)], .big);
} else if (frequency_prop.len >= @sizeOf(u32)) {
- frequency = std.mem.readInt(u32, frequency_prop[0..@sizeOf(u32)], .Big);
+ frequency = std.mem.readInt(u32, frequency_prop[0..@sizeOf(u32)], .big);
} else return Error.TimebaseFrequencyPropTooShort;
const cycles = seconds * frequency;