aboutsummaryrefslogtreecommitdiff
path: root/src/vmm.cc
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-03-21 16:53:07 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2021-03-21 16:53:07 +0200
commite9232199bdd97233dabd59f07c63607c93c0c59c (patch)
tree66aff19650079c9fc990f75d2ed390dd674cfdaa /src/vmm.cc
parentAdd allocator (diff)
downloadkernel.cpp-e9232199bdd97233dabd59f07c63607c93c0c59c.tar.xz
Check multiboot2 header length, and if needed map the next page as well
Diffstat (limited to 'src/vmm.cc')
-rw-r--r--src/vmm.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vmm.cc b/src/vmm.cc
index 3c90c48..abce5b8 100644
--- a/src/vmm.cc
+++ b/src/vmm.cc
@@ -78,6 +78,13 @@ Result<uint32_t, vmm::Error> vmm::map(uint32_t addr, const vmm::address dest) {
return Result<uint32_t, vmm::Error>{vmm::AddressAlreadyMapped};
}
+void vmm::unmap(const address d) {
+ if (directory[d.table_idx] == 0) return;
+ page_table table{directory[d.table_idx]};
+ table.set(d.page_idx, 0);
+ vmm::reload();
+}
+
vmm::page_table::page_table(uint32_t from) {
// TODO get flags
// convert physical address to a virtual address so we can read it