modified: DEBUG.16
modified: HEAP.16
modified: MMDUMP.16
modified: exmmtest.exe
modified: src/lib/16_mm.c
-\e[0mSeg:0 Size:5552 Owner:0x5\r
+\e[0mSeg:0 Size:5522 Owner:0x65e\r
\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
\e[42;32m0\e[0m\r
\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
\e[42;32m0\e[0m\r
-\e[0mSeg:15b0 Size:256 Owner:0x3518\r
+\e[0mSeg:1592 Size:256 Owner:0x3518\r
\e[44;34m++++\e[0m\e[47;37m_\e[0m\r
\e[42;32m\e[0m\r
\e[44;34m++++\e[0m\e[47;37m_\e[0m\r
\e[42;32m\e[0m\r
-\e[0mSeg:16b0 Size:273 Owner:0x858c\r
-\e[44;34m+++++\e[0m\e[47;37m_\e[0m\r
+\e[0mSeg:1692 Size:273 Owner:0x858c\r
+\e[44;34m++++\e[0m\e[47;37m_\e[0m\r
-\e[0mSeg:1cff Size:40 Owner:0x35a0\r
-\e[41;31m++\e[0m\e[47;37m_\e[0m\r
-\e[42;32m000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\e[0m\r
-\e[0mSeg:ad27 Size:13017 Owner:0x3578\r
-\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
+\e[0mSeg:1ce1 Size:40 Owner:0x0\r
+\e[41;31m+\e[0m\e[47;37m_\e[0m\r
+\e[42;32m0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\e[0m\r
+\e[0mSeg:ad09 Size:13047 Owner:0x0\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
-\e[0mSeg:e000 Size:8191 Owner:0x358c\r
-\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
+\e[0mSeg:e000 Size:8191 Owner:0x0\r
+\e[41;31m\e[0m\e[47;37m_\e[0m\r
- USED block at 1d210016 of size 66\r
- FREE block at 1d210058 of size 18\r
- USED block at 1d21006a of size 136\r
- USED block at 1d2100f2 of size 20\r
- FREE block at 1d210106 of size 7926\r
+ USED block at 1d030016 of size 66\r
+ FREE block at 1d030058 of size 18\r
+ USED block at 1d03006a of size 136\r
+ USED block at 1d0300f2 of size 20\r
+ FREE block at 1d030106 of size 7926\r
OK - end of heap\r
\r
== near ==\r
OK - end of heap\r
\r
== near ==\r
mmblocktype huge *scan,huge *last;
word segm=1;
word oldend;
mmblocktype huge *scan,huge *last;
word segm=1;
word oldend;
- dword segmlen=seglength;
dword extra;
scan = last = mm->mmhead;
dword extra;
scan = last = mm->mmhead;
//printf(" seglen=%lu\n", scan->length);
}
//printf(" seglen=%lu\n", scan->length);
}
- //find out how many blocks it spans!
- //
+//
+// take the given range out of the block
+//
+ oldend = scan->start + scan->length;
+ extra = oldend - (segstart+seglength);
+
+ segmlen=extra;
+//
+// find out how many blocks it spans!
+//
for(;segmlen>0x10000;segmlen-=0x10000)
{
//printf(" seglen=%lu\n", segmlen);
segm++;
}
for(;segmlen>0x10000;segmlen-=0x10000)
{
//printf(" seglen=%lu\n", segmlen);
segm++;
}
-//
-// take the given range out of the block
-//
- oldend = scan->start + scan->length;
- extra = oldend - (segstart+(word)seglength);
- if(segm>1 || extra>=0x10000lu)
+ if(segm>1/* || extra>=0x10000lu*/)
//if(extra>0xfffflu)
{
scan->blob=segm;
//if(extra>0xfffflu)
{
scan->blob=segm;
-void MM_GetPtr(memptr *baseptr,dword size, mminfo_t *mm, mminfotype *mmi)
+void MM_GetPtr (memptr *baseptr, dword size, mminfo_t *mm, mminfotype *mmi)
- mmblocktype huge *scan,huge *lastscan,huge *endscan,huge *purge,huge *next;
+ mmblocktype huge *scan,huge *lastscan,huge *endscan
+ ,huge *purge,huge *next;
- dword needed;
- word startseg;
+ unsigned needed,startseg;
needed = (size+15)/16; // convert size from bytes to paragraphs
needed = (size+15)/16; // convert size from bytes to paragraphs
GETNEWBLOCK; // fill in start and next after a spot is found
mm->mmnew->length = needed;
mm->mmnew->useptr = baseptr;
mm->mmnew->attributes = BASEATTRIBUTES;
GETNEWBLOCK; // fill in start and next after a spot is found
mm->mmnew->length = needed;
mm->mmnew->useptr = baseptr;
mm->mmnew->attributes = BASEATTRIBUTES;
-//printf("."); //0000
- for(search = 0; search<3; search++)
+
+//tryagain:
+ for (search = 0; search<3; search++)
-printf("\n [case]"); //0000
//
// first search: try to allocate right after the rover, then on up
// second search: search from the head pointer up to the rover
// third search: compress memory, then scan from start
//
// first search: try to allocate right after the rover, then on up
// second search: search from the head pointer up to the rover
// third search: compress memory, then scan from start
- if(search == 1 && mm->mmrover == mm->mmhead)
+ if (search == 1 && mm->mmrover == mm->mmhead)
lastscan = mm->mmrover;
scan = mm->mmrover->next;
endscan = NULL;
break;
case 1:
lastscan = mm->mmrover;
scan = mm->mmrover->next;
endscan = NULL;
break;
case 1:
lastscan = mm->mmhead;
scan = mm->mmhead->next;
endscan = mm->mmrover;
break;
case 2:
lastscan = mm->mmhead;
scan = mm->mmhead->next;
endscan = mm->mmrover;
break;
case 2:
-printf("2 "); //0000
- MM_SortMem(mm);
lastscan = mm->mmhead;
scan = mm->mmhead->next;
endscan = NULL;
lastscan = mm->mmhead;
scan = mm->mmhead->next;
endscan = NULL;
}
startseg = lastscan->start + lastscan->length;
}
startseg = lastscan->start + lastscan->length;
-printf(" %x\n", startseg);
- while(scan != endscan)
+
+ while (scan != endscan)
-printf(","); //0000
- if(scan->start - startseg >= needed)
+ if (scan->start - startseg >= needed)
//
// got enough space between the end of lastscan and
// the start of scan, so throw out anything in the middle
//
// got enough space between the end of lastscan and
// the start of scan, so throw out anything in the middle
//
purge = lastscan->next;
lastscan->next = mm->mmnew;
//
purge = lastscan->next;
lastscan->next = mm->mmnew;
- mm->mmnew->start = *(word *)baseptr = startseg;
+ mm->mmnew->start = *(unsigned *)baseptr = startseg;
{ // free the purgable block
{ // free the purgable block
-printf(" freeing block~\n"); //0000
next = purge->next;
FREEBLOCK(purge);
purge = next; // purge another if not at scan
next = purge->next;
FREEBLOCK(purge);
purge = next; // purge another if not at scan
//
// if this block is purge level zero or locked, skip past it
//
//
// if this block is purge level zero or locked, skip past it
//
- if((scan->attributes & LOCKBIT)
+ if ( (scan->attributes & LOCKBIT)
|| !(scan->attributes & PURGEBITS) )
{
|| !(scan->attributes & PURGEBITS) )
{
-printf(" [lock] "); //0000
-printf("start=%x ", lastscan->start);
-printf("len=%x ", lastscan->length);
-printf("\n"); //0000
-printf(" %x", lastscan->start + lastscan->length); //0000
-printf(" %x", lastscan->start + (word)lastscan->length); //0000
-printf(" %x", (word)lastscan->start + (word)lastscan->length); //0000
-printf("\n"); //0000
- startseg = (word)lastscan->start + (word)lastscan->length+1;
-printf("startseg =%x ok", startseg); //0000
+ startseg = lastscan->start + lastscan->length;
scan=scan->next; // look at next line
scan=scan->next; // look at next line