Esempio n. 1
0
/* Suspend the current running process, and launch a running process. May be the
 * same if no other process are currently running*/
void yield(void)
{
	LOG("Transfering processes (current, next) : ");
	struct processDescriptor* current = 
		(struct processDescriptor*) getIndex(&runningList, 0)->element;
	rotateForward(&runningList);
	struct processDescriptor* next = 
		(struct processDescriptor*) getIndex(&runningList, 0)->element;
	LOG_INT(current->pid);
	LOG_CONT("  ");
	LOG_INT(next->pid);
	LOG_CONT("\n");
	wait(1000000);
	transfer(&(next->processState), &(current->processState));
}
Esempio n. 2
0
Record* Extent::getFirstRecord()
{
	LOG_INT("first record:", firstRecord);
	if (firstRecord == -1)
	{
		return NULL;
	}

	return (Record*)&data[firstRecord];
}
Esempio n. 3
0
/*
 * Delete current process, i.e. remove from runningList, free the Cell, 
 * and switch process. Free the stack too.
 */
void deleteProcess()
{
	struct processDescriptor* process = (struct processDescriptor*)
		 removeCell(&runningList, getIndex(&runningList, 0));
	LOG("Deleting process : ");
	LOG_INT((int) process->pid);
	LOG_CONT("\n");
	free2M(process->map.baseAddress);
	if(process->baseAddress) /* If stored in kernel memory*/
	{
		kfree(process->baseAddress);
	}
	kfree(process);
	struct processDescriptor* next = 
		(struct processDescriptor *) getIndex(&runningList, 0)->element;
	restartProcess(&(next->processState));
}
Esempio n. 4
0
void Namespace::printData()
{
	DiskLoc nextExtentLoc = firstExtentLoc;
	while (!nextExtentLoc.isNull())
	{
		Extent* extent = db->getExtent(nextExtentLoc);
		int nextRecordOffset = extent->firstRecord;
		while (nextRecordOffset != -1)
		{
			LOG_INT("print record num: ", nextRecordOffset);
			Record* record = extent->getRecord(nextRecordOffset);
			int jsonSize = 0;
//			bson_to_json(((bson*)record->data)->data, 0, true, 0, jsonSize);
			nextRecordOffset = record->nextRecLoc;
		}

		nextExtentLoc = extent->nextExtent;
	}
}
Esempio n. 5
0
/*
 * Launch the kernel, i.e. launch first process in the running list
 */
void startKernel(void)
{
	LOG("Gonna start the kernel, remind all processes :\n");
	
	int i = 0;
	int max = runningList.size;
	for( ; i < max ; i++)
	{
		struct processDescriptor* p = 
			(struct processDescriptor*) getIndex(&runningList, i)->element;
		printProcess(p);
	}
	struct processDescriptor* process = 
		(struct processDescriptor*) getIndex(&runningList, 0)->element;
	LOG("Starting process : ");
	LOG_INT(process->pid);
	LOG_CONT("\n");
/*	LOG_INT(process->ppid); */
	printProcess(process);
	LOG_CONT("\n");
	startProcess(&(process->processState));
}
Esempio n. 6
0
void printProcess(struct processDescriptor* process)
{
	LOG("Print process (map.baseAddress, pid, ppid, pc, sp, lr) :\n ");
	LOG_INT((int) process->map.baseAddress);
	LOG_CONT(" ");
	LOG_INT(process->pid);
	LOG_CONT(" ");
	LOG_INT(process->ppid);
	LOG_CONT(" ");
	LOG_INT((int)process->processState.pc);
	LOG_CONT(" ");
	LOG_INT((int)process->processState.sp);
	LOG_CONT(" ");
	LOG_INT((int)process->processState.lr);
	LOG_CONT("\n");
	wait(3000000);
}
Esempio n. 7
0
/* create new process and returns the cell containing the process */
struct cell * createProcess(void (*f)(void), void* baseAddress)
{
	void* area = get2M();
	LOG("Creating process at base address : ");
	LOG_INT((int)area);
	LOG_CONT("\n");
	/* Prepare initial processState*/
	struct processDescriptor * process =
		kalloc(sizeof(struct processDescriptor));
	
	process->processState.pc = f;
	process->processState.sp =  area + 2*SPACE - 4;
	/* When exiting, auto-delete process */
	process->processState.lr = &deleteProcess; 
	process->ppid = choosePPID();
	pidCounter++;
	process->pid = pidCounter;
	process->map.baseAddress = area;
	process->baseAddress = baseAddress;
	printProcess(process);
	insertAtEnd(&stoppedList, process);
	return getIndex(&stoppedList, 0)->previous;
}
Esempio n. 8
0
void Limits::print() const
{
#define LOG_INT(var) Log("%s = %d", #var, var)
	LOG_INT(maxColorAttachments);
	LOG_INT(maxDrawBuffers);
	LOG_INT(maxVertexTextureUnits);
	LOG_INT(maxFragmentTextureUnits);
	LOG_INT(maxCombinedTextureUnits);
	LOG_INT(maxTextureSize[TextureType_1D]);
	LOG_INT(maxTextureSize[TextureType_2D]);
	LOG_INT(maxTextureSize[TextureType_3D]);
	LOG_INT(maxTextureSize[TextureType_Rect]);
	LOG_INT(maxTextureSize[TextureType_CubeMap]);
	LOG_INT(maxTextureCoords);
	LOG_INT(maxVertexAttributes);
#undef LOG_INT
	Log("maxTextureAnisotropy = %f", maxTextureAnisotropy);
}