Ejemplo n.º 1
0
void InitTLBFunctions(void){
	int i;

	setup(SysEntry[0].syscall, SysEntry[0].function);
	Copy((void*)0x80075000, tlbsrc, size_tlbsrc);
	FlushCache(0);
	FlushCache(2);
	setup(SysEntry[1].syscall, SysEntry[1].function);

	for(i=3; i<8; i++){
		setup(SysEntry[i].syscall, GetEntryAddress(SysEntry[i].syscall));
	}

	_kExecArg=GetEntryAddress(3);
}
Ejemplo n.º 2
0
void InitAlarm(void)
{
	int i;

	setup(SysEntry[0].syscall, SysEntry[0].function);
	Copy((void*)0x80076000, srcfile, size_srcfile);
	Copy((void*)0x00082000, eenull, size_eenull);
	FlushCache(0);
	FlushCache(2);
	setup(SysEntry[1].syscall, SysEntry[1].function);

	for(i=2; i<8; i++)
		setup(SysEntry[i].syscall, GetEntryAddress(SysEntry[i].syscall));
}
Ejemplo n.º 3
0
void InitExecPS2(void){
	unsigned int i;

	if(PatchIsNeeded()){
		setup(SyscallPatchEntries[0].syscall_num, SyscallPatchEntries[0].function);
		Copy((unsigned int*)0x80074000, (unsigned int*)osdsrc, size_osdsrc);

		FlushCache(0);
		FlushCache(2);
		setup(SyscallPatchEntries[1].syscall_num, SyscallPatchEntries[1].function);

		for(i=2; i<3; i++){
			setup(SyscallPatchEntries[i].syscall_num, GetEntryAddress(SyscallPatchEntries[i].syscall_num));
		}
	}
}
Ejemplo n.º 4
0
CJcSegment* CreateObjectFile(CJcSymbolStack* pStack, char* sEntrySymbol)
{
	CJcSection oSection;
	jc_uint nSymbolTableSize, nSize;
	tag_endian end;
	CJcFileHead oHead = { {'C', 'O', 'B', 'J'}, '\0', sizeof(jc_char*), 1, 0, 0};
	CJcSymbolItem* pSymbolTable;
	CJcSegment* pSegment = New(CJcSegment);
	CJcSymbolItem* pEntry;
	CJcSegment oSymbolSegment;
	InitializeSegment(&oSymbolSegment, '\0');

	pSymbolTable = RebuildSymbolTable(pStack, &oSymbolSegment, &nSymbolTableSize);
	pEntry = GetEntryAddress(pStack, pSymbolTable, nSymbolTableSize, sEntrySymbol, &oSymbolSegment);

	end.s = (jc_ushort)256;
	oHead.endian = end.c;

	InitializeSegment(pSegment, '\0');
	PutInSegment(pSegment, &oHead, sizeof(oHead), sizeof(jc_ushort));

	oSection.tag = JC_CODESEG_SECTION;
	oSection.len = GetSizeOfSegment(&pStack->oCodeSegment);
	if(oSection.len)
	{
		PutInSegment(pSegment, &oSection, 8, sizeof(jc_uint));
		PutInSegment(pSegment, GetDataOfSegment(&pStack->oCodeSegment), oSection.len, sizeof(jc_uint));
	}

	oSection.tag = JC_DATASEG_SECTION;
	oSection.len = sizeof(jc_uint);
	nSize = GetSizeOfStack(&pStack->oDataSegment);
	if(nSize)
	{
		PutInSegment(pSegment, &oSection, 8, sizeof(jc_uint));
		PutInSegment(pSegment, &nSize, sizeof(nSize), sizeof(jc_uint));
	}

	oSection.tag = JC_CONSTSEG_SECTION;
	oSection.len = GetSizeOfSegment(&pStack->oConstSegment);
	if(oSection.len)
	{
		jc_uint nPos2, nPos1 = GetPosOfSegment(pSegment);
		PutInSegment(pSegment, &oSection, 8, 8);
		nPos2 = GetPosOfSegment(pSegment);
		if(nPos2 - nPos1 != 8)
		{
			jc_char* pDat = GetDataOfSegment(pSegment) + nPos1;
			*(jc_uint*)pDat = JC_ALIGN_SECTION;
		}
		PutInSegment(pSegment, GetDataOfSegment(&pStack->oConstSegment), oSection.len, 8);
	}

	if(nSymbolTableSize)
	{
		oSection.tag = JC_SYMTAB_SECTION;
		oSection.len = nSymbolTableSize*sizeof(CJcSymbolItem);
		PutInSegment(pSegment, &oSection, 8, sizeof(jc_uint));
		PutInSegment(pSegment, pSymbolTable, oSection.len, sizeof(jc_uint));

		oSection.tag = JC_SYMBOLSEG_SECTION;
		oSection.len = GetSizeOfSegment(&oSymbolSegment);
		PutInSegment(pSegment, &oSection, 8, sizeof(jc_uint));
		PutInSegment(pSegment, GetDataOfSegment(&oSymbolSegment), oSection.len, sizeof(jc_char));
	}

	if(pEntry)
	{
		oSection.tag = JC_ENTRY_SECTION;
		oSection.len = sizeof(jc_uint);
		PutInSegment(pSegment, &oSection, 8, sizeof(jc_uint));
		PutInSegment(pSegment, &pEntry->arg, sizeof(pEntry->arg), sizeof(jc_uint));
	}

	if(pSymbolTable)
		g_oInterface.Free(pSymbolTable);

	ClearSegment(&oSymbolSegment);

	return pSegment;
}