예제 #1
0
void CAliasTest::Compile(Jitter::CJitter& jitter)
{
	Framework::CMemStream codeStream;
	jitter.SetStream(&codeStream);

	jitter.Begin();
	{
		jitter.PushCst64(0);
		jitter.PullRel64(offsetof(CONTEXT, value0));

		jitter.PushCst(CONSTANT_1);
		jitter.PullRel(offsetof(CONTEXT, value0[0]));

		jitter.PushCst(CONSTANT_2);
		jitter.PullRel(offsetof(CONTEXT, value0[1]));

		jitter.PushRel64(offsetof(CONTEXT, value0));
		jitter.PushRel64(offsetof(CONTEXT, value1));
		jitter.Cmp64(Jitter::CONDITION_EQ);
		jitter.PullRel(offsetof(CONTEXT, result));

		for(unsigned int i = 0; i < 4; i++)
		{
			jitter.PushCst(0);
			jitter.PullRel(offsetof(CONTEXT, value4[i]));
		}

		jitter.MD_PushRel(offsetof(CONTEXT, value2));
		jitter.MD_PushRel(offsetof(CONTEXT, value3));
		jitter.MD_AddWSS();
		jitter.MD_PullRel(offsetof(CONTEXT, value4), true, false, false, true);
	}
	jitter.End();

	m_function = CMemoryFunction(codeStream.GetBuffer(), codeStream.GetSize());
}
예제 #2
0
void CCmp64Test::Compile(Jitter::CJitter& jitter)
{
	Framework::CMemStream codeStream;
	jitter.SetStream(&codeStream);

	jitter.Begin();
	{
		//Equal
		//---------------------------------
		jitter.PushRel64(offsetof(CONTEXT, value0));
		if(m_useConstant)
		{
			jitter.PushCst64(m_value1);
		}
		else
		{
			jitter.PushRel64(offsetof(CONTEXT, value1));
		}
		jitter.Cmp64(Jitter::CONDITION_EQ);
		jitter.PullRel(offsetof(CONTEXT, resultEq));

		//Not Equal
		//---------------------------------
		jitter.PushRel64(offsetof(CONTEXT, value0));
		if(m_useConstant)
		{
			jitter.PushCst64(m_value1);
		}
		else
		{
			jitter.PushRel64(offsetof(CONTEXT, value1));
		}
		jitter.Cmp64(Jitter::CONDITION_NE);
		jitter.PullRel(offsetof(CONTEXT, resultNe));

		//Less Than (unsigned)
		//---------------------------------
		jitter.PushRel64(offsetof(CONTEXT, value0));
		if(m_useConstant)
		{
			jitter.PushCst64(m_value1);
		}
		else
		{
			jitter.PushRel64(offsetof(CONTEXT, value1));
		}
		jitter.Cmp64(Jitter::CONDITION_BL);
		jitter.PullRel(offsetof(CONTEXT, resultBl));

		//Less Than (signed)
		//---------------------------------
		jitter.PushRel64(offsetof(CONTEXT, value0));
		if(m_useConstant)
		{
			jitter.PushCst64(m_value1);
		}
		else
		{
			jitter.PushRel64(offsetof(CONTEXT, value1));
		}
		jitter.Cmp64(Jitter::CONDITION_LT);
		jitter.PullRel(offsetof(CONTEXT, resultLt));

		//Less Equal (signed)
		//---------------------------------
		jitter.PushRel64(offsetof(CONTEXT, value0));
		if(m_useConstant)
		{
			jitter.PushCst64(m_value1);
		}
		else
		{
			jitter.PushRel64(offsetof(CONTEXT, value1));
		}
		jitter.Cmp64(Jitter::CONDITION_LE);
		jitter.PullRel(offsetof(CONTEXT, resultLe));

		//Greater Than (unsigned)
		//---------------------------------
		jitter.PushRel64(offsetof(CONTEXT, value0));
		if(m_useConstant)
		{
			jitter.PushCst64(m_value1);
		}
		else
		{
			jitter.PushRel64(offsetof(CONTEXT, value1));
		}
		jitter.Cmp64(Jitter::CONDITION_AB);
		jitter.PullRel(offsetof(CONTEXT, resultAb));

		//Greater Than (signed)
		//---------------------------------
		jitter.PushRel64(offsetof(CONTEXT, value0));
		if(m_useConstant)
		{
			jitter.PushCst64(m_value1);
		}
		else
		{
			jitter.PushRel64(offsetof(CONTEXT, value1));
		}
		jitter.Cmp64(Jitter::CONDITION_GT);
		jitter.PullRel(offsetof(CONTEXT, resultGt));
	}
	jitter.End();

	m_function = CMemoryFunction(codeStream.GetBuffer(), codeStream.GetSize());
}