Exemple #1
0
/**
 * Advance past the reti (or virtual reti) according to |step|.
 * Return 0 if successful, or nonzero if an unhandled trap occurred.
 */
static int exit_syscall(struct context* ctx,
			const struct rep_trace_step* step,
			int stepi)
{
	int i, emu = step->syscall.emu;

	if (!emu) {
		int ret = cont_syscall_boundary(ctx, emu, stepi);
		if (ret) {
			return ret;
		}
	}

	for (i = 0; i < step->syscall.num_emu_args; ++i) {
		set_child_data(ctx);
	}
	if (step->syscall.emu_ret) {
		set_return_value(ctx);
	}
	validate_args(step->syscall.no, STATE_SYSCALL_EXIT, ctx);

	if (emu) {
		/* XXX verify that this can't be interrupted by a
		 * breakpoint trap */
		step_exit_syscall_emu(ctx);
	}
	return 0;
}
//! It seems that shared code cache does not support helper switch
//! The return value is stored to glue->retval first
int op_return_wide() {
    u2 vA = INST_AA(inst);
    get_virtual_reg(vA, OpndSize_64, 1, false);
    scratchRegs[0] = PhysicalReg_SCRATCH_10; scratchRegs[1] = PhysicalReg_Null;
    scratchRegs[2] = PhysicalReg_Null; scratchRegs[3] = PhysicalReg_Null;
    set_return_value(OpndSize_64, 1, false);

    common_returnFromMethod();
    rPC += 1;
    return 0;
}
//! It seems that shared code cache does not support helper switch
//! The return value is stored to glue->retval first
int op_return() {
    u2 vA = INST_AA(inst);

    get_virtual_reg(vA, OpndSize_32, 22, false);
    scratchRegs[0] = PhysicalReg_SCRATCH_1;
    set_return_value(OpndSize_32, 22, false);

    common_returnFromMethod();
    rPC += 1;
    return 0;
}