diff --git a/src/sys/include/lib/kmalloc.h b/src/sys/include/lib/kmalloc.h index 1b3d101..937a4c8 100644 --- a/src/sys/include/lib/kmalloc.h +++ b/src/sys/include/lib/kmalloc.h @@ -41,11 +41,10 @@ struct memDescriptor *next; //4 void *baseAddr; //4 uInt32 limit; //4 - /*uInt8 status; //1 */ - /*char reserved[11]; //11 */ }; -void kfree(void *baseAddr); +int kmalloc_init(); +void kfree(void *baseAddr); void *kmalloc(uInt32 len); #endif diff --git a/src/sys/include/mpi/mpi.h b/src/sys/include/mpi/mpi.h index 255c9b5..fb5af3b 100644 --- a/src/sys/include/mpi/mpi.h +++ b/src/sys/include/mpi/mpi.h @@ -53,7 +53,7 @@ typedef struct mpi_mbox mpi_mbox_t; typedef struct mpi_message mpi_message_t; - +int mpi_init(); int mpi_createMbox(char *); int mpi_destroyMbox(char *); int mpi_postMessage(char *,uInt32,mpi_message_t *); @@ -64,6 +64,9 @@ /*** $Log$ + Revision 1.1 2004/10/22 20:05:17 reddawg + Ok enough with the pet tonight + END ***/ diff --git a/src/sys/include/ubixos/init.h b/src/sys/include/ubixos/init.h index a3f02ca..25c6b6e 100644 --- a/src/sys/include/ubixos/init.h +++ b/src/sys/include/ubixos/init.h @@ -33,6 +33,8 @@ #include #include #include +#include +#include typedef int (*intFunctionPTR)(void); @@ -43,6 +45,8 @@ i8259_init, idt_init, vmm_init, + kmalloc_init, + mpi_init, }; int init_tasksTotal = sizeof(init_tasks)/sizeof(intFunctionPTR); diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 2c28793..67bdaf9 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -89,12 +89,16 @@ kprintf("Error: Initializing System.\n"); } } - + kprintf("a"); mpi_createMbox("box_a"); + kprintf("b"); mpi_createMbox("box_b"); + kprintf("c"); msg_b.header = 0x2; sprintf(msg_b.data,"Hi"); + kprintf("d"); mpi_postMessage("box_a",0x1,&msg_b); + kprintf("e"); mpi_fetchMessage("box_a",&msg_a); kprintf("msg_a: [0x%X:%s]\n",msg_a.header,msg_a.data); diff --git a/src/sys/lib/kmalloc.c b/src/sys/lib/kmalloc.c index 47c806a..bcb98c3 100644 --- a/src/sys/lib/kmalloc.c +++ b/src/sys/lib/kmalloc.c @@ -53,6 +53,15 @@ static spinLock_t mallocSpinLock = SPIN_LOCK_INITIALIZER; static spinLock_t emptyDescSpinLock = SPIN_LOCK_INITIALIZER; +int kmalloc_init() { + usedKernDesc = 0x0; + freeKernDesc = 0x0; + emptyKernDesc = 0x0; + mallocSpinLock = SPIN_LOCK_INITIALIZER; + emptyDescSpinLock = SPIN_LOCK_INITIALIZER; + return(0x0); + } + /************************************************************************ Function: void *getEmptyDesc() @@ -182,6 +191,7 @@ 03/05/03 - We Have A Problem It Seems The First Block Is Limit 0x0 ************************************************************************/ +#if 0 static void mergeMemBlocks() { struct memDescriptor *tmpDesc1 = 0x0; struct memDescriptor *tmpDesc2 = 0x0; @@ -232,7 +242,7 @@ } return; } - +#endif /************************************************************************ @@ -387,6 +397,9 @@ /*** $Log$ + Revision 1.1 2004/10/30 11:44:29 reddawg + Tested out the MPI seems to function well how ever I am going to adjust the way sync_messages work and kmalloc has been reimplimented + Revision 1.32 2004/09/28 21:50:04 reddawg kmalloc: now when we kfree memory is filled with 0xBE so it is easy to debug if we continue to use free'd memory diff --git a/src/sys/mpi/mpi.c b/src/sys/mpi/mpi.c index 964f273..306dcda 100644 --- a/src/sys/mpi/mpi.c +++ b/src/sys/mpi/mpi.c @@ -38,6 +38,12 @@ static mpi_mbox_t *mboxList = 0x0; static spinLock_t mpiSpinLock = SPIN_LOCK_INITIALIZER; +int mpi_init() { + mboxList = 0x0; + mpiSpinLock = SPIN_LOCK_INITIALIZER; + return(0x0); + } + /***************************************************************************************** Function: static mpiMbox_t * mpi_findMbox(char *name) @@ -48,8 +54,7 @@ *****************************************************************************************/ static mpi_mbox_t * mpi_findMbox(char *name) { - mpi_mbox_t *mbox = 0x0; - + mpi_mbox_t *mbox = 0x0; for (mbox = mboxList;mbox;mbox = mbox->next) { if (!strcmp(mbox->name,name)) { return(mbox); diff --git a/src/sys/vmm/paging.c b/src/sys/vmm/paging.c index cbe0013..75c7cf3 100644 --- a/src/sys/vmm/paging.c +++ b/src/sys/vmm/paging.c @@ -58,6 +58,11 @@ int vmm_pagingInit(){ uInt32 i = 0x0; uInt32 *pageTable = 0x0; + + /* Initialize globals */ + rmpSpinLock = SPIN_LOCK_INITIALIZER; + fkpSpinLock = SPIN_LOCK_INITIALIZER; + kernelPageDirectory = 0x0; /* Allocate A Page Of Memory For Kernels Page Directory */ kernelPageDirectory = (uInt32 *) vmm_findFreePage(VMM_SYS_ID);