Пример #1
0
void FunctionReg_Syscall(OpcodeInfo *thisOp, FuncProp *fp)
{
	SYMBOL* CallSym = FindSysCall(thisOp->imm);

	if (CallSym)
	{
		int params = CallSym->Params;
		int p;

		for (p=0;p<params;p++)
		{
			// check if this reg was assigned previously, if it was'nt it is uninitialized before use
	
			int is_assigned = fp->assign_reg & REGBIT(REG_i0 + p);
	
			if (!is_assigned)
				fp->uninit_reg |= REGBIT(REG_i0 + p);
	
			fp->src_reg |= REGBIT(REG_i0 + p);
		}

		// Check what the function returns
		// Do nothing for void
		
		if (CallSym->RetType == RET_int   ||
			CallSym->RetType == RET_float)
			fp->dst_reg |= REGBIT(REG_r14);

		if (CallSym->RetType == RET_double)
			fp->dst_reg |= REGBIT(REG_r14) | REGBIT(REG_r15);
	}
}
Пример #2
0
void RebuildCpp_EmitExtensionsProto()
{
	SYMBOL *sym;
	int len = sizeof(CppSyscallUsed);
	int n;

	for (n=0;n<len;n++)
	{
			sym = FindSysCall(n);

			if (sym)
				RebuildCpp_EmitSyscallFunc(sym, 1, 1);
	}
}
Пример #3
0
void RebuildCpp_EmitExtensions(int stub)
{
	SYMBOL *sym;
	int len = sizeof(CppSyscallUsed);
	int n;

	for (n=0;n<len;n++)
	{
		if (CppSyscallUsed[n])
		{
			sym = FindSysCall(n);

			if (sym)
				RebuildCpp_EmitSyscallFunc(sym, 0, stub);
		}
	}
}
Пример #4
0
void JavaDecodeSysCall(OpcodeInfo *theOp)
{
	int param_count, need_comma, n;

	SYMBOL *theSysCall =  FindSysCall(theOp->imm);

	if (!theSysCall)
	{
		Error(Error_System, "Could'nt locate syscall\n");
		return;
	}

	JavaSyscallUsed[theOp->imm]++;

	param_count = theSysCall->Params;

	JavaEmitReturnType(theSysCall->RetType);

	if (theSysCall->Interface == 0)
		RebuildEmit( SYSCALLDOT "%s(", theSysCall->Name + 1);
	else
		RebuildEmit("%s(", theSysCall->Name);

	if (param_count > 4)
		param_count = 4;

	need_comma = 0;

	for (n=0;n<param_count;n++)
	{
		if (need_comma)
			RebuildEmit(", ");				
	
		RebuildEmit("%s", java_reg[REG_i0 + n]);
		need_comma = 1;
	}

	RebuildEmit(");");

	if (theSysCall->RetType == RET_double)
	{
		RebuildEmit("\n	r15 = " DBL_HIGH ";");
		SetRegInit(REG_r15);
	}
}
Пример #5
0
void CppDecodeSysCall(OpcodeInfo *theOp)
{
	int param_count, need_comma, n;

	SYMBOL *syscall =  FindSysCall(theOp->imm);

	if (!syscall)
	{
		Error(Error_System, "Could'nt locate syscall\n");
		return;
	}

	CppSyscallUsed[theOp->imm]++;

	param_count = syscall->Params;

	CppEmitReturnType(syscall->RetType);


	RebuildEmit("SYSCALL(");
	RebuildEmit("%s", &syscall->Name[1]);
	RebuildEmit(")(");

	if (param_count > 4)
		param_count = 4;

	need_comma = 0;

	for (n=0;n<param_count;n++)
	{
		if (need_comma)
			RebuildEmit(", ");

		RebuildEmit("%s", Cpp_reg[REG_i0 + n]);
		need_comma = 1;
	}

	RebuildEmit(");");

	if (syscall->RetType == RET_double)
		RebuildEmit("\n	r15 = __dbl_high;");
}