esil2reil.c
// Used to cast sizes during assignment. OR is used for casting.
// Pushes the new *casted* src onto stack. Warning: Frees the original src!
Used to cast sizes during assignment. OR is used for casting.
Pushes the new *casted* src onto stack. Warning: Frees the original src!
Used to cast sizes during assignment . OR is used for casting . Pushes the new * casted * src onto stack . Warning : Frees the original src!
void reil_cast_size(RAnalEsil *esil, RAnalReilArg *src, RAnalReilArg *dst) {
	char tmp_buf[REGBUFSZ];
	RAnalReilInst *ins;
	if (!src || !dst) {
		return;
	}
	if (src->size == dst->size) {
		reil_push_arg(esil, src);
		return;
	}
	snprintf (tmp_buf, REGBUFSZ-1, "0:%d", dst->size);
	r_anal_esil_push (esil, tmp_buf);
	ins = R_NEW0 (RAnalReilInst);
	if (!ins) {
		return;
	}
	ins->opcode = REIL_OR;
	ins->arg[0] = src;
	ins->arg[1] = reil_pop_arg (esil);
	ins->arg[2] = R_NEW0(RAnalReilArg);
	get_next_temp_reg (esil, tmp_buf);
	reil_make_arg (esil, ins->arg[2], tmp_buf);
	if (ins->arg[2]) {
		ins->arg[2]->size = dst->size;
	}
	reil_print_inst (esil, ins);
	if (ins->arg[2]) {
		reil_push_arg (esil, ins->arg[2]);
	}
	reil_free_inst (ins);
}
void reil_cast_size ( RAnalEsil * esil , RAnalReilArg * src , RAnalReilArg * dst ) { char tmp_buf [ REGBUFSZ ] ; RAnalReilInst * ins ; if ( ! src || ! dst ) { return ; } if ( src -> size == dst -> size ) { reil_push_arg ( esil , src ) ; return ; } snprintf ( tmp_buf , REGBUFSZ - 1 , " " , dst -> size ) ; r_anal_esil_push ( esil , tmp_buf ) ; ins = R_NEW0 ( RAnalReilInst ) ; if ( ! ins ) { return ; } ins -> opcode = REIL_OR ; ins -> arg [ 0 ] = src ; ins -> arg [ 1 ] = reil_pop_arg ( esil ) ; ins -> arg [ 2 ] = R_NEW0 ( RAnalReilArg ) ; get_next_temp_reg ( esil , tmp_buf ) ; reil_make_arg ( esil , ins -> arg [ 2 ] , tmp_buf ) ; if ( ins -> arg [ 2 ] ) { ins -> arg [ 2 ] -> size = dst -> size ; } reil_print_inst ( esil , ins ) ; if ( ins -> arg [ 2 ] ) { reil_push_arg ( esil , ins -> arg [ 2 ] ) ; } reil_free_inst ( ins ) ; }
Used to cast sizes during assignment.
Used to cast sizes during assignment .
// No need to case sizes if dst and src are of same size.