Ejemplo n.º 1
0
static int vtimer_emulate_cp32(struct cpu_user_regs *regs, union hsr hsr)
{
    struct hsr_cp32 cp32 = hsr.cp32;
    uint32_t *r = (uint32_t *)select_user_reg(regs, cp32.reg);

    switch ( hsr.bits & HSR_CP32_REGS_MASK )
    {
    case HSR_CPREG32(CNTP_CTL):
        vtimer_cntp_ctl(regs, r, cp32.read);
        return 1;

    case HSR_CPREG32(CNTP_TVAL):
        vtimer_cntp_tval(regs, r, cp32.read);
        return 1;

    default:
        return 0;
    }
}
Ejemplo n.º 2
0
Archivo: vtimer.c Proyecto: 0day-ci/xen
static int vtimer_emulate_cp32(struct cpu_user_regs *regs, union hsr hsr)
{
    struct hsr_cp32 cp32 = hsr.cp32;
    /*
     * Initialize to zero to avoid leaking data if there is an
     * implementation error in the emulation (such as not correctly
     * setting r).
     */
    uint32_t r = 0;
    int res;


    if ( cp32.read )
        perfc_incr(vtimer_cp32_reads);
    else
        perfc_incr(vtimer_cp32_writes);

    if ( !cp32.read )
        r = get_user_reg(regs, cp32.reg);

    switch ( hsr.bits & HSR_CP32_REGS_MASK )
    {
    case HSR_CPREG32(CNTP_CTL):
        res = vtimer_cntp_ctl(regs, &r, cp32.read);
        break;

    case HSR_CPREG32(CNTP_TVAL):
        res = vtimer_cntp_tval(regs, &r, cp32.read);
        break;

    default:
        return 0;
    }

    if ( res && cp32.read )
        set_user_reg(regs, cp32.reg, r);

    return res;
}