From fbb51dff0f88b31985ef29a09cc361961aa34864 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Tue, 26 Oct 2021 21:42:57 +0200 Subject: [PATCH] Fix Area research and init size --- core/allocArea.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/allocArea.c b/core/allocArea.c index 5c999ed..4e47264 100644 --- a/core/allocArea.c +++ b/core/allocArea.c @@ -19,14 +19,15 @@ void areaInit(vaddr_t firstMemUsed, vaddr_t lastUsed) vaddr_t areaAddr, descAddr, entryAddr; allocSetup(sizeof(struct memArea), &areaAddr, &descAddr, &entryAddr); - areaAdd(descAddr, PAGE_SIZE, FALSE); + areaAdd(descAddr, 1, FALSE); if (entryAddr != descAddr) - areaAdd(entryAddr, PAGE_SIZE, FALSE); + areaAdd(entryAddr, 1, FALSE); if (areaAddr != descAddr && areaAddr != entryAddr) - areaAdd(areaAddr, PAGE_SIZE, FALSE); + areaAdd(areaAddr, 1, FALSE); int nbPages = DIV_ROUND_UP((lastUsed - firstMemUsed), PAGE_SIZE); areaAdd(ALIGN_DOWN(firstMemUsed, PAGE_SIZE), nbPages, FALSE); + //TODO: fix the 300 areaAdd(ALIGN_DOWN(areaAddr + PAGE_SIZE, PAGE_SIZE), 300 , TRUE); allocPopulate(); } @@ -158,7 +159,7 @@ static struct memArea *areaFindMemArea(struct memArea *list, vaddr_t addr) int count; list_foreach(list, area, count) { - if (area->startAddr <= addr && addr <= area->startAddr + area->nbPages * PAGE_SIZE) + if (area->startAddr <= addr && addr < area->startAddr + area->nbPages * PAGE_SIZE) return area; }