summaryrefslogtreecommitdiff
path: root/Source/Kernel/MemoryManager
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/MemoryManager')
-rw-r--r--Source/Kernel/MemoryManager/PageDirectory.class.cpp2
-rw-r--r--Source/Kernel/MemoryManager/PhysMem.ns.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/Source/Kernel/MemoryManager/PageDirectory.class.cpp b/Source/Kernel/MemoryManager/PageDirectory.class.cpp
index 2c8507f..13fbc36 100644
--- a/Source/Kernel/MemoryManager/PageDirectory.class.cpp
+++ b/Source/Kernel/MemoryManager/PageDirectory.class.cpp
@@ -43,7 +43,6 @@ PageDirectory::PageDirectory(PageDirectory* other) {
}
PageDirectory::~PageDirectory() {
- PageAlloc::free((void*)tablesPhysical);
for (int i = 0; i < 768; i++) { //Only free addresses below 0xC0000000, upper is kernel space
if (tables[i] != 0) {
for (int j = 0; j < 1024; j++) {
@@ -52,6 +51,7 @@ PageDirectory::~PageDirectory() {
PageAlloc::free((void*)tables[i]);
}
}
+ PageAlloc::free((void*)tablesPhysical);
}
page_t *PageDirectory::getPage(u32int address, bool make) {
diff --git a/Source/Kernel/MemoryManager/PhysMem.ns.cpp b/Source/Kernel/MemoryManager/PhysMem.ns.cpp
index 1794106..382e8a4 100644
--- a/Source/Kernel/MemoryManager/PhysMem.ns.cpp
+++ b/Source/Kernel/MemoryManager/PhysMem.ns.cpp
@@ -61,8 +61,9 @@ void freeFrame(page_t *page) {
if (page->frame == 0) {
return;
} else {
- if (page->frame >= 0x100) //First 1M are reserved (system)
- frames->clearBit(page->frame / 0x1000);
+ if (page->frame >= 0x100) { //First 1M are reserved (system)
+ frames->clearBit(page->frame);
+ }
page->frame = 0;
}
}