noss - trial


/*
PRIVATE void outa(int op, int arg){
	M[CP] = (arg << 8) | op;
	CP++;
}

PRIVATE void dotime(void){
	sclock += clock;
	uclock += (clock - ustart);
}

void boot2(void){
	int callswitchp;
	int a_activep, a_status, a_switchp;

	a_activep = searchsym("activep");
	a_status = searchsym("status");
	a_switchp = searchsym("switchp");
	callswitchp = CP;
	outa(icCall,a_switchp);
	outa(icEnd,0);

	eval(1);       // boot nos
	dotime();

	// userp is set by restoreCstate called from "runnable"
	while(M[a_activep] != 0){	// interrupt-execute loop
		M[a_status] = status;	// update to nos
		printf(" * ");
		n_switch++;
		eval(callswitchp);		// run switcher
		dotime();
	}
}
*/
/*
// event = time_out, stopped, blocked
void noss2(int event){
	if(M[a_activep] == 0){			// no process
		runflag = 0;				// stop simulation
		return;
	}
	M[a_status] = event;			// update to nos
	if(event == time_out || event == blocked)
		saveCstate(userp);
	restoreCstate(M[a_psw]);		// run switcher
	dt = clock;						// start timer
	printf(" * ");
	n_switch++;
}
*/
/*
// event = time_out, stopped, blocked, runnable
void noss(int event){
	if(M[a_activep] == 0){		// no process
		runflag = 0;			// stop simulation
		return;
	}
	M[a_status] = event;		// update to nos
	switch(event){
	case time_out:
	case blocked:
		saveCstate(userp);
		restoreCstate(M[a_psw]); // run switchp
		break;
	case stopped:
		restoreCstate(M[a_psw]); // run switchp
		break;
	case runnable:
		userp = TS;
		restoreCstate(userp);	// switch to user
		intflag = 1;			// enable interrupt
		sclock += (clock-dt);
		printf(" * ");
		n_switch++;
		break;
	}
	dt = clock;		// reset timer
}
*/
/*
// event = time_out, stopped, blocked, runnable
void noss(int event){
	if(M[a_activep] == 0){		// no process
		runflag = 0;			// stop simulation
		return;
	}
	M[a_status] = event;		// update to nos
	switch(event){
	case time_out:
	case blocked:
		saveCstate(userp);
		restoreCstate(M[a_psw]); // run switchp
		sysflag = 1;
		break;
	case stopped:
//		printf("stopped currentp %d\n",currentp);
//		if(currentp != M[a_psw]){
		if( ! sysflag ){
			restoreCstate(M[a_psw]); // run switchp
			sysflag = 1;
		}else{
			sysflag = 0;
			userp = M[a_activep];
			restoreCstate(userp);	// run userp
//			intflag = 1;			// enable interrupt
			sclock += (clock-dt);
			printf(" * ");
			n_switch++;
		}
		break;
	}
	dt = clock;		// reset timer
}
*/

/*
// run until timeout/blocked/stopped
void eval2(int ref){
	clock = 0;
	runflag = 1;
	PC = ref;
	while(runflag ) {
		if( intflag )
			if( clock > TIMEOUT ){
			status = time_out;
			break;
			}
//		trace();
		run3();		// execute one instruction
		ninst++;
	}
	saveCstate(userp);
}
*/

trap()

/*
		case 23:
			a = TS;				// pdes
			popts();
			saveCstate(a);
			break;

		case 24:
			noss(runnable);
			break;	// make runnable
*/
