From ccf954e1d639211a46521281b35fa5b8d4bec86e Mon Sep 17 00:00:00 2001 From: Ruslan Isaev Date: Wed, 5 Nov 2025 21:03:06 +0300 Subject: [PATCH] mm: add a warning in map_page if a page is already mapped --- src/mm/page_tables.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mm/page_tables.c b/src/mm/page_tables.c index 80a157e..bac66df 100644 --- a/src/mm/page_tables.c +++ b/src/mm/page_tables.c @@ -70,6 +70,11 @@ void map_page(void *physaddr, void *virtualaddr, unsigned int flags) { // Here you need to check whether the PT entry is present. // When it is, then there is already a mapping present. What do you do now? + if(pt[ptindex] & 0x1) + { + printf("this page 0x%X is already mapped\n", virtualaddr); + } + pt[ptindex] = ((unsigned long)physaddr) | (flags & 0xFFF); // Present // Now you need to flush the entry in the TLB