Skip to content
Open
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
9 changes: 7 additions & 2 deletions src/kernel/vmm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,12 @@ pub fn VirtualMemoryManager(comptime Payload: type) type {
} else {
std.mem.copy(u8, data, data_copy);
}
// TODO Unmap and freee virtual blocks from self so they can be used in the future
// Unmap and free virtual blocks from self so they can be used in the future
var i: usize = 0;
while (i < blocks.items.len) : (i += 1) {
self.bmp.clearEntry(entry + i) catch |e| panic(@errorReturnTrace(), "Failed to free temporary virtual memory at 0x{X}: {}\n", .{ entry * BLOCK_SIZE + self.start, e });
self.mapper.unmapFn(entry * BLOCK_SIZE + self.start, entry * BLOCK_SIZE + BLOCK_SIZE + self.start, self.allocator, self.payload) catch unreachable;
}
} else {
return VmmError.OutOfMemory;
}
Expand Down Expand Up @@ -1029,7 +1034,7 @@ fn rt_correctMapping(comptime Payload: type, vmm: *VirtualMemoryManager(Payload)
/// IN vmm: *VirtualMemoryManager() - The active VMM to test
///
fn rt_copyData(vmm: *VirtualMemoryManager(arch.VmmPayload)) void {
const expected_free_entries = vmm.bmp.num_free_entries - 1;
const expected_free_entries = vmm.bmp.num_free_entries;
// Mirror the VMM
var vmm2 = vmm.copy() catch |e| {
panic(@errorReturnTrace(), "Failed to mirror VMM: {}\n", .{e});
Expand Down