示例#1
0
void	three_params_second(int i, t_data *data, t_instruc *inst, int *order)
{
	if (g_op[i].param_type[*order] == T_REG)
	{
		if (is_register(inst->trim, data, inst, order) == 1)
			return ;
		else
			error_line(data, "Incorrect input parameters");
	}
	else if (g_op[i].param_type[*order] == (T_REG | T_DIR | T_IND))
	{
		if (three_params_second_cut(data, inst, order) == 1)
			return ;
	}
	else if (g_op[i].param_type[*order] == (T_DIR | T_REG))
	{
		if (is_direct(inst->trim, data, inst, order) == 1)
			return ;
		else if (is_register(inst->trim, data, inst, order) == 1)
			return ;
		else
			error_line(data, "Incorrect input parameters");
	}
	else
		error_line(data, "Incorrect input parameters");
}
示例#2
0
文件: x86_64.c 项目: karibou/progit
/*
 * for Xen extraction
 */
unsigned long long
kvtop_xen_x86_64(unsigned long kvaddr)
{
	unsigned long long dirp, entry;

	if (!is_xen_vaddr(kvaddr))
		return NOT_PADDR;

	if (is_xen_text(kvaddr))
		return (unsigned long)kvaddr - XEN_VIRT_START + info->xen_phys_start;

	if (is_direct(kvaddr))
		return (unsigned long)kvaddr - DIRECTMAP_VIRT_START;

	if ((dirp = kvtop_xen_x86_64(SYMBOL(pgd_l4))) == NOT_PADDR)
		return NOT_PADDR;
	dirp += pml4_index(kvaddr) * sizeof(unsigned long long);
	if (!readmem(MADDR_XEN, dirp, &entry, sizeof(entry)))
		return NOT_PADDR;

	if (!(entry & _PAGE_PRESENT))
		return NOT_PADDR;

	dirp = entry & ENTRY_MASK;
	dirp += pgd_index(kvaddr) * sizeof(unsigned long long);
	if (!readmem(MADDR_XEN, dirp, &entry, sizeof(entry)))
		return NOT_PADDR;

	if (!(entry & _PAGE_PRESENT))
		return NOT_PADDR;

	dirp = entry & ENTRY_MASK;
	dirp += pmd_index(kvaddr) * sizeof(unsigned long long);
	if (!readmem(MADDR_XEN, dirp, &entry, sizeof(entry)))
		return NOT_PADDR;

	if (!(entry & _PAGE_PRESENT))
		return NOT_PADDR;

	if (entry & _PAGE_PSE) {
		entry = (entry & ENTRY_MASK) + (kvaddr & ((1UL << PMD_SHIFT) - 1));
		return entry;
	}
	dirp = entry & ENTRY_MASK;
	dirp += pte_index(kvaddr) * sizeof(unsigned long long);
	if (!readmem(MADDR_XEN, dirp, &entry, sizeof(entry)))
		return NOT_PADDR;

	if (!(entry & _PAGE_PRESENT)) {
		return NOT_PADDR;
	}

	entry = (entry & ENTRY_MASK) + (kvaddr & ((1UL << PTE_SHIFT) - 1));

	return entry;
}
示例#3
0
int		three_params_second_cut(t_data *data, t_instruc *inst, int *order)
{
	if (is_register(inst->trim, data, inst, order) == 1)
		return (1);
	else if (is_direct(inst->trim, data, inst, order) == 1)
		return (1);
	else if (is_indirect(inst->trim, data, inst, order) == 1)
		return (1);
	else
		error_line(data, "Incorrect input parameters");
	return (0);
}