target/arm: Check access permission to ADDVL/ADDPL/RDVL

These instructions do not trap when SVE is disabled in EL0,
causing them to be executed with wrong size information.

Backports commit 5de56742a3c91de3d646326bec43a989bba83ca4 from qemu
This commit is contained in:
Amir Charif 2019-03-19 05:42:50 -04:00 committed by Lioncash
parent 4dc3d59fd3
commit 2392d8b8ab
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -999,27 +999,33 @@ static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a)
static bool trans_ADDVL(DisasContext *s, arg_ADDVL *a)
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i64 rd = cpu_reg_sp(s, a->rd);
TCGv_i64 rn = cpu_reg_sp(s, a->rn);
tcg_gen_addi_i64(tcg_ctx, rd, rn, a->imm * vec_full_reg_size(s));
if (sve_access_check(s)) {
TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i64 rd = cpu_reg_sp(s, a->rd);
TCGv_i64 rn = cpu_reg_sp(s, a->rn);
tcg_gen_addi_i64(tcg_ctx, rd, rn, a->imm * vec_full_reg_size(s));
}
return true;
}
static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a)
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i64 rd = cpu_reg_sp(s, a->rd);
TCGv_i64 rn = cpu_reg_sp(s, a->rn);
tcg_gen_addi_i64(tcg_ctx, rd, rn, a->imm * pred_full_reg_size(s));
if (sve_access_check(s)) {
TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i64 rd = cpu_reg_sp(s, a->rd);
TCGv_i64 rn = cpu_reg_sp(s, a->rn);
tcg_gen_addi_i64(tcg_ctx, rd, rn, a->imm * pred_full_reg_size(s));
}
return true;
}
static bool trans_RDVL(DisasContext *s, arg_RDVL *a)
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i64 reg = cpu_reg(s, a->rd);
tcg_gen_movi_i64(tcg_ctx, reg, a->imm * vec_full_reg_size(s));
if (sve_access_check(s)) {
TCGContext *tcg_ctx = s->uc->tcg_ctx;
TCGv_i64 reg = cpu_reg(s, a->rd);
tcg_gen_movi_i64(tcg_ctx, reg, a->imm * vec_full_reg_size(s));
}
return true;
}