void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)

{

    const ARMCPRegInfo *ri = rip;

    int target_el;



    if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14

        && extract32(env->cp15.c15_cpar, ri->cp, 1) == 0) {

        raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env));

    }



    if (!ri->accessfn) {

        return;

    }



    switch (ri->accessfn(env, ri)) {

    case CP_ACCESS_OK:

        return;

    case CP_ACCESS_TRAP:

        target_el = exception_target_el(env);

        break;

    case CP_ACCESS_TRAP_EL2:

        /* Requesting a trap to EL2 when we're in EL3 or S-EL0/1 is

         * a bug in the access function.

         */

        assert(!arm_is_secure(env) && !arm_current_el(env) == 3);

        target_el = 2;

        break;

    case CP_ACCESS_TRAP_EL3:

        target_el = 3;

        break;

    case CP_ACCESS_TRAP_UNCATEGORIZED:

        target_el = exception_target_el(env);

        syndrome = syn_uncategorized();

        break;

    default:

        g_assert_not_reached();

    }



    raise_exception(env, EXCP_UDEF, syndrome, target_el);

}

void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)

{

    const ARMCPRegInfo *ri = rip;

    int target_el;



    if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14

        && extract32(env->cp15.c15_cpar, ri->cp, 1) == 0) {

        raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env));

    }



    if (!ri->accessfn) {

        return;

    }



    switch (ri->accessfn(env, ri)) {

    case CP_ACCESS_OK:

        return;

    case CP_ACCESS_TRAP:

        target_el = exception_target_el(env);

        break;

    case CP_ACCESS_TRAP_EL2:

        





        assert(!arm_is_secure(env) && !arm_current_el(env) == 3);

        target_el = 2;

        break;

    case CP_ACCESS_TRAP_EL3:

        target_el = 3;

        break;

    case CP_ACCESS_TRAP_UNCATEGORIZED:

        target_el = exception_target_el(env);

        syndrome = syn_uncategorized();

        break;

    default:

        g_assert_not_reached();

    }



    raise_exception(env, EXCP_UDEF, syndrome, target_el);

}

void FUNC_0(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)

{

    const ARMCPRegInfo *VAR_0 = rip;

    int VAR_1;



    if (arm_feature(env, ARM_FEATURE_XSCALE) && VAR_0->cp < 14

        && extract32(env->cp15.c15_cpar, VAR_0->cp, 1) == 0) {

        raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env));

    }



    if (!VAR_0->accessfn) {

        return;

    }



    switch (VAR_0->accessfn(env, VAR_0)) {

    case CP_ACCESS_OK:

        return;

    case CP_ACCESS_TRAP:

        VAR_1 = exception_target_el(env);

        break;

    case CP_ACCESS_TRAP_EL2:

        





        assert(!arm_is_secure(env) && !arm_current_el(env) == 3);

        VAR_1 = 2;

        break;

    case CP_ACCESS_TRAP_EL3:

        VAR_1 = 3;

        break;

    case CP_ACCESS_TRAP_UNCATEGORIZED:

        VAR_1 = exception_target_el(env);

        syndrome = syn_uncategorized();

        break;

    default:

        g_assert_not_reached();

    }



    raise_exception(env, EXCP_UDEF, syndrome, VAR_1);

}

void FUNC_0(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)
{ const ARMCPRegInfo *VAR_0 = rip; int VAR_1; if (arm_feature(env, ARM_FEATURE_XSCALE) && VAR_0->cp < 14
&& extract32(env->cp15.c15_cpar, VAR_0->cp, 1) == 0) { raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env)); } if (!VAR_0->accessfn) { return; } switch (VAR_0->accessfn(env, VAR_0)) { case CP_ACCESS_OK:
return; case CP_ACCESS_TRAP:
VAR_1 = exception_target_el(env); break; case CP_ACCESS_TRAP_EL2:
assert(!arm_is_secure(env) && !arm_current_el(env) == 3); VAR_1 = 2; break; case CP_ACCESS_TRAP_EL3:
VAR_1 = 3; break; case CP_ACCESS_TRAP_UNCATEGORIZED:
VAR_1 = exception_target_el(env); syndrome = syn_uncategorized(); break; default:
g_assert_not_reached(); } raise_exception(env, EXCP_UDEF, syndrome, VAR_1); }