aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/paging.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/paging.zig b/src/paging.zig
index 1a174aa..d1d309c 100644
--- a/src/paging.zig
+++ b/src/paging.zig
@@ -292,13 +292,13 @@ pub const Table = struct {
// discarding offsets. The mapping is written to the specified level,
// creating page tables as needed.
//
- // The mapping must be a leaf, meaning that passing flags
+ // The mapping must be invalid or a leaf, meaning that passing flags
// that indicate no access permissions at all will return an error.
//
// This function internally uses zeroedAlloc to allocate memory for the required page tables,
// but assumes that the physical address to map to has already been allocated by the caller.
pub fn map(root: *Table, vaddr: usize, paddr: usize, flags: EntryFlags, level: usize) !void {
- if (!flags.isLeaf()) return Error.NotALeaf;
+ if (@bitCast(flags.valid) and !flags.isLeaf()) return Error.NotALeaf;
const vpn = virtualPageNumbers(vaddr);