]> git.proxmox.com Git - mirror_qemu.git/commit
target/mips: tcg: detect out-of-bounds accesses to cpu_gpr and cpu_gpr_hi
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 Apr 2023 17:28:36 +0000 (19:28 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 20 Apr 2023 09:17:35 +0000 (11:17 +0200)
commitdfae46c3ba4880036a3df0b0aafca0c792b7cb9d
treef43e30b2d4ceb4eb332783388c1597bca7db6d4e
parentcc03dfa827819c78fdc6c8c5065910d6ac2567f1
target/mips: tcg: detect out-of-bounds accesses to cpu_gpr and cpu_gpr_hi

In some cases (for example gen_compute_branch_nm in
nanomips_translate.c.inc) registers can be unused
on some paths and a negative value is passed in that case:

        gen_compute_branch_nm(ctx, OPC_BPOSGE32, 4, -1, -2,
                              imm << 1);

To avoid an out of bounds access in those cases, introduce
assertions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/mips/tcg/translate.c