Import backup from 2003-09-07

This commit is contained in:
Josh Holtrop 2003-09-07 22:00:00 -04:00
parent e147635333
commit 02d7fc9a69
3 changed files with 17 additions and 14 deletions

View File

@ -31,7 +31,7 @@ void k_init()
outportb(0x43, 0x34);
outportb(0x40, 0x9c); //lsb
outportb(0x40, 0x2e); //msb
// video_init((ModeInfoBlock *) 0x90306);
video_init((ModeInfoBlock *) 0x90306);
mm_init();
int a;
for (a=0; a<512; a++)

29
mm.c
View File

@ -26,7 +26,7 @@ void mm_init()
}
if (first_pageblock == 0) //no pageblock page set up yet, so set it up here
{
first_pageblock = (pageblock *) maps[a].base.lowdword;
first_pageblock = (pageblock *) maps[a].base.lowdword ;
maps[a].base.lowdword += 4096;
maps[a].limit.lowdword -= 4096;
mm_init_pageblockpage(first_pageblock);
@ -163,18 +163,21 @@ int mm_pfree(void *ptr)
pageblock *pbc = first_pageblock;
for (;;)
{
if ((pbc->base + (pbc->length * 4096)) == pb->base) //pbc ends where pb starts
{
pbc->length += pb->length; //extend pbc's length by pb's length
pb->flags = MM_PB_NP; //mark pb as an unused entry
return 0;
}
if ((pb->base + (pb->length * 4096)) == pbc->base) //pb ends where pb starts
{
pb->length += pbc->length;
pbc->flags = MM_PB_NP;
return 0;
}
if (pbc->flags == MM_PB_AVAIL)
{
if ((pbc->base + (pbc->length * 4096)) == pb->base) //pbc ends where pb starts
{
pbc->length += pb->length; //extend pbc's length by pb's length
pb->flags = MM_PB_NP; //mark pb as an unused entry
return 0;
}
if ((pb->base + (pb->length * 4096)) == pbc->base) //pb ends where pb starts
{
pb->length += pbc->length;
pbc->flags = MM_PB_NP;
return 0;
}
}
if (pbc->link == 0) //no entry found to consolidate...
return 0;
pbc = (pageblock *) pbc->link; //next entry to test

View File