From ad63ee7509e6207eda6b9f8f857e8f2459c75ec2 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 18 Nov 2019 20:16:44 -0500 Subject: [PATCH] target/arm/cpu: Use div-round-up to determine predicate register array size Unless we're guaranteed to always increase ARM_MAX_VQ by a multiple of four, then we should use DIV_ROUND_UP to ensure we get an appropriate array size. Backports commit 46417784d21c89446763f2047228977bdc267895 from qemu --- qemu/target/arm/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu/target/arm/cpu.h b/qemu/target/arm/cpu.h index 7d321075..05dcb0b3 100644 --- a/qemu/target/arm/cpu.h +++ b/qemu/target/arm/cpu.h @@ -185,7 +185,7 @@ typedef struct ARMVectorReg { #ifdef TARGET_AARCH64 /* In AArch32 mode, predicate registers do not exist at all. */ typedef struct ARMPredicateReg { - uint64_t QEMU_ALIGNED(16, p[2 * ARM_MAX_VQ / 8]); + uint64_t QEMU_ALIGNED(16, p[DIV_ROUND_UP(2 * ARM_MAX_VQ, 8)]); } ARMPredicateReg; /* In AArch32 mode, PAC keys do not exist at all. */