All pastes #452331 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-22 05:35 UTC
rendered paste body
/***** t.c file for LAB5.1 **************
 kstack[] in PROC
 Use printf() for all printing
*****************************************/
#include "globals.h"
#include "freeList.h"
#include "io.h"
#include "procMan.h"
#include "queue.h"
/* MY int.c file ...but what goes IN it? CHECK TBD
#include "int.c"*/

PROC mainProc, proc[NUM_OF_TASKS], *freeList, *running, *readyQueue;
int ntasks;
char* statusName[5]={"free","ready","sleep","zombie","killed"};
int procSize = sizeof(PROC);

char *name[]={"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus","Neptune" };

char *gasp[NUM_OF_TASKS]={
	"1Oh! You are killing me .......\n",
	"2Oh! I am dying ...............\n", 
	"3Oh! I am a goner .............\n", 
	"4Bye! Bye! World...............\n", 
	"5Oh! You are killing me .......\n",
	"6Oh! I am dying ...............\n", 
	"7Oh! I am a goner .............\n", 
	"8Bye! Bye! World...............\n", 
};/*end global "i'm dying" remarks for each process*/


int int80h();

int set_vec(ushort vector, ushort addr)
{
	ushort location,cs;
	location = vector << 2;
	myprintf("in set_vec\n\r");
	put_word(addr, 0, location);
	put_word(0x1000,0,location+2);
	return 0;
}/*end int set_vec(vector,addr)*/


int main()
{
	resetVideo();
	myprintf("\nWelcome to the 460 Multitasking System: lab5test\n\r");

 	myprintf("initializing ......\n");
 	initialize();
 	myprintf("initialization complete\n");

 	set_vec(80, (ushort)int80h);
 	myfork(); 
 	do_switch();
 	/*tswitch();*/
 	myprintf("all dead, happy ending\n");
 	return 0;
}/*end int main*/