diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/interrupts.zig | 2 | ||||
-rw-r--r-- | src/lib/mem.zig | 12 | ||||
-rw-r--r-- | src/lib/paging.zig | 2 | ||||
-rw-r--r-- | src/lib/plic.zig | 1 |
4 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/interrupts.zig b/src/lib/interrupts.zig index 1a6bc65..5cb6fb9 100644 --- a/src/lib/interrupts.zig +++ b/src/lib/interrupts.zig @@ -5,12 +5,10 @@ const std = @import("std"); const Console = @import("Console.zig"); const TrapFrame = @import("TrapFrame.zig"); -const paging = @import("paging.zig"); const plic = @import("plic.zig"); const process = @import("process.zig"); const riscv = @import("riscv.zig"); const syscall = @import("syscall.zig"); -const time = @import("sbi/time.zig"); pub var trap_frame: TrapFrame = undefined; diff --git a/src/lib/mem.zig b/src/lib/mem.zig index 5ec99ab..eefa452 100644 --- a/src/lib/mem.zig +++ b/src/lib/mem.zig @@ -2,12 +2,12 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -const paging = @import("paging.zig"); const std = @import("std"); +const paging = @import("paging.zig"); const Allocator = std.mem.Allocator; -const mem = std.mem; -const maxInt = std.math.maxInt; const assert = std.debug.assert; +const maxInt = std.math.maxInt; +const mem = std.mem; const Chunk = struct { flags: Flags, @@ -61,7 +61,7 @@ pub fn ChunkAllocator(comptime config: ChunkAllocatorConfig) type { } } - pub fn allocator(self: *Self) mem.Allocator { + pub fn allocator(self: *Self) Allocator { return .{ .ptr = self, .vtable = &.{ @@ -77,7 +77,7 @@ pub fn ChunkAllocator(comptime config: ChunkAllocatorConfig) type { const self: *Self = @ptrCast(@alignCast(ctx)); - const ptr_align = @as(usize, 1) << @as(mem.Allocator.Log2Align, @intCast(log2_ptr_align)); + const ptr_align = @as(usize, 1) << @as(Allocator.Log2Align, @intCast(log2_ptr_align)); var chunk = self.head orelse return null; const bound = @intFromPtr(chunk) + (self.pages * paging.page_size); @@ -124,7 +124,7 @@ pub fn ChunkAllocator(comptime config: ChunkAllocatorConfig) type { const self: *Self = @ptrCast(@alignCast(ctx)); - const ptr_align = @as(usize, 1) << @as(mem.Allocator.Log2Align, @intCast(log2_buf_align)); + const ptr_align = @as(usize, 1) << @as(Allocator.Log2Align, @intCast(log2_buf_align)); const head = self.head orelse return false; const bound = @intFromPtr(head) + (self.pages * paging.page_size); diff --git a/src/lib/paging.zig b/src/lib/paging.zig index 6403ffe..0775940 100644 --- a/src/lib/paging.zig +++ b/src/lib/paging.zig @@ -587,7 +587,7 @@ pub fn zeroedAlloc(n: usize) AllocError![]align(page_size) u8 { try page_table.identityMapRange(start, end, EntryFlags.readWrite); } - // Write zeroes in batches of 64-bit to reduce the amount of store riscv. + // Write zeroes in batches of 64-bit to reduce the amount of store instructions. // The remainder / remaining bytes don't need to be accounted for // because page_size (4096) is divisible by 8. diff --git a/src/lib/plic.zig b/src/lib/plic.zig index 42af334..b8f7364 100644 --- a/src/lib/plic.zig +++ b/src/lib/plic.zig @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later -const std = @import("std"); const hwinfo = @import("hwinfo.zig"); pub var default: Plic = undefined; |