diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..86d0083 --- /dev/null +++ b/.cproject @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sys/include/vmm/paging.h b/src/sys/include/vmm/paging.h index d44bea8..3eb6643 100644 --- a/src/sys/include/vmm/paging.h +++ b/src/sys/include/vmm/paging.h @@ -69,7 +69,7 @@ void vmmUnmapPages(void *,uInt32); void *vmmMapFromTask(pidType,void *,uInt32); void *vmmCopyVirtualSpace(pidType); -void *vmmGetFreePage(pidType); +void *vmmGetFreeKernelPage(pidType); void *vmmGetFreeKernelPage(pidType pid,uInt16 count); void *vmmCreateVirtualSpace(pidType); void *vmmGetFreeVirtualPage(pidType,int,int); diff --git a/src/sys/vmm/getfreepage.c b/src/sys/vmm/getfreepage.c index 994e04d..a6d6115 100644 --- a/src/sys/vmm/getfreepage.c +++ b/src/sys/vmm/getfreepage.c @@ -35,7 +35,7 @@ /************************************************************************ -Function: void *vmmGetFreePage(pidType pid); +Function: void *vmmGetFreeKernelPage(pidType pid); Description: Returns A Free Page Mapped To The VM Space @@ -45,7 +45,7 @@ ************************************************************************/ void * -vmmGetFreePage(pidType pid) +vmmGetFreeKernelPage(pidType pid) { uInt16 x = 0x0, y = 0x0; uInt32 *pageTableSrc = 0x0; @@ -62,7 +62,7 @@ if ((uInt32) pageTableSrc[y] == (uInt32) 0x0) { /* Map A Physical Page To The Virtual Page */ if ((vmm_remapPage(vmmFindFreePage(pid), ((x * 0x400000) + (y * 0x1000)),KERNEL_PAGE_DEFAULT)) == 0x0) - kpanic("vmmRemapPage: vmmGetFreePage\n"); + kpanic("vmmRemapPage: vmmGetFreeKernelPage\n"); /* Clear This Page So No Garbage Is There */ vmmClearVirtualPage((uInt32) ((x * 0x400000) + (y * 0x1000))); /* Return The Address Of The Newly Allocate Page */ diff --git a/src/sys/vmm/vmm_virtual.c b/src/sys/vmm/vmm_virtual.c index e901b8e..1113121 100644 --- a/src/sys/vmm/vmm_virtual.c +++ b/src/sys/vmm/vmm_virtual.c @@ -1,5 +1,5 @@ /***************************************************************************************** - Copyright (c) 2002-2004,2005,2006,2007 The UbixOS Project + Copyright (c) 2002-2004,2005,2006,2007,2009 The UbixOS Project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are @@ -43,7 +43,7 @@ pageDir = (uInt32 *) parentPageDirAddr; #ifdef VMMDEBUG - kprintf("CVS: [0x%X]\n",addr); + kprintf("Called: vmm_cleanVirtualSpace(0x%X)\n",addr); #endif /* Loop through the users virtual space flushing out COW pages */ @@ -52,7 +52,7 @@ if ((pageDir[x] & PAGE_PRESENT) == PAGE_PRESENT) { pageTableSrc = (uInt32 *) (tablesBaseAddress + (0x1000 * x)); for (y = 0;y < 1024;y++) { - if (pageTableSrc[y] != 0x0) { + if (pageTableSrc[y] != 0x0) { if ((pageTableSrc[y] & PAGE_COW) == PAGE_COW) { //kprintf("COWi*"); pageTableSrc[y] = 0x0; @@ -234,9 +234,9 @@ uInt32 *pageDir = 0x0; uInt32 start_page = 0x0; - + spinLock(&fvpSpinLock); - + pageDir = (uInt32 *) parentPageDirAddr; /* Lets Search For A Free Page */ @@ -370,16 +370,16 @@ uInt16 x = 0, i = 0, s = 0; spinLock(&cvsSpinLock); - + /* Set Address Of Parent Page Directory */ parentPageDirectory = (uInt32 *) parentPageDirAddr; /* Allocate A New Page For The New Page Directory */ if ((newPageDirectory = (uInt32 *) vmmGetFreeKernelPage(pid,1)) == 0x0) kpanic("Error: newPageDirectory == NULL, File: %s, Line: %i\n",__FILE__,__LINE__); - + /* Set newPageDirectoryAddress To The Newly Created Page Directories Page */ newPageDirectoryAddress = (void *)vmm_getPhysicalAddr((uInt32) newPageDirectory); - + /* First Set Up A Flushed Page Directory */ memset(newPageDirectory,0x0,0x1000); @@ -387,7 +387,7 @@ for (x = 768; x < pageEntries; x++) { newPageDirectory[x] = parentPageDirectory[x]; } - + /* * Now For The Fun Stuff For Page Tables 1-766 We Must Map These And Set * The Permissions On Every Mapped Pages To COW This Will Conserve Memory @@ -404,7 +404,7 @@ /* Set Parent And New Pages To COW */ for (i = 0; i < pageEntries; i++) { - + /* If Page Is Mapped */ if ((parentPageTable[i] & 0xFFFFF000) != 0x0) { /* Check To See If Its A Stack Page */ @@ -415,7 +415,7 @@ /* Set Pointer To Parents Stack Page */ parentStackPage = (uInt32 *) (((1024 * 4096) * x) + (4096 * i)); - + /* Copy The Tack Byte For Byte (I Should Find A Faster Way) */ for (s = 0x0; s < pageEntries; s++) { newStackPage[s] = parentStackPage[s]; @@ -457,7 +457,7 @@ */ if ((newPageTable = (uInt32 *) vmmGetFreeKernelPage(pid,1)) == 0x0) kpanic("Error: newPageTable == NULL, File: %s, Line: %i\n",__FILE__,__LINE__); - + /* Flush The Page From Garbage In Memory */ memset(newPageTable,0x0,0x1000); @@ -509,9 +509,9 @@ vmmUnmapPage((uInt32) newPageTable, 1); /* Now We Are Done With The Page Directory So Lets Unmap That Too */ vmmUnmapPage((uInt32) newPageDirectory, 1); - + spinUnlock(&cvsSpinLock); - + /* Return Physical Address Of Page Directory */ return (newPageDirectoryAddress); } /* end func */ @@ -539,9 +539,7 @@ Set Of Pages ************************************************************************/ -void * -vmmCreateVirtualSpace(pid_t pid) -{ +void *vmmCreateVirtualSpace(pid_t pid) { void *newPageDirectoryAddress = 0x0; uInt32 *parentPageDirectory = 0x0, *newPageDirectory = 0x0; uInt32 *parentPageTable = 0x0, *newPageTable = 0x0; @@ -550,7 +548,7 @@ /* Set Address Of Parent Page Directory */ parentPageDirectory = (uInt32 *) parentPageDirAddr; /* Allocate A New Page For The New Page Directory */ - newPageDirectory = (uInt32 *) vmmGetFreePage(pid); + newPageDirectory = (uInt32 *) vmmGetFreeKernelPage(pid); /* Set newPageDirectoryAddress To The Newly Created Page Directories Page */ newPageDirectoryAddress = (void *)vmm_getPhysicalAddr((uInt32) newPageDirectory); /* First Set Up A Flushed Page Directory */ @@ -565,7 +563,7 @@ * Allocate A New Page For The The First Page Table Where We Will Map The * Lower Region */ - newPageTable = (uInt32 *) vmmGetFreePage(pid); + newPageTable = (uInt32 *) vmmGetFreeKernelPage(pid); /* Flush The Page From Garbage In Memory */ for (x = 0; x < pageEntries; x++) { newPageTable[x] = 0x0; @@ -589,7 +587,7 @@ /* First Lets Unmap The Previously Allocated Page Table */ vmmUnmapPage((uInt32) newPageTable, 1); /* Allocate A New Page Table */ - newPageTable = (uInt32 *) vmmGetFreePage(pid); + newPageTable = (uInt32 *) vmmGetFreeKernelPage(pid); /* First Set Our Page Directory To Contain This */ newPageDirectory[767] = vmm_getPhysicalAddr((uInt32) newPageTable) | PAGE_DEFAULT; /* Now Lets Build The Page Table */ @@ -602,7 +600,7 @@ vmmUnmapPage((uInt32) newPageDirectory, 1); /* Return Physical Address Of Page Directory */ return (newPageDirectoryAddress); - } /* end func */ + } /* End Func */ /* END