Skip to content

Commit 77bf8f0

Browse files
committed
mm: Add comments
1 parent 2db0022 commit 77bf8f0

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

kernel/kernel.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,19 @@ extern void kmain(multiboot_info_t *multiboot_info, uint32_t multiboot_magic)
6262
uintptr_t * addr1 = (void *)0x00400000;
6363
uintptr_t * addr2 = addr1 + 1024;
6464

65+
/* map both addresses to same physical memory page */
6566
paging_map_page(page, addr1, 0x02);
6667
paging_map_page(page, addr2, 0x02);
6768

69+
/* update the values at both addresses */
6870
*addr1 = 0xcafebabe;
6971
*addr2 = 0xdeadbeef;
72+
73+
/* the second update should overwrite the first since the physical address
74+
* is same */
7075
kcheck(*addr1 == *addr2, "paging enabled");
7176

77+
/* cleanup */
7278
paging_unmap_page(page, addr1);
7379
paging_unmap_page(page, addr2);
7480
page_free(page);

kernel/mm/page_alloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ void page_alloc_init()
3131
size_t pages_array_page_count =
3232
page_address_to_index(pages_array_mem_size) + 1;
3333

34+
/* we have some unused memory at this point but we'll ignore it for now */
35+
3436
/* allocate the pages for the array */
3537
pages = page_frame_n_alloc(pages_array_page_count);
3638

kernel/mm/paging.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ int paging_map_page(struct page *page, void *virtual_address, uint32_t flags)
188188
page_table[page_tab_index].present = 1;
189189

190190
klog(LOG_DEBUG,
191-
"paging_map_page: new table entry: 0x%x\n",
191+
"paging_map_page: new table entry: 0x%x 0x%x\n",
192+
&page_table[page_tab_index],
192193
page_table_get_value(&page_table[page_tab_index]));
193194

194195
/* increment the number of references for the page */

0 commit comments

Comments
 (0)