Пример #1
0
static void
do_cpuid (void)
{
	u32 ia, oa, ob, oc, od;
	ulong la;

	vt_read_general_reg(GENERAL_REG_RAX, &la);

	/* Ex5: Add your code here */
	if (la == 0xFeedCafe) {

	}

	ia = la;
	cpuid(ia, &oa, &ob, &oc, &od);

	/* remove vmx support in Matrix */
	if (ia == CPUID_1)
		oc &= ~CPUID_1_ECX_VMX_BIT;

	vt_write_general_reg(GENERAL_REG_RAX, oa);
	vt_write_general_reg(GENERAL_REG_RBX, ob);
	vt_write_general_reg(GENERAL_REG_RCX, oc);
	vt_write_general_reg(GENERAL_REG_RDX, od);

	add_ip();
}
Пример #2
0
static void
do_cpuid (void)
{
	u32 ia, oa, ob, oc, od;
	ulong la;

	vt_read_general_reg(GENERAL_REG_RAX, &la);

	/* Ex5: The CODE */
	/* Assign a speical 'code' to RAX, like 0xDeadBeef. */
	/* So when you execute cpuid with the value of RAX  */
	/* equals to '0xFeedCafe', you will get the respond.*/
	/* The respond indicates that you are in the Matrix.*/
	/* Hint: vt_write_general_reg(), add_ip()           */
	if (la == 0xFeedCafe) {
		/* Add your code here. */
	}

	ia = la;
	cpuid(ia, &oa, &ob, &oc, &od);

	/* remove vmx support in Matrix */
	if (ia == CPUID_1)
		oc &= ~CPUID_1_ECX_VMX_BIT;

	vt_write_general_reg(GENERAL_REG_RAX, oa);
	vt_write_general_reg(GENERAL_REG_RBX, ob);
	vt_write_general_reg(GENERAL_REG_RCX, oc);
	vt_write_general_reg(GENERAL_REG_RDX, od);

	add_ip();
}