aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/features/mm.c')
-rw-r--r--kernel/features/mm.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/kernel/features/mm.c b/kernel/features/mm.c
index 01e21e7..b06657f 100644
--- a/kernel/features/mm.c
+++ b/kernel/features/mm.c
@@ -48,8 +48,8 @@ void page_fault_handler(struct regs *r)
struct page_dir *dir = NULL;
if (proc && proc->page_dir) {
dir = proc->page_dir;
- printf("Stack is at %x, entry at %x\n", virtual_to_physical(dir, proc->regs.ebp),
- virtual_to_physical(dir, proc->entry));
+ /* printf("Stack is at %x, entry at %x\n", virtual_to_physical(dir, proc->regs.ebp), */
+ /* virtual_to_physical(dir, proc->entry)); */
} else {
dir = &kernel_dir;
}
@@ -165,7 +165,7 @@ void physical_free(struct memory_range range)
* Virtual
*/
-#define PDI(vaddr) (((vaddr) >> 22) & 0x03ff)
+#define PDI(vaddr) ((vaddr) >> 22)
#define PTI(vaddr) (((vaddr) >> 12) & 0x03ff)
u8 virtual_present(struct page_dir *dir, u32 vaddr)
@@ -210,15 +210,11 @@ void virtual_map(struct page_dir *dir, struct memory_range prange, u32 vaddr, u3
struct page_table *table =
(struct page_table *)(dir_entry->bits.address * PAGE_SIZE);
- if (dir_entry->bits.present) {
- // TODO: Is this a security risk?
- if (flags & MEMORY_USER)
- dir_entry->bits.user = 1;
- } else {
+ if (!dir_entry->bits.present) {
table = memory_alloc_identity(dir, MEMORY_CLEAR);
dir_entry->bits.present = 1;
dir_entry->bits.writable = 1;
- dir_entry->bits.user = flags & MEMORY_USER;
+ dir_entry->bits.user = 1;
dir_entry->bits.address = (u32)(table) >> 12;
}