summaryrefslogtreecommitdiff
path: root/Source/Kernel/MemoryManager
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-11-11 09:31:23 +0100
committerAlexis211 <alexis211@gmail.com>2009-11-11 09:31:23 +0100
commit7292b995d4f7bfea699e44ed335d7cc1616c1132 (patch)
tree8d70a0750fb5613aeba002038e7ae676fe6a271a /Source/Kernel/MemoryManager
parenteb5f08c76b17ac6e15d6b763a7f45816cb85c570 (diff)
downloadMelon-7292b995d4f7bfea699e44ed335d7cc1616c1132.tar.gz
Melon-7292b995d4f7bfea699e44ed335d7cc1616c1132.zip
VESA works !
Diffstat (limited to 'Source/Kernel/MemoryManager')
-rw-r--r--Source/Kernel/MemoryManager/PageDirectory.class.cpp19
-rw-r--r--Source/Kernel/MemoryManager/PageDirectory.class.h1
2 files changed, 10 insertions, 10 deletions
diff --git a/Source/Kernel/MemoryManager/PageDirectory.class.cpp b/Source/Kernel/MemoryManager/PageDirectory.class.cpp
index c10f844..064b423 100644
--- a/Source/Kernel/MemoryManager/PageDirectory.class.cpp
+++ b/Source/Kernel/MemoryManager/PageDirectory.class.cpp
@@ -74,13 +74,17 @@ page_t *PageDirectory::getPage(u32int address, bool make) {
}
}
-void PageDirectory::allocFrame(u32int address, bool is_user, bool is_writable) {
- page_t *p = getPage(address, true);
- if (address < 0x100000) {
+void PageDirectory::map(page_t* p, u32int frame, bool is_user, bool is_writable) {
p->present = 1;
p->user = (is_user ? 1 : 0);
p->rw = (is_writable ? 1 : 0);
- p->frame = (address / 0x1000);
+ p->frame = (frame);
+}
+
+void PageDirectory::allocFrame(u32int address, bool is_user, bool is_writable) {
+ page_t *p = getPage(address, true);
+ if (address < 0x100000) {
+ map(p, address / 0x1000, is_user, is_writable);
} else {
if (p != 0) PhysMem::allocFrame(p, is_user, is_writable);
}
@@ -89,12 +93,7 @@ void PageDirectory::allocFrame(u32int address, bool is_user, bool is_writable) {
void PageDirectory::freeFrame(u32int address) {
page_t *p = getPage(address, false);
if (p == 0) return;
- if (address < 0x100000) {
- p->frame = 0;
- p->present = 0;
- } else {
- PhysMem::freeFrame(p);
- }
+ PhysMem::freeFrame(p);
}
void PageDirectory::switchTo() {
diff --git a/Source/Kernel/MemoryManager/PageDirectory.class.h b/Source/Kernel/MemoryManager/PageDirectory.class.h
index 14b78ca..e93524b 100644
--- a/Source/Kernel/MemoryManager/PageDirectory.class.h
+++ b/Source/Kernel/MemoryManager/PageDirectory.class.h
@@ -26,6 +26,7 @@ struct PageDirectory {
PageDirectory(PageDirectory* other); //Clones the other pagedir
~PageDirectory();
page_t *getPage(u32int address, bool make);
+ void map(page_t *p, u32int frame, bool is_user, bool is_writable);
void allocFrame(u32int address, bool is_user, bool is_writable);
void freeFrame(u32int address);
void switchTo();