diff --git a/src/sys/include/mpi/mpi.h b/src/sys/include/mpi/mpi.h index fb5af3b..ae6d4f1 100644 --- a/src/sys/include/mpi/mpi.h +++ b/src/sys/include/mpi/mpi.h @@ -37,7 +37,7 @@ struct mpi_message { char data[MESSAGE_LENGTH]; uInt32 header; - pidType pid; + pid_t pid; struct mpi_message *next; }; @@ -47,7 +47,7 @@ struct mpi_message *msg; struct mpi_message *msgLast; char name[64]; - pidType pid; + pid_t pid; }; typedef struct mpi_mbox mpi_mbox_t; @@ -64,6 +64,9 @@ /*** $Log$ + Revision 1.2 2004/10/30 12:09:23 reddawg + Fixed a few bugs that came about when rebooting + Revision 1.1 2004/10/22 20:05:17 reddawg Ok enough with the pet tonight diff --git a/src/sys/include/sys/sched.h b/src/sys/include/sys/sched.h index faf1d67..cb56f65 100644 --- a/src/sys/include/sys/sched.h +++ b/src/sys/include/sys/sched.h @@ -32,6 +32,12 @@ #include +typedef struct k_task { + pid_t pid; + struct k_task *next; + struct k_task *prev; + } k_task_t; + int sched_init(); void sched(); diff --git a/src/sys/include/types.h b/src/sys/include/types.h index 04626f8..9f655c8 100644 --- a/src/sys/include/types.h +++ b/src/sys/include/types.h @@ -36,6 +36,10 @@ #define NULL 0x0 #endif + +typedef __uint16_t pid_t; + + typedef unsigned char uInt8; typedef unsigned short uInt16; typedef unsigned int uInt32; @@ -54,10 +58,6 @@ typedef unsigned int u_int; typedef unsigned long u_long; - -typedef int pidType; - -typedef int pid_t; typedef int size_t; /* standart */ #ifndef NOBOOL @@ -98,6 +98,9 @@ /*** $Log$ + Revision 1.1 2004/10/08 21:03:28 reddawg + Ubix32 Shell Completed!!! Time to add features back in one by one... nobody shall touch this tree till I ok it + Revision 1.6 2004/09/08 22:04:10 apwillia Added calling of static constructors, commented out tty_printf in kprintf (due to deadlock) diff --git a/src/sys/include/vmm/vmm.h b/src/sys/include/vmm/vmm.h index e522dc0..2047592 100644 --- a/src/sys/include/vmm/vmm.h +++ b/src/sys/include/vmm/vmm.h @@ -65,11 +65,11 @@ void vmm_pageFault(); void _vmm_pageFault(); int vmm_pagingInit(); -int vmm_remapPage(uInt32,uInt32,uInt16,pidType); -void vmm_freeProcessPages(pidType); +int vmm_remapPage(uInt32,uInt32,uInt16,pid_t); +void vmm_freeProcessPages(pid_t); int vmm_adjustCowCounter(uInt32,int); int vmm_freePage(uInt32); -uInt32 vmm_findFreePage(pidType); +uInt32 vmm_findFreePage(pid_t); int vmm_buildMemoryMap(); int vmm_init(); diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index b3f50d2..4115335 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -30,20 +30,70 @@ #include #include #include +#include #include +#include +#include void timerInt(); +static k_task_t *sched_taskList = 0x0; +static spinLock_t sched_lock = SPIN_LOCK_INITIALIZER; +static u_int16_t sched_pid = 0x0; + +static k_task_t *sched_createTask() { + k_task_t *tmpTask = (k_task_t *)kmalloc(sizeof(k_task_t)); + tmpTask->pid = ched_pid++; + spinLock(&sched_lock); + if (sched_taskList == 0x0) { + sched_taskList = tmpTask; + tmpTask->next = 0x0; + tmpTask->prev = 0x0; + } + else { + sched_taskList->prev = tmpTask; + tmpTask->next = sched_taskList; + tmpTask->prev = 0x0; + sched_taskList = tmpTask; + } + spinUnlock(&sched_lock); + return(tmpTask); + } + +static int sched_destroyTask(k_task_t *tmpTask) { + spinLock(&sched_lock); + if (tmpTask->prev) + tmpTask->prev->next = tmpTask->next; + if (tmpTask->next) + tmpTask->next->prev = tmpTask->prev; + + if (tmpTask == sched_taskList) + sched_taskList = tmpTask->next; + + kfree(tmpTask); + spinUnlock(&sched_lock); + return(0x0); + } + + int sched_init() { setVector(timerInt, 0x68, (dInt + dPresent + dDpl0)); irqEnable(0x0); + + sched_taskList = 0x0; + + kprintf("initalizing scheduler\n"); return(0x0); } void sched() { - kprintf("."); + k_task_t *tmpTask = 0x0; + systemVitals->quantum += 2000; + tmpTask = sched_createTask(); + kprintf("(%i:%i:0x%X)",systemVitals->sysTicks,tmpTask->pid,tmpTask); + kfree(tmpTask); return; } diff --git a/src/sys/vmm/memory.c b/src/sys/vmm/memory.c index 3471ec6..ea7bab8 100644 --- a/src/sys/vmm/memory.c +++ b/src/sys/vmm/memory.c @@ -187,7 +187,7 @@ Notes: ************************************************************************/ -uInt32 vmm_findFreePage(pidType pid) { +uInt32 vmm_findFreePage(pid_t pid) { int i = 0x0; /* Lets Look For A Free Page */ @@ -302,7 +302,7 @@ 08/04/02 - Added Checking For COW Pages First ************************************************************************/ -void vmm_freeProcessPages(pidType pid) { +void vmm_freeProcessPages(pid_t pid) { int i=0,x=0; uInt32 *tmpPageTable = 0x0; uInt32 *tmpPageDir = (uInt32 *)VMM_PARENTPAGEDIRADDR; diff --git a/src/sys/vmm/paging.c b/src/sys/vmm/paging.c index 7092a5a..0361f45 100644 --- a/src/sys/vmm/paging.c +++ b/src/sys/vmm/paging.c @@ -163,7 +163,7 @@ 07/28/04 - If perms == 0x0 set to PAGE_DEFAULT *****************************************************************************************/ -int vmm_remapPage(uInt32 source,uInt32 dest,uInt16 perms,pidType pid) { +int vmm_remapPage(uInt32 source,uInt32 dest,uInt16 perms,pid_t pid) { uInt16 destPageDirectoryIndex = 0x0, destPageTableIndex = 0x0; uInt32 *pageDir = 0x0, *pageTable = 0x0; short i = 0x0; @@ -238,7 +238,7 @@ 07/30/02 - This Returns A Free Page In The Top 1GB For The Kernel *****************************************************************************************/ -void *vmm_getFreeKernelPage(pidType pid, u_int16_t count) { +void *vmm_getFreeKernelPage(pid_t pid, u_int16_t count) { int x = 0, y = 0, c = 0; u_int32_t *pageTableSrc = 0x0;