00001 /************************************************************************************** 00002 Copyright (c) 2002 The UbixOS Project 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 00006 00007 Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors. 00008 Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors 00009 in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its 00010 contributors may be used to endorse or promote products derived from this software without specific prior written permission. 00011 00012 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 00013 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00014 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00015 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00016 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00017 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00018 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00019 00020 $Id$ 00021 00022 **************************************************************************************/ 00023 00024 #ifndef _SCHED_H 00025 #define _SCHED_H 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 #include <ubixos/types.h> 00032 #include <ubixos/elf.h> 00033 #include <vfs/file.h> 00034 #include <sys/tss.h> 00035 00036 00037 typedef enum { DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3 } tState; 00038 00039 struct osInfo { 00040 struct mountPoints *container; 00041 elfSectionheader *sectionHeader; 00042 struct taskFileInfo fileInfo; 00043 struct consoleStruct *terminal; 00044 uInt16 sectionCount; 00045 uInt16 stringSection; 00046 uInt8 timer; 00047 uInt8 v86Task; 00048 bool v86If; 00049 uInt32 curDir; 00050 uInt32 vmStart; 00051 uInt32 stdinSize; 00052 uInt32 controlKeys; 00053 char *stdin; 00054 char *shstrtab; 00055 char *cwd; 00056 }; 00057 00058 typedef struct taskStruct { 00059 pidType id; 00060 struct taskStruct *prev; 00061 struct taskStruct *next; 00062 struct tssStruct tss; 00063 struct i387Struct i387; 00064 struct osInfo oInfo; 00065 tState state; 00066 uInt32 gid; 00067 uInt32 uid; 00068 uInt16 usedMath; 00069 } kTask_t; 00070 00071 00072 int schedInit(); 00073 void sched(); 00074 void schedYield(); 00075 int schedEndTask(pidType pid); 00076 kTask_t *schedNewTask(); 00077 kTask_t *schedFindTask(uInt32 id); 00078 int deleteTask(uInt32); 00079 00080 extern kTask_t *taskList; 00081 extern uInt32 nextID; 00082 extern kTask_t *_current; 00083 extern kTask_t *_usedMath; 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 #endif 00090