diff --git a/src/sys/vmm/getfreevirtualpage.c b/src/sys/vmm/getfreevirtualpage.c index 0b3a666..0dfb4d3 100644 --- a/src/sys/vmm/getfreevirtualpage.c +++ b/src/sys/vmm/getfreevirtualpage.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.1.1.1 2004/04/15 12:06:51 reddawg + UbixOS v1.0 + Revision 1.10 2004/04/13 16:36:34 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -35,6 +38,9 @@ #include #include +#include + +static spinLock_t fvpSpinLock = SPIN_LOCK_INITIALIZER; /************************************************************************ @@ -50,7 +56,11 @@ { int x = 0, y = 0, c = 0; uInt32 *pageTableSrc = 0x0; - uInt32 *pageDir = (uInt32 *) parentPageDirAddr; + uInt32 *pageDir = 0x0; + + spinLock(&fvpSpinLock); + + pageDir = (uInt32 *) parentPageDirAddr; /* Lets Search For A Free Page */ for (x = (_current->oInfo.vmStart / (1024 * 4096)); x < 1024; x++) { @@ -89,6 +99,7 @@ vmmRemapPage((uInt32) vmmFindFreePage(pid), ((x * (1024 * 4096)) + ((y + c) * 4096))); vmmClearVirtualPage((uInt32) ((x * (1024 * 4096)) + ((y + c) * 4096))); } + spinUnlock(&fvpSpinLock); return ((void *)((x * (1024 * 4096)) + (y * 4096))); } } else { @@ -102,12 +113,14 @@ /* Clear This Page So No Garbage Is There */ vmmClearVirtualPage((uInt32) ((x * (1024 * 4096)) + (y * 4096))); /* Return The Address Of The Newly Allocate Page */ + spinUnlock(&fvpSpinLock); return ((void *)((x * (1024 * 4096)) + (y * 4096))); } } } } /* If No Free Page Was Found Return NULL */ + spinUnlock(&fvpSpinLock); return (0x0); }