diff --git a/src/lib/libc_old/stdlib/malloc.c b/src/lib/libc_old/stdlib/malloc.c index 12e6b3a..49944ac 100644 --- a/src/lib/libc_old/stdlib/malloc.c +++ b/src/lib/libc_old/stdlib/malloc.c @@ -104,8 +104,6 @@ len = MALLOC_ALIGN(len); - printf("MALLOC"); - if (len == 0x0) { return(0x0); } @@ -118,15 +116,12 @@ if (tmpDesc1 == freeKernDesc) freeKernDesc = tmpDesc1->next; - printf("MALLOC.01"); tmpDesc1->prev = 0x0; tmpDesc1->next = usedKernDesc; if (usedKernDesc != 0x0) usedKernDesc->prev = tmpDesc1; usedKernDesc = tmpDesc1; - printf("MALLOC.02"); if (tmpDesc1->limit > (len + 32)) { - printf("MALLOC.022"); tmpDesc2 = getEmptyDesc(); tmpDesc2->limit = tmpDesc1->limit - len; tmpDesc1->limit = len; @@ -134,23 +129,16 @@ tmpDesc2->next = 0x0; tmpDesc2->prev = 0x0; if (tmpDesc2->limit <= 0x0) - //printf("kmalloc-1 tmpDesc2: [%i:%i:%i]\n",tmpDesc2->limit,tmpDesc1->limit,len); insertFreeDesc(tmpDesc2); } - printf("MALLOC.023"); buf = (char *)tmpDesc1->baseAddr; - printf("MALLOC.24"); for (i=0;ilimit;i++) { (char)buf[i] = (char)0x0; } - printf("MALLOC.25"); - //printf("baseAddr1[0x%X:0x%X]",tmpDesc1,tmpDesc1->baseAddr); return(tmpDesc1->baseAddr); } } - printf("MALLOC.1"); tmpDesc1 = getEmptyDesc(); - //printf("no empty desc\n"); if (tmpDesc1 != 0x0) { tmpDesc1->baseAddr = (struct memDescriptor *)getPage((len + 4095)/4096); tmpDesc1->limit = len; @@ -167,7 +155,6 @@ tmpDesc2->prev = 0x0; tmpDesc2->next = 0x0; if (tmpDesc2->limit <= 0x0) - printf("kmalloc-2 tmpDesc2: [%i]\n",tmpDesc2->limit); insertFreeDesc(tmpDesc2); } buf = (char *)tmpDesc1->baseAddr; @@ -175,12 +162,10 @@ (char)buf[i] = (char)0x0; } - //printf("baseAddr2[0x%X:0x%X]",tmpDesc1,tmpDesc1->baseAddr); return(tmpDesc1->baseAddr); } //Return Null If Unable To Malloc - //printf("baseAddr3[0x0]"); return(0x0); } @@ -215,8 +200,6 @@ tmpDesc1->next = 0x0; tmpDesc1->prev = 0x0; - if (tmpDesc1->limit <= 0x0) - printf("kfree tmpDesc1: [%i]\n",tmpDesc1->limit); insertFreeDesc(tmpDesc1); //mergeMemBlocks(); @@ -292,6 +275,9 @@ /*** $Log$ + Revision 1.4 2005/10/21 20:57:35 reddawg + Ubix Is Back In A Working Condition + Revision 1.3 2005/10/21 20:07:07 reddawg Work has resumed diff --git a/src/sys/kernel/vitals.c b/src/sys/kernel/vitals.c index fc6a3c5..93d42ca 100644 --- a/src/sys/kernel/vitals.c +++ b/src/sys/kernel/vitals.c @@ -47,7 +47,9 @@ ************************************************************************/ int vitals_init() { /* Initialize Memory For The System Vitals Node */ + kprintf("A"); systemVitals = (vitalsNode *) kmalloc(sizeof(vitalsNode)); + kprintf("B"); /* If malloc Failed Then Error */ if (systemVitals == 0x0) diff --git a/src/sys/lib/kmalloc.c b/src/sys/lib/kmalloc.c index b26cdca..d563fc8 100644 --- a/src/sys/lib/kmalloc.c +++ b/src/sys/lib/kmalloc.c @@ -83,9 +83,11 @@ spinUnlock(&emptyDescSpinLock); return(tmpDesc); } - + + kprintf("boo"); if ((emptyKernDesc = (struct memDescriptor *)vmm_getFreeMallocPage(4)) == 0x0) kpanic("Error: vmmGetFreeKernelPage returned NULL\n"); + kprintf("yet?"); /* zero out the memory so we know there is no garbage */ memset(emptyKernDesc,0x0,0x4000); @@ -297,7 +299,9 @@ return(tmpDesc1->baseAddr); } } + kprintf("No Avail Block!\n"); tmpDesc1 = getEmptyDesc(); + kprintf("C"); //kprintf("no empty desc\n"); if (tmpDesc1 != 0x0) { pages = ((len + 4095)/4096); @@ -391,6 +395,9 @@ /*** $Log$ + Revision 1.2 2005/10/12 00:13:37 reddawg + Removed + Revision 1.1.1.1 2005/09/26 17:24:11 reddawg no message diff --git a/src/sys/vmm/memory.c b/src/sys/vmm/memory.c index a848248..afb478e 100644 --- a/src/sys/vmm/memory.c +++ b/src/sys/vmm/memory.c @@ -185,6 +185,8 @@ ************************************************************************/ uInt32 vmmFindFreePage(pidType pid) { int i = 0x0; + int x = 0x0; + long *page = 0x2000; /* Lets Look For A Free Page */ if (pid < sysID) { @@ -201,10 +203,21 @@ */ if ((vmmMemoryMap[i].status == memAvail) && (vmmMemoryMap[i].cowCounter == 0)) { vmmMemoryMap[i].status = memNotavail; + kprintf("Pid: [%i]\n",vmmMemoryMap[i].pid); vmmMemoryMap[i].pid = pid; freePages--; if (systemVitals) systemVitals->freePages = freePages; + + //page = vmmMemoryMap[i].pageAddr; + + vmm_remapPage(vmmMemoryMap[i].pageAddr,0x2000,KERNEL_PAGE_DEFAULT); + kprintf("BOS!: [0x%X]\n",vmmMemoryMap[i].pageAddr); + for (x = 0; x < 1024;x++) { + page[x] = 0xb0; + } + vmmUnmapPage(0x2000,1); + kprintf("BOE!\n"); spinUnlock(&vmmSpinLock); return (vmmMemoryMap[i].pageAddr); } @@ -333,6 +346,9 @@ /*** $Log$ + Revision 1.2 2005/10/12 00:13:38 reddawg + Removed + Revision 1.1.1.1 2005/09/26 17:24:51 reddawg no message diff --git a/src/sys/vmm/paging.c b/src/sys/vmm/paging.c index 7f29dcc..bf916bb 100644 --- a/src/sys/vmm/paging.c +++ b/src/sys/vmm/paging.c @@ -42,6 +42,7 @@ static spinLock_t fkpSpinLock = SPIN_LOCK_INITIALIZER; static spinLock_t rmpSpinLock = SPIN_LOCK_INITIALIZER; +static spinLock_t mlSpinLock = SPIN_LOCK_INITIALIZER; /***************************************************************************************** @@ -164,7 +165,7 @@ short i = 0x0; spinLock(&rmpSpinLock); - + //kprintf("S: [0x%X],D: 0x%X",source,dest); if (perms == 0x0) perms = KERNEL_PAGE_DEFAULT; @@ -262,6 +263,7 @@ kpanic("vmmRemapPage failed: gfkp-1\n"); vmmClearVirtualPage((uInt32) ((x * (1024 * 4096)) + ((y + c) * 4096))); } + kprintf("Count: %i\n",count); spinUnlock(&fkpSpinLock); return ((void *)((x * (1024 * 4096)) + (y * 4096))); } @@ -381,14 +383,16 @@ int c = 0x0; uInt32 *pageTableSrc = 0x0; - spinLock(&fkpSpinLock); + spinLock(&mlSpinLock); /* Lets Search For A Free Page */ for (x = 960; x < 1024; x++) { /* Set Page Table Address */ pageTableSrc = (uInt32 *) (tablesBaseAddress + (0x1000 * x)); for (y = 0; y < 1024; y++) { + kprintf("Y: %i\n",y); /* Loop Through The Page Table Find An UnAllocated Page */ if ((uInt32) pageTableSrc[y] == (uInt32) 0x0) { + kprintf("IF %i", count); if (count > 1) { for (c = 0; c < count; c++) { if (y + c < 1024) { @@ -398,33 +402,43 @@ } } } + kprintf("Find one? %i\n", c); if (c != -1) { for (c = 0; c < count; c++) { + kprintf("d.d"); vmm_remapPage((uInt32) vmmFindFreePage(sysID), ((x * 0x400000) + ((y + c) * 0x1000)),KERNEL_PAGE_DEFAULT); + kprintf("d"); vmmClearVirtualPage((uInt32) ((x * 0x400000) + ((y + c) * 0x1000))); - } - spinUnlock(&fkpSpinLock); + kprintf("e"); + } + kprintf("HMM?\n"); + spinUnlock(&mlSpinLock); return ((void *)((x * 0x400000) + (y * 0x1000))); + } } - } else { + else { + kprintf("else!"); /* Map A Physical Page To The Virtual Page */ vmm_remapPage((uInt32) vmmFindFreePage(sysID), ((x * 0x400000) + (y * 0x1000)),KERNEL_PAGE_DEFAULT); /* Clear This Page So No Garbage Is There */ vmmClearVirtualPage((uInt32) ((x * 0x400000) + (y * 0x1000))); /* Return The Address Of The Newly Allocate Page */ - spinUnlock(&fkpSpinLock); + spinUnlock(&mlSpinLock); return ((void *)((x * 0x400000) + (y * 0x1000))); + } } } } - } /* If No Free Page Was Found Return NULL */ - spinUnlock(&fkpSpinLock); + spinUnlock(&mlSpinLock); return (0x0); -} + } /*** $Log$ + Revision 1.2 2005/10/12 00:13:38 reddawg + Removed + Revision 1.1.1.1 2005/09/26 17:24:53 reddawg no message