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(0x43, 0x34);
outportb(0x40, 0x9c); //lsb outportb(0x40, 0x9c); //lsb
outportb(0x40, 0x2e); //msb outportb(0x40, 0x2e); //msb
// video_init((ModeInfoBlock *) 0x90306); video_init((ModeInfoBlock *) 0x90306);
mm_init(); mm_init();
int a; int a;
for (a=0; a<512; a++) for (a=0; a<512; a++)

5
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 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].base.lowdword += 4096;
maps[a].limit.lowdword -= 4096; maps[a].limit.lowdword -= 4096;
mm_init_pageblockpage(first_pageblock); mm_init_pageblockpage(first_pageblock);
@ -162,6 +162,8 @@ int mm_pfree(void *ptr)
pb->flags = MM_PB_AVAIL; //found block, mark available / coalesce it pb->flags = MM_PB_AVAIL; //found block, mark available / coalesce it
pageblock *pbc = first_pageblock; pageblock *pbc = first_pageblock;
for (;;) for (;;)
{
if (pbc->flags == MM_PB_AVAIL)
{ {
if ((pbc->base + (pbc->length * 4096)) == pb->base) //pbc ends where pb starts if ((pbc->base + (pbc->length * 4096)) == pb->base) //pbc ends where pb starts
{ {
@ -175,6 +177,7 @@ int mm_pfree(void *ptr)
pbc->flags = MM_PB_NP; pbc->flags = MM_PB_NP;
return 0; return 0;
} }
}
if (pbc->link == 0) //no entry found to consolidate... if (pbc->link == 0) //no entry found to consolidate...
return 0; return 0;
pbc = (pageblock *) pbc->link; //next entry to test pbc = (pageblock *) pbc->link; //next entry to test

View File