/**************************************************************************************
$Id: schedule.h,v 1.2 2002/04/20 11:52:02 reddawg Exp $


**************************************************************************************/

#define NO_TASKS	1024
#define RUNABLE		3
#define ACTIVE		2
#define INACTIVE	1
#define AVAILABLE 0
#define SYS_DATA_SEL    0x18




struct tssStruct {
  short		back_link;
  short		back_link_reserved;
  long    esp0;
  short		ss0;
  short		ss0_reserved;
  long		esp1;
  short		ss1;
  short		ss1_reserved;
  long		esp2;
  short		ss2;
  short		ss2_reserved;
  long    cr3;
  long    eip;
  long    eflags;
  long    eax,ecx,edx,ebx;
  long    esp;
  long    ebp;
  long    esi;
  long    edi;
  short		es;
  short		es_reserved;
  short		cs;
  short		cs_reserved;
  short		ss;
  short		ss_reserved;
  short		ds;
  short		ds_reserved;
  short		fs;
  short		fs_reserved;
  short		gs;
  short		gs_reserved;
  short		ldt;
  short		ldt_reserved;
  long    trace_bitmap;   /* bits: trace 0, bitmap 16-31 */
  };

struct i387Struct {
  long    cwd;
  long    swd;
  long    twd;
  long    fip;
  long    fcs;
  long    foo;
  long    fos;
  long    st_space[20];   /* 8*10 bytes for each FP-reg = 80 bytes */
  };

struct taskStruct {
  struct tssStruct tss;
  struct i387Struct i387;
  int id;
  int status;
  int usedMath;
  };

extern struct taskStruct taskList[NO_TASKS];
extern struct taskStruct *_current,*_usedMath;


void initScheduler();
int findTask();
void schedule();

extern int currentProc;

void timerINT();