mmi->nearheap = length;
printf("start=%FP segstart=%X seglen=%lu len=%lu\n", start, segstart, seglength, length);
//heapdump();
- //getch();
//
// get all available far conventional memory segments
mmi->mainmem = mmi->nearheap + mmi->farheap;
- getch();
+// getch();
//goto xmsskip;
unsigned needed,startseg;
needed = (size+15)/16; // convert size from bytes to paragraphs
-
+printf("."); //0000
MM_GetNewBlock(mm); // 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++)
{
+printf("|[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
switch(search)
{
case 0:
+printf("0"); //0000
lastscan = mm->mmrover;
scan = mm->mmrover->next;
endscan = NULL;
break;
case 1:
+printf("1"); //0000
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;
while(scan != endscan)
{
+printf(","); //0000
if(scan->start - startseg >= needed)
{
+printf("\\"); //0000
//
// got enough space between the end of lastscan and
// the start of scan, so throw out anything in the middle
mm->mmnew->next = scan;
while(purge != scan)
{ // free the purgable block
+printf(" freeing block~\n"); //0000
next = purge->next;
MM_FreeBlock(purge, mm);
purge = next; // purge another if not at scan
if((scan->attributes & LOCKBIT)
|| !(scan->attributes & PURGEBITS) )
{
+printf("/[lock]"); //0000
lastscan = scan;
startseg = lastscan->start + lastscan->length;
}
*/
//****#if 0
-printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug!
+//printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug!
strcpy(scratch,"Seg:");
ultoa (scan->start,str,16);
strcat (scratch,str);