Commit f3a03f39 authored by Mathieu Maret's avatar Mathieu Maret

test: memset the whole page

parent 8cf50c9a
......@@ -33,7 +33,8 @@ void testPhymem(void)
}
printf("%d pages freed\n", freeCount);
assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL, "Cannot allocate memory\n");
assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL,
"Cannot allocate memory\n");
unrefPhyPage((ulong)page);
}
......@@ -68,15 +69,16 @@ static void testPaging(void)
while ((page = (struct mem_desc *)allocPhyPage()) != NULL) {
assertmsg(pageMap((vaddr_t)page, (paddr_t)page, PAGING_MEM_WRITE) == 0,
"Fail to map page %d\n", allocCount);
page->phy_addr = allocCount;
"Fail to map page %d\n", allocCount);
memset(page, allocCount, PAGE_SIZE);
allocCount++;
list_add_tail(allocated_page_list, page);
}
printf("%d pages allocated\n", allocCount);
while ((page = list_pop_head(allocated_page_list)) != NULL) {
assertmsg(page->phy_addr == (ulong)freeCount, "page modified");
assertmsg((char)page->phy_addr == (char)freeCount,
"page modified %d but is %d\n", freeCount, page->phy_addr);
assertmsg(unrefPhyPage((ulong)page) >= 0, "Failed to free page %d\n",
(ulong)page);
pageUnmap((vaddr_t)page);
......@@ -84,7 +86,8 @@ static void testPaging(void)
}
printf("%d pages freed\n", freeCount);
assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL, "Cannot allocate memory\n");
assertmsg((page = (struct mem_desc *)allocPhyPage()) != NULL,
"Cannot allocate memory\n");
unrefPhyPage((ulong)page);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment