user_space #4
@ -19,14 +19,15 @@ void areaInit(vaddr_t firstMemUsed, vaddr_t lastUsed)
|
|||||||
|
|
||||||
vaddr_t areaAddr, descAddr, entryAddr;
|
vaddr_t areaAddr, descAddr, entryAddr;
|
||||||
allocSetup(sizeof(struct memArea), &areaAddr, &descAddr, &entryAddr);
|
allocSetup(sizeof(struct memArea), &areaAddr, &descAddr, &entryAddr);
|
||||||
areaAdd(descAddr, PAGE_SIZE, FALSE);
|
areaAdd(descAddr, 1, FALSE);
|
||||||
if (entryAddr != descAddr)
|
if (entryAddr != descAddr)
|
||||||
areaAdd(entryAddr, PAGE_SIZE, FALSE);
|
areaAdd(entryAddr, 1, FALSE);
|
||||||
if (areaAddr != descAddr && areaAddr != entryAddr)
|
if (areaAddr != descAddr && areaAddr != entryAddr)
|
||||||
areaAdd(areaAddr, PAGE_SIZE, FALSE);
|
areaAdd(areaAddr, 1, FALSE);
|
||||||
|
|
||||||
int nbPages = DIV_ROUND_UP((lastUsed - firstMemUsed), PAGE_SIZE);
|
int nbPages = DIV_ROUND_UP((lastUsed - firstMemUsed), PAGE_SIZE);
|
||||||
areaAdd(ALIGN_DOWN(firstMemUsed, PAGE_SIZE), nbPages, FALSE);
|
areaAdd(ALIGN_DOWN(firstMemUsed, PAGE_SIZE), nbPages, FALSE);
|
||||||
|
//TODO: fix the 300
|
||||||
areaAdd(ALIGN_DOWN(areaAddr + PAGE_SIZE, PAGE_SIZE), 300 , TRUE);
|
areaAdd(ALIGN_DOWN(areaAddr + PAGE_SIZE, PAGE_SIZE), 300 , TRUE);
|
||||||
allocPopulate();
|
allocPopulate();
|
||||||
}
|
}
|
||||||
@ -158,7 +159,7 @@ static struct memArea *areaFindMemArea(struct memArea *list, vaddr_t addr)
|
|||||||
int count;
|
int count;
|
||||||
list_foreach(list, area, 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;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user