Example #1
0
void pageManagementInit(){
	uint64_t endMem = 512 * 0x100000;
	uint64_t freeMemory =  (uint64_t) stackEnd;
	stackCurrent = stackStart;
	uint64_t frames = (endMem - freeMemory) / pageSize;


	ncPrint("  Cantidad de frames: ");
	ncPrintDec(frames);
	ncNewline();

	uint64_t i;
	for(int i=0; i<frames ;i++){
		*stackCurrent = freeMemory + (i* pageSize);
		stackCurrent ++;
	}


//Testeo de paging
/*
uint64_t a = (uint64_t)pageAlloc();
ncPrint("  Direccion: 0x");
ncPrintHex(a);
ncNewline();

a = (uint64_t)pageAlloc();
ncPrint("  Direccion: 0x");
ncPrintHex(a);
ncNewline();

*/
}
Example #2
0
static void loadModule(uint8_t ** module, void * targetModuleAddress)
{
	uint32_t moduleSize = readUint32(module);

	ncPrint("  Will copy module at 0x");
	ncPrintHex((uint64_t)*module);
	ncPrint(" to 0x");
	ncPrintHex((uint64_t)targetModuleAddress);
	ncPrint(" (");
	ncPrintDec(moduleSize);
	ncPrint(" bytes)");

	memcpy(targetModuleAddress, *module, moduleSize);
	*module += moduleSize;

	ncPrint(" [Done]");
	ncNewline();
}