summaryrefslogtreecommitdiff
path: root/Source/Kernel/MemoryManager/PageAlloc.ns.cpp
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-12-22 16:49:53 +0100
committerAlexis211 <alexis211@gmail.com>2009-12-22 16:49:53 +0100
commitcc1193087067c7e1105bd3d788520c034f5cf619 (patch)
tree33f31cf7459fe017c35a313c88e4bfcb6f00eb8a /Source/Kernel/MemoryManager/PageAlloc.ns.cpp
parentbfec696da052c8c9320773ca69927422efebe8c7 (diff)
downloadMelon-cc1193087067c7e1105bd3d788520c034f5cf619.tar.gz
Melon-cc1193087067c7e1105bd3d788520c034f5cf619.zip
Revert "[noncompiling commit] Started working on a segmented memory model"
This reverts commit bfec696da052c8c9320773ca69927422efebe8c7.
Diffstat (limited to 'Source/Kernel/MemoryManager/PageAlloc.ns.cpp')
-rw-r--r--Source/Kernel/MemoryManager/PageAlloc.ns.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/Kernel/MemoryManager/PageAlloc.ns.cpp b/Source/Kernel/MemoryManager/PageAlloc.ns.cpp
index 1b9a322..d8ede2a 100644
--- a/Source/Kernel/MemoryManager/PageAlloc.ns.cpp
+++ b/Source/Kernel/MemoryManager/PageAlloc.ns.cpp
@@ -29,10 +29,13 @@ void* alloc(u32int* phys) {
next = Mem::alloc(0x1000, true);
} else {
u32int i = 0xFFFFF000;
+ page_t *p;
while (1) {
- if (PhysMem::keSeg.allocFrame(i)) break;
+ p = kernelPageDirectory->getPage(i, true);
+ if (p->frame == 0) break;
i -= 0x1000;
}
+ PhysMem::allocFrame(p, true, false);
next = (void*)i;
}
freePage[freec] = next;
@@ -49,7 +52,7 @@ void* alloc(u32int* phys) {
if (p == 0) { //THIS SHOULD NEVER HAPPEN
PANIC("Cached free page does not exist.");
} else if (p->frame == 0) {
- PageDirectory::map(p, PhysMem::getFrame(), true, false);
+ PhysMem::allocFrame(p, true, false);
} else {
*phys = (p->frame * 0x1000);
}
@@ -58,7 +61,7 @@ void* alloc(u32int* phys) {
}
void free(void *ptr) {
- PhysMem::keSeg.freeFrame((u32int)ptr);
+ kernelPageDirectory->freeFrame((u32int)ptr);
return;
}