Skip to content

Commit

Permalink
target/hppa: Mask inputs in copy_iaoq_entry
Browse files Browse the repository at this point in the history
Ensure that the destination is always a valid GVA offset.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Nov 7, 2023
1 parent 9a91dd8 commit f13bf34
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions target/hppa/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,22 @@ static target_ureg gva_offset_mask(DisasContext *ctx)
static void copy_iaoq_entry(DisasContext *ctx, TCGv_reg dest,
target_ureg ival, TCGv_reg vval)
{
if (unlikely(ival == -1)) {
target_ureg mask = gva_offset_mask(ctx);

if (ival != -1) {
tcg_gen_movi_reg(dest, ival & mask);
return;
}
tcg_debug_assert(vval != NULL);

/*
* We know that the IAOQ is already properly masked.
* This optimization is primarily for "iaoq_f = iaoq_b".
*/
if (vval == cpu_iaoq_f || vval == cpu_iaoq_b) {
tcg_gen_mov_reg(dest, vval);
} else {
tcg_gen_movi_reg(dest, ival);
tcg_gen_andi_reg(dest, vval, mask);
}
}

Expand Down

0 comments on commit f13bf34

Please sign in to comment.