示例#1
0
文件: ssDDM.c 项目: q3k/ski
/*--------------------------------------------------------------------------
 * page$GetProtectionFlags - Prompt for address and access flags, then change
 *  the protection on the page containing the specified address to
 *  the specified access(es), creating the page if necessary.
 *--------------------------------------------------------------------------*/
BOOL pagGProt(unsigned argc, char *argv[])
{
    ADDR adr;
    REG accr = ~0, accid = ~0;
    BOOL ok;

    if (Proclvl == level0) {
	cmdErr("No page protection in Level 0 systems\n");
	return;
    }

    if (getVA(&sid, &adr) > 0) {
	getNumToken("Access rights: ", &accr, 16);
	getNumToken("Access ID: ", &accid, 16);
	if ((ok = pdeCreate(sid, adr, accr, accid)) == -1)
	    cmdErr("Can't create page -- out of memory\n");
	else if (!ok)
	    cmdwPrint("Page created with specified protection\n");
	else {
	    dtlbPurge(sid, adr);
	    itlbPurge(sid, adr);
	    cmdwPrint("Access protection changed\n");
	}
    }
}
示例#2
0
void ReadComplexes(char * filename)
{
	long currentToken;
	int currentComplex=0;
	FILE * fStream;
	numNonemptyComplexes=0;
	
	if((fStream = fopen(filename,"r"))){
		for(currentComplex = 0; currentComplex<numberOfComplexes; currentComplex++){
			ComplexMatched[currentComplex]=false;
			ComplexList[currentComplex].DeleteANode(ComplexList[currentComplex].Head);
			for(int i=0; i<numVerts; i++){ AlreadyCounted[i]=0; }
			ComplexSize[currentComplex]=0;
			while(0 <= (currentToken = getNumToken(fStream))){
				if(!AlreadyCounted[currentToken]){
					AlreadyCounted[currentToken]=1;
					ComplexSize[currentComplex]++;
					ComplexList[currentComplex].AddANode();
					ComplexList[currentComplex].Tail->Data = currentToken;
				}
			}
			if(ComplexSize[currentComplex]) numNonemptyComplexes++;
		}
		
	} else {
		fprintf(stderr,"Couldn't read complexes. %s\n",filename);
	}
	
	fclose(fStream);
}
示例#3
0
int ReadClustering(char * filename){
	FILE * fStream;
	int cluster = 0;
	long currentToken = 0;
	
	if((fStream = fopen(filename,"r"))){
		
		while(currentToken != -2){
			ClusterSize[cluster]=0;
			while((currentToken = getNumToken(fStream)) >= 0){
				
				if(currentToken>=numVerts){//Too many vertices in clustering.
					fprintf(stderr,"Vertex %d in the clustering file does not exist in the graph!  QUITTING.\n\n",(int) currentToken);
					exit(1);
				}
				
				
				whichCluster[currentToken] = cluster;
				ClusterSize[cluster]++;
			}
			ClusterMatched[cluster]=false;
			ClusterSMatched[cluster]=false;
			cluster++;
		}
		
		
		return cluster-1;
	}	else{
		fprintf(stderr,"Couldn't read clustering file %s.\n",filename);
		return -1;
	}
	fclose(fStream);
}
示例#4
0
int CountClusters(char * filename){
	FILE * fStream;
	int cluster = 0;
	long currentToken = 0;
	
	if((fStream = fopen(filename,"r"))){
		currentToken = getNumToken(fStream);
		while(currentToken != -2){
			while((currentToken = getNumToken(fStream)) >= 0){
				
			}
			cluster++;
		}
		return cluster-1;
	}	else{
		fprintf(stderr,"Couldn't read clustering.\n");
		return -1;
	}
}
示例#5
0
文件: ssDDM.c 项目: q3k/ski
/*--------------------------------------------------------------------------
 * space$GetBoundaries - Prompt for a space id, and required boundaries
 *  for pages to be allocated automatically in the space. The boundaries
 *  default to 1 for the lower bounds and 0 for the upper bounds.
 *--------------------------------------------------------------------------*/
BOOL spcGBds(unsigned argc, char *argv[])
{
    PGID lbd = 0, ubd = MAXPGID;
    REG accr = ~0, accid = ~0;

    if (Proclvl == level0) {
	cmdErr("No spaces in Level 0 systems\n");
	return;
    }

    if (getNum("Space ID: ", &sid, 16)) {
	getNumToken("Access rights: ", &accr, 16);
	getNumToken("Access ID: ", &accid, 16);
	getNumToken("Lower bound (page id #): ", &lbd, 16);
	getNumToken("Upper bound (page id #): ", &ubd, 16);
	if (!spcRestrict(sid, lbd, ubd, accr, accid))
	    cmdwPrint("Space created with given protection\n");
	else
	    cmdwPrint("Space protection boundaries changed\n");
    }
}
示例#6
0
int ReadClusteringNumber(char * filename){//GET THE NUMBER OF CLUSTERS
	FILE * fStream;
	int cluster = 0;
	long currentToken = 0;
	
	if((fStream = fopen(filename,"r"))){
		
		currentToken = getNumToken(fStream);
		while(currentToken != -2){
			while((currentToken = getNumToken(fStream)) >= 0){
			}
			cluster++;
		}
		//printf("CLUSTER COUNT: %d.\n",cluster-1);
		return cluster-1;
	}	else{
		fprintf(stderr,"ERROR: Couldn't parse data from file %s.  File misformatted or file not readable.\n",filename);
		return -1;
	}
	
	fclose(fStream);
	
}