PMM - alloc zero after all free pages

This commit is contained in:
thomas committed 2018-03-20 14:11:21 +01:00
1 parent 9b930ae5d3
commit e7bdea771b
2 files changed
+10 -1

No files matched your search

+3 -1
View File
@@ -9,5 +9,7 @@ void pmm_free(void *c)
void *pmm_alloc()
{
return first;
void *c = first;
first = 0;
return c;
}
+7
View File
@@ -18,3 +18,10 @@ TEST(alloc_returns_0_if_no_free_pages)
void *a = pmm_alloc();
ASSERT_EQ_PTR(a, 0);
}
TEST(alloc_zero_after_all_free_pages)
{
pmm_free(&mem[0]);
pmm_alloc();
void *a = pmm_alloc();
ASSERT_EQ_PTR(a, 0);
}